Commit graph

164 commits

Author SHA1 Message Date
Treehugger Robot
0962881106 Merge "s/master/main/" into main am: a01b292ab9 am: f461a3878c am: 3852cfe4cb am: 3b3e2e9d46 am: 381d04c046
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2773870

Change-Id: If6c55eb8331d792fdb9836bc5cb32f220ed860a4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-05 21:12:57 +00:00
Elliott Hughes
9c06d16ca3 s/master/main/
Test: treehugger
Change-Id: I2c975b2f5f92f23c7357b6f7e785578504298cc6
2023-10-04 23:36:48 +00:00
Elliott Hughes
92424f76cb Merge "<termios.h>: add two new POSIX functions." into main am: b130e6dae0 am: f9189bb67d am: 0e87776adc am: 42fd8dbd98 am: 678e06ac31
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2729340

Change-Id: I4289276cf2977a006d1a771e8bec2a74a7902912
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-30 01:39:55 +00:00
Elliott Hughes
647472db9b <termios.h>: add two new POSIX functions.
musl already added tcgetwinsize() and tcsetwinsize(), but I didn't
notice.

Trivial single-line inlines added to a header that's already written
that way.

Test: treehugger
Change-Id: Iac95ea6a89f3872025c512f7e61987b81d0aafa7
2023-08-29 09:33:04 -07:00
Steven Moreland
4b3d3fa472 Merge "Revert^2 "fdsan android::Parcel"" 2023-06-30 17:02:54 +00:00
Steven Moreland
1d413fce69 Revert^2 "fdsan android::Parcel"
7836677d99

Change-Id: If972bf911fd61286780a7c9800239b83ecddccab
2023-06-22 23:03:57 +00:00
Priyanka Advani
9a97d9e2fa Merge "Revert "fdsan android::Parcel"" 2023-06-22 21:38:46 +00:00
Priyanka Advani
7836677d99 Revert "fdsan android::Parcel"
Revert submission 23699976-fdsan-parcel

Reason for revert: Possible culprit for b/288448299

Reverted changes: /q/submissionid:23699976-fdsan-parcel

Change-Id: I709d2629755b7d014763a7bbd03a65d9f6e7efa7
2023-06-22 21:22:35 +00:00
Steven Moreland
e426ec9421 Merge "fdsan android::Parcel" 2023-06-22 17:09:29 +00:00
Elliott Hughes
655e430b28 Remove the always-true __INTRODUCED_IN() annotations.
The NDK no longer supports API levels earlier than 21.

