Commit graph

29 commits

Author SHA1 Message Date
Elliott Hughes
7d3c6cd25c Document pthread_key_create(3), pthread_key_delete(3), and PTHREAD_KEYS_MAX.
In particular "how to work around the PTHREAD_KEYS_MAX limit".

Change-Id: I330936d598ddddfa0903f0505fd00f8fcbf02543
2024-04-18 22:02:38 +00:00
Elliott Hughes
b266f6522f Add LINE_MAX.
LINE_MAX is a bad idea from the 1970s that we've ignored until now,
but there's already one hack in the AOSP tree (external/ltp) to work
around its absence, and kselftests would need another. Both uses are
bad code, but bad code exists, and iOS/macOS and musl/glibc all have
the same 2048 value, and it is in POSIX, so at least it's consistent
idiocy. Hopefully we're not encouraging more of it!

Bug: https://github.com/llvm/llvm-project/issues/88119
Change-Id: Ief219c3fe20b3d95da7040c4b9411f997b1c0470
2024-04-09 15:41:10 +00:00
Elliott Hughes
19d7685982 More <limits.h> fixes.
Went through the POSIX spec for the _POSIX* and _XOPEN* constants.

Bug: http://b/32776472
Test: ran tests
Change-Id: I389100dbc7de354eae9056e44b0a7fa8c37374e3
2017-10-18 13:27:01 -07:00
Elliott Hughes
3a8f75d8b0 POSIX clock cleanup.
The newest of these clocks was added in Linux 2.6.12, so no need for runtime
checks.

Add CTS tests that we can actually use the various clocks.

Bug: http://b/67458266
Test: ran tests
Change-Id: I3cfd7982043d6f8d4ebdc2b29e8722334f443ce5
2017-10-05 10:33:18 -07:00
Elliott Hughes
06bd5862b1 POSIX getlogin_r/LOGIN_NAME_MAX/TTY_NAME_MAX.
Bug: N/A
Test: ran tests
Change-Id: I97c8ecc82fb09c3fa4bb5e6f000d46f04f3d1702
2017-07-28 16:34:38 -07:00
Elliott Hughes
964564d290 Claim to have a POSIX shell and utilities.
We pretty much do these days. And apparently some GNU tools turn on obsolete
backwards-compatible behaviors otherwise.

Bug: http://b/63145226
Test: builds
Change-Id: I9a8af860768cc2c10548f172d1e8b4fba3e5115b
2017-07-05 16:45:55 -07:00
Elliott Hughes
9af74907d1 Clean up <sys/limits.h> a bit.
<sys/limits.h> shouldn't even exist, but leave it in for backwards
compatibility.

Everything that seems legit moves to <limits.h>, though it still seems
like a lot of that ought to come from the compiler instead (there's even
an angry rant in the clang header to that effect).

Unfortunately, we've long exposed [a copy and paste of] the contents
of <float.h> from <limits.h> and <sys/limits.h>. This patch preserves
that for backwards compatibility, but at least switches us over to
using the real <float.h> instead.

Bug: http://b/32776472
Test: builds
Change-Id: I2d5b3b5237b3a0442195e99bb967c076ce484f35
2016-11-30 09:06:53 -08:00
Elliott Hughes
f2d7d41ff8 Add IOV_MAX to <limits.h>.
strace 4.13 assumes we have IOV_MAX. POSIX says it lives here. 1024 is
a Linux kernel limitation.

Change-Id: Icb428172670e4936a459db38a6a190b7178fe9f3
2016-07-27 15:25:31 -07:00
Elliott Hughes
9c8d711aa5 Don't expose all BSD extensions.
Just expose the ones that bionic historically leaked.

Also, many of the M_* constants in <math.h> are actually POSIX.

Change-Id: I6275df84c5866b872b71f1c8ed14e2aada12b793
2016-06-13 14:14:43 -07:00
Elliott Hughes
3ba55f8022 Rationalize visibility.
If it's C or POSIX, it's in. If it's BSD or GNU, it's guarded by __USE_BSD
or __USE_GNU.

Bug: https://code.google.com/p/android/issues/detail?id=194631
Change-Id: Ife51a21c2b37b060db56780d29c929805b199cb6
2016-06-09 17:40:19 -07:00
Christopher Ferris
47fcffff60 Fix the SIZE_T_MAX SSIZE_MAX defines.
This should not affect the underlying values, just the types used
by the defines.

This fixes any warnings where code does something like:

  printf("%zx", SIZE_T_MAX);

Change-Id: I4beb6d382f30261e4fe133a88fb503984911326d
2016-06-09 16:35:37 -07:00
Elliott Hughes
6b3bec031f Fix various empty .h files in bionic.
Bug: http://b/28432688
Change-Id: I339f5221b9e66ce5983eb3685b9405e8d6f58808
2016-04-29 22:30:19 -07:00
Elliott Hughes
5704c423c8 Implement POSIX lockf.
This has been requested a few times over the years. This is basically
a very late rebase of https://android-review.googlesource.com/45470
which was abandoned years ago. One addition is that this version has
_FILE_OFFSET_BITS=64 support.

POSIX puts this in <unistd.h>. glibc also has it in <fcntl.h>.