This *doesn't* include <ctype.h> because I have a separate change
rewriting that (that's blocked on the upcoming libc++ update).

Test: treehugger
Change-Id: I53e915f27011dfc0513e0c78d8799377e183ceca
2023-06-16 12:39:33 -07:00
Steven Moreland
94e2325940 fdsan android::Parcel
Parcel manages ownership of FDs from the binder kernel
in a complicated way. Since sizeof(Parcel) is frozen
in the ABI right now, and we can't allocate more things
on the heap in Parcel, we need to keep on managing
FD ownership manually there.

Ignore-AOSP-First: this requires some fixes only in
  git_master to avoid crashing

Bug: 287093457
Test: boot
Change-Id: I4976507727899f1bb09de41e97f329bee58a4572
2023-06-14 23:36:24 +00:00
Elliott Hughes
421b0ac28c Remove __INTRODUCED_IN_ architecture macros.
No longer used.

Test: treehugger
Change-Id: I90c2565d80fb65ab9bf3100fb85c897c3ed0afc2
2023-06-09 23:34:17 +00:00
zijunzhao
ac6d59cc75 Nullability check for modules in include/android directory
Bugs: b/245972273
Test: adb shell
Change-Id: Ic00d207331d9837a01cf96ec7fe623961e653051
2023-04-12 23:26:46 +00:00
Elliott Hughes
572053a02e Time for SEO in <android/api-level.h>.
So many names/numbers for one release...

Test: treehugger
Change-Id: I00ddb13485c185fc003ea087f1df404bc39fa435
2023-03-23 21:30:15 +00:00
Dan Albert
b3e895c86a Add macro for API level V.
No idea if this will be the actual API level or not, but that's all
the more reason to abstract it away early...

Bug: None
Test: None
Change-Id: I8a17bb42dbb08a6e760427514af8331e7dc9b549
2023-03-23 18:35:16 +00:00
Elliott Hughes
fbd79707c3 Remove <stdlib.h> cruft.
The next NDK to take these headers only supports API 21 and later.

Test: treehugger
Change-Id: Ib5962989c5c978996b04789c21c0822dd8792303
2023-02-24 19:48:50 +00:00
Elliott Hughes
59d90262ed Merge "Remove <fenv.h> inlines for obsolete API levels." 2023-02-24 19:23:24 +00:00
Elliott Hughes
f5e899d84d Merge "Remove <sys/stat.h> inlines for obsolete API levels." 2023-02-24 19:23:15 +00:00
Elliott Hughes
7dfa18a49f Merge "Remove <signal.h> inlines for obsolete API levels." 2023-02-24 19:19:19 +00:00
Elliott Hughes
66734f0c35 Merge "Remove <sys/mman.h> inlines for obsolete API levels." 2023-02-24 19:19:13 +00:00
Elliott Hughes
19ed204031 Remove <sys/mman.h> inlines for obsolete API levels.
The next NDK to take these headers only supports API 21 and later.

Test: treehugger
Change-Id: I64baf933d3796f20dee5c1465ed58f8bb45394b5
2023-02-24 00:41:30 +00:00
Elliott Hughes
acaaab007c Remove <errno.h> inlines for obsolete API levels.
The next NDK to take these headers only supports API 21 and later.

Test: treehugger
Change-Id: Ie9e9bc82612a326d9e608b0d5974231f4acc5638
2023-02-24 00:32:47 +00:00
Elliott Hughes
432a4afb1e Remove <signal.h> inlines for obsolete API levels.
The next NDK to take these headers only supports API 21 and later.

Test: treehugger
Change-Id: I8fe617e6eb781629ddf0b98b0037a9b3e54c559c
2023-02-24 00:28:20 +00:00
Elliott Hughes
2f5829b55d Remove <fenv.h> inlines for obsolete API levels.
The next NDK to take these headers only supports API 21 and later, so
clean up some of the trivial cruft.

Test: treehugger
Change-Id: Ib735a776d244cc82858f2ed629dd63a54dbaf650
2023-02-24 00:16:41 +00:00
Elliott Hughes
3f3a8cd57e Remove <sys/stat.h> inlines for obsolete API levels.
The next NDK to take these headers only supports API 21 and later.

Test: treehugger
Change-Id: Ia2a4c04fdd144cfbe961bdf8d4f53bd4958befe8
2023-02-23 22:53:37 +00:00
Elliott Hughes
6ccb71ca0c Merge "Remove <sys/statvfs.h> inlines for API level 19." 2023-02-23 18:55:04 +00:00
Elliott Hughes
3c3736e1bd Remove <sys/statvfs.h> inlines for API level 19.
API level 19 is no longer supported by the NDK.

While I'm here, let's remove the duplicated structure defintion (as
we've already done for `struct stat`).

Test: treehugger
Change-Id: I9d8286f9e7ba803f3131b6dcb0486ff1b0f9d5d1
2023-02-22 21:58:24 +00:00
Elliott Hughes
d3ebc2f7c4 Merge "Remove <stdlib.h> abs/labs/llabs inline for API level 19." 2023-02-21 21:14:49 +00:00
Elliott Hughes
527d01221e Remove <stdlib.h> abs/labs/llabs inline for API level 19.
API level 19 is no longer supported by the NDK.

Test: treehugger
Change-Id: I9fa1e9b3c492b3d3384e393994a7dddfdb35d805
2023-02-17 23:51:57 +00:00
Elliott Hughes
ed07723a34 Remove <sys/wait.h> wait4() inline for API level 18.
API level 18 is no longer supported by the NDK.

Test: treehugger
Change-Id: I526b628bf3aa9215c9832275f7eeaa15b52a107d
2023-02-17 23:41:55 +00:00
Brian Duddie
5cfca6b832 Add fdsan owner type for native_handle_t
Bug: 244214188
Test: validated alongside sensor service change
Change-Id: Ia576b551012c50def8a8ebe82115ceac35070dcb
2022-08-29 21:29:45 +00:00
Elliott Hughes
7b396aee5f Add the other known aliases for the recent Android releases.
Test: treehugger
Change-Id: Ic861cba14236a8e4cd60be340407a8c80cda6c8f
2022-07-15 17:04:50 -07:00
Michael Wright
8cd2ebf80e Add Android U API level to NDK headers
Test: Build
Change-Id: Ic1e0d8b7e5abf07045944d2f610764709b45c923
2022-06-25 00:56:08 +00:00
Ryan Prichard
88134649ee legacy strtof inline: don't set errno for "inf"
Bug: https://github.com/android/ndk/issues/415
Test: libc++'s std/strings/string.conversions/stof.pass.cpp
Change-Id: I2c6bab9e31fb1c916be991f72b04735b5df279c2
2022-04-28 23:17:33 -07:00
Peter Collingbourne
08b968b282 Avoid usage of LONG_BIT in signal headers.
Clang has its own limits.h which is ahead of ours on the inclusion
path. This header uses include_next to include our header, but only
in hosted mode. This means that in freestanding mode we don't get our
limits.h macro definitions, including LONG_BIT. This ends up causing
our signal.h to produce errors when included in freestanding mode on
32-bit platforms.

Fix the errors by replacing usage of LONG_BIT with (8 * sizeof(long))
in the signal headers.

Change-Id: I18ec7b6876d5f862beae09f0c011128eef97c869
2022-03-24 11:11:11 -07:00
Dan Albert
e4106253e7 Fix copy pasta in guard macro for weak symbols.
This was pretty broken. I think anything using this was being given
always-available annotations for everything but 32-bit x86? Treehugger
should complain loudly if this was actually impacting anything though.
I suspect not since the only user of this mode is mainline which
doesn't target far back enough to have arch-specific introduction
guards.

Test: treehugger
Bug: None
Change-Id: I64e96a89d83e64512e661e88915c48a091198992
2022-01-07 16:06:54 -08:00
Dan Albert
e791552fbb Add API level define for T.
Test: treehugger
Bug: None
Change-Id: I7a973bbd7e8d646f45f4d860d564f9f104aab134
2021-09-08 14:57:46 -07:00
Elliott Hughes
a37b18133d Rename __ANDROID_UNGUARDED_AVAILABILITY__ -> __ANDROID_UNAVAILABLE_SYMBOLS_ARE_WEAK__.
Also reduce some of the duplication in the macros.

Bug: http://b/179067538
Test: treehugger
Change-Id: I81ab341731b0faad6c7c5f00037feff8576abafb
2021-02-11 12:56:39 -08:00
Dan Albert
eae41f8eeb Fix __VERSIONER_NO_GUARD cases for availability.
libc++ still depends on these being declared even if they are
unavailable. This results in a worse error message (a link error
rather than a compiler diagnostic) if these functions end up being
used, but without the decl headers like libc++'s math.h can't be
included because it refers to an undeclared function.

For the cases where weak symbols aren't being used, don't annotate
these functions with their availability information.

Also need to avoid using __builtin_available for this case because the
NDK doesn't have __isOSVersionAtLeast yet.

__ANDROID_UNGUARDED_AVAILABILITY__ is being used as a proxy for
"building for the NDK" here because we don't have a good signal for
that which works for both the NDK proper and the NDK-in-the-platform
case.

Test: imported into the NDK, built and tested NDK
Bug: None
Change-Id: I9ef3e19a8fa083bca0be47b80dfef7ba52a94866
2021-02-01 12:53:22 -08:00
Jiyong Park
bb19208d66 Guard __libc_current_sigrtmin/max with __builtin_available
The two APIs were added for the API level 21 and beyond. Currently, its
existence is tested using the null check which is done regardless of the
min sdk version of the compilation unit. (which in turn required us to
mark the API symbol weak regardless of the min sdk version.)

Now, we have a better way of testing the API availability;
__builtin_available. The null check is replaced with the call to the
compiler-provided macro which determines if the code is running in a
version of OS where the API is known to exist.

Bug: 150860940
Bug: 134795810
Test: m
Change-Id: Ib96c78f8d3cc71d7e755d1eab86051517bbbcc44
2021-01-15 10:40:51 +09:00
Jiyong Park
23bfed2a10 __INTRODUCED_IN macros add the availability attribute
__INTRODUCED_IN (and its variants) macro is used to mark the
availability of an API symbol. The macros were used by the versioner
tool for the NDK clients. When the Bionic headers are processed by the
tool, APIs with the macros are guarded with __ANDROID_API__. e.g.,

void foo() __INTRDUCED_IN(30);

is processed into

\#if __ANDROID_API__ >= 30
void foo();
\#endif

by the versioner.

The macros however didn't play a role for other cases, e.g. OS
components.

This is too strict for NDK clients and too loose for the non-NDK
clients. For the former, this completely hides the APIs that are newer
than the min sdk version (__ANDROID_API__). For the latter, a call to
such an API can be made without being guarded.

This change is the first step towards a better way of handling the
native APIs availability. The plan is that every NDK APIs are annotated
with the availability attribute and callers are required to guard their
API calls with a runtime check if the API is newer than the min sdk
version of the caller.

In this change, the macros now emits the availability attribute for the
non-NDK clients (i.e. when not processed by versioner).

Bug: 163288375
Bug: 134795810
Test: m
Change-Id: I6eb2bce2bc2770cbfd69815e6816b6f25b3d6127
2021-01-15 10:40:47 +09:00
Elliott Hughes
43978a0a34 Fix things so that <features.h> can be used from assembler again.
Bug: https://github.com/android/ndk/issues/1422
Test: builds
Change-Id: I1b94ffe688f3d420533074c94f7ffed606ca923f
2021-01-07 17:32:39 -08:00
Dan Albert
d8f46916b6 Add api-level.h to dac, improve docs.
We don't list most of bionic on dac since it would be overwhelming for
the current layout, but this file in particular seems useful,
especially __ANDROID_API__. Unfortunately, c2devsite doesn't include
macro documentation. Until then, it's still useful to include the
functions defined in this header.

I've also elaborated a bit in the __ANDROID_API__ documentation, since
the existing phrasing led to confusion over whether it was closer to
minSdkVersion or compileSdkVersion. In practice these are identical
for the NDK, but if we switch to weakly-linked APIs via the
availability attribute that would change.

Test: built docs, looked at them
Bug: None
Change-Id: I5cf78a6143b5c15790c369bdf888611e4c1189db
2020-08-11 13:50:04 -07:00
Dan Albert
2dbea434d1 Make swab(3) inline prior to API 28.
Test: make checkbuild
Bug: https://stackoverflow.com/q/54392471/632035
Change-Id: Iaeb55231ea2395d7e1e31be63034f5db19025060
2020-08-07 13:10:51 -07:00
Elliott Hughes
cf346532fc More cleanup for #inclusivefixit.
Found manually with grep, since the script seems to miss stuff.

Test: treehugger
Change-Id: I5933cbade9792801d4a0bec1ccb077efa6ad8fbc
2020-07-31 10:35:03 -07:00
Dan Albert
14dcbf89ce Add API constant for S.
Test: treehugger
Bug: http://b/152037166
Change-Id: I9039377e80574cd59e13726a12072fe3002df67d
2020-04-09 12:38:53 -07:00
Elliott Hughes
4a6899ce0c Add ffsl(3), ffsll(3).
POSIX added these GNU extensions for issue 8.

I've made these always inline without the usual "until API level X"
proviso because they're single instructions that the compiler can inline
and there's really no point providing these if they add function call
overhead --- everyone should just use __builtin_ffs() and friends
instead in that case.

Bug: https://austingroupbugs.net/view.php?id=617
Test: treehugger
Change-Id: I33fc4b8648ea25917329e81c1b4c60eb9a66d667
2020-03-26 11:43:05 -07:00
Elliott Hughes
5ac438e5da Clean up mips references in the headers.
Test: treehugger
Change-Id: I1997af980b9e46c7c530f9e6cb1aa407b2d63d76
2020-02-13 18:00:16 -08:00
Elliott Hughes
44c01c77d3 Clean up the math headers.
I had hoped that this would then let us remove more of the "introduced
in" annotations, but it looks like that's not really going to happen
until the NDK's minimum supported API is 21.

Also remove a .c file that wasn't referenced anywhere.

Test: treehugger
Change-Id: I8b4a61c082293f8445195a4fa5ee30595d70444e
2020-02-11 08:46:29 -08:00
Elliott Hughes
5f1165c66f versioner: don't require mips headers.
If we remove the mips uapi headers, versioner fails because it assumes
they're available. We'll need a new versioner prebuilt beforre we can
remove the libc/versioner-dependencies/mips* symlinks.

Test: treehugger
Change-Id: Ife6df0cb57938f806a31ec334d648df9694c3d17
2020-01-30 14:35:01 -08:00