Bug: http://b/13077650
Change-Id: I5862b1dc326e326c01ad92438ecc1578d19ba739
2016-01-26 11:09:44 -08:00
Elliott Hughes
36443fd542 Remove PAGE_SIZE from <limits.h>.
It turns out that everyone's still getting PAGE_SIZE from <sys/user.h> via
<sys/ucontext.h> via <signal.h> anyway.

glibc has PAGE_SIZE in <sys/user.h> rather than <limits.h> so this part is
good. The bad part is that we have such wide transitive inclusion of
<sys/user.h>!

Bug: http://b/22735893
Change-Id: I363adffe4a27b4ca1eedf695ea621f5dd2d5ca10
2015-07-28 19:54:53 -07:00
Elliott Hughes
820a86f2df Remove PAGESIZE.
This was pretty much unused, and isn't in glibc.

Bug: http://b/22735893
Change-Id: If17f0dcd931c90ef1ccb134a3950c3b0011a03f4
2015-07-28 16:46:06 -07:00
Elliott Hughes
afab3ffcce Move PAGE_MASK into <sys/user.h>.
I'm removing the TODO on the assumption that being compatible with glibc
is more useful than BSD. The new internal "bionic_page.h" header factors
out some duplication between libc and the linker.

Bug: http://b/22735893
Change-Id: I4aec4dcba5886fb6f6b9290a8f85660643261321
2015-07-28 14:58:37 -07:00
Yongqin Liu
0589777a33 limits.h: add define for HOST_NAME_MAX
according to the rules defined here:
    http://pubs.opengroup.org/onlinepubs/009695399/basedefs/limits.h.html
add the definition for HOST_NAME_MAX to limits.h file,
and set the default value to _POSIX_HOST_NAME_MAX as 255

Change-Id: Iddd5c6c569f4e0a14994c7a7c54985f3e7809fc4
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
2014-10-30 10:59:24 +08:00
Elliott Hughes
a186b2e0ca Clean up fpathconf(3)/pathconf(3).
fpathconf(3) and pathconf(3) can share code. There's no such
header file as <pathconf.h>. glibc/POSIX and BSD disagree about where
the _POSIX_* definitions should go.

Change-Id: I4a67f1595c9f5fbb26700a131178eedebd6bf712
2014-09-22 22:49:40 +00:00
Elliott Hughes
04303f5a8a Add semaphore tests, fix sem_destroy.
Bug: https://code.google.com/p/android/issues/detail?id=76088
Change-Id: I4a0561b23e90312384d40a1c804ca64ee98f4066
2014-09-19 17:37:06 -07:00
Elliott Hughes
69f05d291d Fix the printf family for non-ASCII.
The bug here turned out to be that we hadn't increased the constant
corresponding to the maximum number of bytes in a character to match
our new implementation, so any character requiring more than a byte
in UTF-8 would break our printf family.

Bug: 15439554
Change-Id: I693e5e6eb11c640b5886e848502908ec5fff53b1
2014-06-05 23:19:15 -07:00
Calin Juravle
eab395e4a8 Reserve space in mbstate to allow for proper wchar support
Bug: 14382788
Change-Id: If023ac9bb65f95135cae7ebe89147e3985a69a96
2014-04-29 20:28:29 +01:00
Elliott Hughes
1b0dc40980 Remove <machine/limits.h>.
Change-Id: I7f9e9538517f726d4f08bf1f4b8d57c54d3f1676
2014-04-01 17:16:59 -07:00
Elliott Hughes
0e44bc3bae Remove <asm/page.h>.
If we have PAGE_SIZE/PAGESIZE, POSIX says they should be in <limits.h>.

Change-Id: I3c2d574ea2aea81f524874a156361411a4ffa18e
2014-02-24 15:55:31 -08:00
David 'Digit' Turner
f8a2c51bf3 LONG_LONG_MIN/MAX: Move declarations to <limits.h>
LONG_LONG_MIN, LONG_LONG_MAX and ULONG_LONG_MAX are
GLibc-specific macros that are better defined in <limits.h>
instead of the current exotic location (<pthread.h>).

Note that GCC's <limits.h> only defines these macros
when __GNU_LIBRARY__ is also defined. This is only the
case when building against GLibc, so manually redefine
the macros here.

Note that using LLONG_MIN/LLONG_MAX/ULLONG_MAX is the
C99-compliant way to get these values, but it's easier
to define these compatibility macros for the sake of
porting existing code.

Change-Id: I8023918d73b4685238054932f94a4006c1ca7d03
2012-10-15 18:52:55 +02:00
Arun Raghavan
6331db3fd2 limits.h: Include page.h when relying on PAGE_SIZE
limits.h relies on PAGE_SIZE being defined without actually including
page.h. Make sure this is included to avoid compilation failures.

Signed-off-by: Arun Raghavan <arun.raghavan@collabora.co.uk>
2012-07-10 10:36:37 +05:30
David 'Digit' Turner
50ace4fec5 Remove compiler warnings when building Bionic.
Also add missing declarations to misc. functions.
Fix clearerr() implementation (previous was broken).
Handle feature test macros like _POSIX_C_SOURCE properly.

Change-Id: Icdc973a6b9d550a166fc2545f727ea837fe800c4
2010-06-22 17:51:41 -07:00
The Android Open Source Project
1dc9e472e1 auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00
The Android Open Source Project
1767f908af auto import from //depot/cupcake/@135843 2009-03-03 18:28:13 -08:00
The Android Open Source Project
a27d2baa0c Initial Contribution 2008-10-21 07:00:00 -07:00