Commit graph

39002 commits

Author SHA1 Message Date
Treehugger Robot
a43db276fd Merge "Remove __INTRODUCED_IN_NO_GUARD_FOR_NDK(21)." am: 833ad6ee51
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2631630

Change-Id: Iba731871b587a6d60c17413e548a7be6c29c4d48
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-21 16:48:18 +00:00
Treehugger Robot
833ad6ee51 Merge "Remove __INTRODUCED_IN_NO_GUARD_FOR_NDK(21)." 2023-06-21 16:14:59 +00:00
Elliott Hughes
2bdeff449b Remove __INTRODUCED_IN_NO_GUARD_FOR_NDK(21).
There are still some instances of
`__INTRODUCED_IN_NO_GUARD_FOR_NDK(26)` which we can get rid of after the
libc++ update, but we can get rid of the API level 21 instances right
now, since the NDK no longer supports older API levels anyway.

Test: treehugger
Change-Id: I243957f15b68d3d89ec8e15e2aefc45e8c294c31
2023-06-20 14:32:58 -07:00
Elliott Hughes
7fc60f8d93 Merge "Remove the always-true __INTRODUCED_IN() annotations." am: fee0b45480
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2627536

Change-Id: I68ab2f603c1d0a8fab9b145d8cdbc653eaed5f5e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-20 21:13:09 +00:00
Christopher Ferris
29bedad140 Merge "Add new mallopt M_LOG_STATS." am: 90e2827762
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2585453

Change-Id: I86bd0363a9cc43bb6b0de32b95e1b68945c1d212
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-20 21:12:47 +00:00
Elliott Hughes
fee0b45480 Merge "Remove the always-true __INTRODUCED_IN() annotations." 2023-06-20 20:47:49 +00:00
Christopher Ferris
90e2827762 Merge "Add new mallopt M_LOG_STATS." 2023-06-20 20:35:53 +00:00
Elliott Hughes
fbca3365f9 Merge "<arpa/nameser.h>: rationalize __INTRODUCED_IN." am: e405c90f19
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2626138

Change-Id: Iabe705fb4061ab87b0b461d8741d32bc668a5c4e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-20 17:10:08 +00:00
Elliott Hughes
1e0a7c3690 Merge "_FILE_OFFSET_BITS is spelled with one underscore." am: 0749b7bcbf
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2627534

Change-Id: I40bd2bffa6d919eb19662af9c5cb3701d8b27c0d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-20 17:09:54 +00:00
Colin Cross
2c071df366 Merge "Remove symbols that don't exist in musl from linker benchmark" am: 0ba161b6af
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2626244

Change-Id: I053db17121ae35c64694abab7b95b4837442ae7c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-20 17:09:23 +00:00
Elliott Hughes
e405c90f19 Merge "<arpa/nameser.h>: rationalize __INTRODUCED_IN." 2023-06-20 16:56:13 +00:00
Elliott Hughes
0749b7bcbf Merge "_FILE_OFFSET_BITS is spelled with one underscore." 2023-06-20 16:55:24 +00:00
Colin Cross
0ba161b6af Merge "Remove symbols that don't exist in musl from linker benchmark" 2023-06-20 16:28:05 +00:00
Christopher Ferris
e9a7b81d4a Add new mallopt M_LOG_STATS.
This new mallopt cause statistics of the allocator to be printed in
the log.

Add a stats print for jemalloc.

This is designed to be used as part of a dumpsys meminfo --XXXX
option so that it's easier to get information about apps that
have an unusual memory footprint.

Test: Unit tests pass.
Test: Ran on a device using jemalloc and verified log data.
Test: Ran on a device using scudo and verified log data.
Change-Id: I6fa44ce619c064b2596fbbb478c231994af94f4c
2023-06-17 00:00:02 +00:00
Elliott Hughes
9dbfe8bb69 <arpa/nameser.h>: rationalize __INTRODUCED_IN.
Investigation shows that the symbols that claimed to have been in 32-bit
builds one API level earlier than in 64-bit builds actually weren't ---
everything was actually API level 22. This patch fixes the libc.map.txt
to match reality, and then simplifies the __INTRODUCED_IN()
incantations.

Investigation also shows that we have a bunch of unused #defines, so
this patch removes the ones that don't correspond to functions we
actually expose.

Test: treehugger
Change-Id: I540dd0d1d9561cac17c55eb68a07bed58dd718fa
2023-06-16 15:59:52 -07: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
Elliott Hughes
836e81d019 _FILE_OFFSET_BITS is spelled with one underscore.
Test: treehugger
Change-Id: Ic21082ffa1083b63a95514dcd7f2d9e23f84c9b0
2023-06-16 11:55:07 -07:00
Elliott Hughes
472f1d099e Merge "Expose tzalloc()/localtime_rz()/mktime_z()/tzfree()." am: f5cd29269f
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2626240

Change-Id: I91ec19b2e2acad7328059bf60c5f25b53bf6d614
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-16 16:09:25 +00:00
Elliott Hughes
f5cd29269f Merge "Expose tzalloc()/localtime_rz()/mktime_z()/tzfree()." 2023-06-16 15:14:24 +00:00
Elliott Hughes
2bd4316bd6 Expose tzalloc()/localtime_rz()/mktime_z()/tzfree().
* Rationale

The question often comes up of how to use multiple time zones in C code.
If you're single-threaded, you can just use setenv() to manipulate $TZ.
toybox does this, for example. But that's not thread-safe in two
distinct ways: firstly, getenv() is not thread-safe with respect to
modifications to the environment (and between the way putenv() is
specified and the existence of environ, it's not obvious how to fully
fix that), and secondly the _caller_ needs to ensure that no other
threads are using tzset() or any function that behaves "as if" tzset()
was called (which is neither easy to determine nor easy to ensure).

This isn't a bigger problem because most of the time the right answer
is to stop pretending that libc is at all suitable for any i18n, and
switch to icu4c instead. (The NDK icu4c headers do not include ucal_*,
so this is not a realistic option for most applications.)

But what if you're somewhere in between? Like the rust chrono library,
for example? What then?

Currently their "least worst" option is to reinvent the entire wheel and
read our tzdata files. Which isn't a great solution for anyone, for
obvious maintainability reasons.

So it's probably time we broke the catch-22 here and joined NetBSD in
offering a less broken API than standard C has for the last 40 years.
Sure, any would-be caller will have to have a separate "is this
Android?" and even "is this API level >= 35?" path, but that will fix
itself sometime in the 2030s when developers can just assume "yes, it
is", whereas if we keep putting off exposing anything, this problem
never gets solved.

(No-one's bothered to try to implement the std::chrono::time_zone
functionality in libc++ yet, but they'll face a similar problem if/when
they do.)

* Implementation

The good news is that tzcode already implements these functions, so
there's relatively little here.

I've chosen not to expose `struct state` because `struct __timezone_t`
makes for clearer error messages, given that compiler diagnostics will
show the underlying type name (`struct __timezone_t*`) rather than the
typedef name (`timezone_t`) that's used in calling code.

I've moved us over to FreeBSD's wcsftime() rather than keep the OpenBSD
one building --- I've long wanted to only have one implementation here,
and FreeBSD is already doing the "convert back and forth, calling the
non-wide function in the middle" dance that I'd hoped to get round to
doing myself someday. This should mean that our strftime() and
wcsftime() behaviors can't easily diverge in future, plus macOS/iOS are
mostly FreeBSD, so any bugs will likely be interoperable with the other
major mobile operating system, so there's something nice for everyone
there!

The FreeBSD wcsftime() implementation includes a wcsftime_l()
implementation, so that's one stub we can remove. The flip side of that
is that it uses mbsrtowcs_l() and wcsrtombs_l() which we didn't
previously have. So expose those as aliases of mbsrtowcs() and
wcsrtombs().

Bug: https://github.com/chronotope/chrono/issues/499
Test: treehugger
Change-Id: Iee1b9d763ead15eef3d2c33666b3403b68940c3c
2023-06-16 08:10:47 -07:00
Dimitry Ivanov
344ab813b3 Merge "Use more appropriate param type for __early_abort" am: 81d1e3df44
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2627970

Change-Id: Ie9653e539b6be663e9e805f3cdb85b47ed04787f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-16 10:29:45 +00:00
Dimitry Ivanov
81d1e3df44 Merge "Use more appropriate param type for __early_abort" 2023-06-16 09:53:00 +00:00
Colin Cross
61c0dcec9b Remove symbols that don't exist in musl from linker benchmark
The lseek64, lstat64, pread64 and pwrite64 symbols have been removed
from musl 1.2.4.

Bug: 286415000
Test: builds
Change-Id: Icba9e92e1ccbb5b52d6c60e554ab411c9e5c1954
2023-06-15 22:02:10 -07:00
Treehugger Robot
3960b11233 Merge "Nullability check for socket module." am: 0181dd9f05
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2605708

Change-Id: I2f88520dbbfac04a0e50d78c9e590c894e827b62
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-16 03:33:11 +00:00
Treehugger Robot
0181dd9f05 Merge "Nullability check for socket module." 2023-06-16 02:37:38 +00:00
zijunzhao
4e274fa0a9 Nullability check for socket module.
Bugs: b/245972273
Test: adb shell
Change-Id: Id0f1aa156ff010358f2484b2f58aa3beacc1409c
2023-06-15 23:51:02 +00:00
dimitry
e07704aa6e Use more appropriate param type for __early_abort
Test: build, start emulator
Change-Id: I5f31ceb9a85ee7750f17edff76782c778a4515d8
2023-06-15 14:40:42 +00:00
Treehugger Robot
957f7a1203 Merge "Nullability check for wctype module." am: 5c6961ff6d
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2626775

Change-Id: I3c1b5b1fed8a5caddb3a5967374beb4f8a243f78
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-15 01:42:42 +00:00
Treehugger Robot
5c6961ff6d Merge "Nullability check for wctype module." 2023-06-15 00:29:25 +00:00
Treehugger Robot
5e6c6e6e0f Merge "<iconv.h>: clarify the docs a bit more." am: 42e7ac10ed
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2627204

Change-Id: Ibdf7840ef0d1399a7ab451fff4dfeef3325880c6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-14 23:26:29 +00:00
Elliott Hughes
4653bfa75e Merge "<arpa/nameser.h>: don't use __INTRODUCED_IN_64 in a defined(__LP64__) block." am: db14a74701
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2621717

Change-Id: Iec3363dd37b032209867837b151947efbbaac2ce
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-14 23:26:19 +00:00
Zijun Zhao
6eb5edccdd Merge "Nullability check for modules in /platform directory." am: a872000550
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2623060

Change-Id: I5a7b724b6269aafba9a1aecc03f2199bf4b58510
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-14 23:25:07 +00:00
Treehugger Robot
42e7ac10ed Merge "<iconv.h>: clarify the docs a bit more." 2023-06-14 23:16:06 +00:00
Elliott Hughes
db14a74701 Merge "<arpa/nameser.h>: don't use __INTRODUCED_IN_64 in a defined(__LP64__) block." 2023-06-14 22:39:55 +00:00
Zijun Zhao
a872000550 Merge "Nullability check for modules in /platform directory." 2023-06-14 22:28:41 +00:00
zijunzhao
f0fb41851b Nullability check for modules in /platform directory.
Bugs: b/245972273
Test: adb shell
Change-Id: Iaefd0231de760455b24fb09aada0144a84379689
2023-06-14 22:27:49 +00:00
zijunzhao
1ee9fb5002 Nullability check for wctype module.
Bugs: b/245972273
Test: adb shell
Change-Id: I0f10db338876eb93a89be35130b097ebe19d2c15
2023-06-14 21:54:35 +00:00
Treehugger Robot
2a08cfbb73 Merge "Implement C23 scanf 'wf' length modifiers" am: 6ab3be5f03
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2623058

Change-Id: I55a7196fe41b719a316b85b0147df646f83ced72
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-14 21:33:17 +00:00
Elliott Hughes
bac2573c87 <iconv.h>: clarify the docs a bit more.
Bug: https://github.com/android/ndk/issues/1895
Test: N/A
Change-Id: I68542e3b4d98ec5ae0e0ed1d199c2b4b23e98f6d
2023-06-14 20:55:58 +00:00
Treehugger Robot
6ab3be5f03 Merge "Implement C23 scanf 'wf' length modifiers" 2023-06-14 20:53:08 +00:00
zijunzhao
cc475cf28d Implement C23 scanf 'wf' length modifiers
wfN: Specifies that a following b, d, i, o, u, x, or X conversion specifier applies to a fastest minimum-width integer argument with a specific width where N is a positive decimal integer with no leading zeros (the argument will have been promoted according to the integer promotions, but its value shall be converted to the unpromoted type); or that a following n conversion specifier applies to a pointer to a fastest minimum-width integer type argument with a width of N bits. All fastest minimum-width integer types (7.22.1.3) defined in the header <stdint.h> shall be supported. Other supported values of N are implementation-defined.

Bug: b/271903607
Test: adb shell
Change-Id: Iaa1f6d87251144de0b763672ca93f23272880ad1
2023-06-14 17:15:58 +00:00
Treehugger Robot
fe05401ae1 Merge "Nullability check for socket module." am: 6045af2931
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2623713

Change-Id: I0e2ca12bd314f3dd1242359da8f1cdb7aaf6ed95
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-14 01:44:17 +00:00
Treehugger Robot
6045af2931 Merge "Nullability check for socket module." 2023-06-14 01:02:53 +00:00
zijunzhao
1e28d06667 Nullability check for socket module.
Bugs: b/245972273
Test: adb shell
Change-Id: I7b6b00705ad7476fabf30727347555eeafff6eda
2023-06-13 21:15:34 +00:00
Treehugger Robot
dbe4f8309d Merge "<complex.h>: stop using __INTRODUCED_IN_(32|64)." am: cf2090b962
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2621721

Change-Id: Ifa39613bf6be75d217cd09d2a6f4f27333199ecb
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-13 21:14:55 +00:00
Elliott Hughes
891e3b0aa8 Merge "Remove PAGE_SIZE call sites." am: 826ea44822
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2083840

Change-Id: Icdb62f86f428ee3d387e937c41652f58bad0fa09
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-13 21:14:19 +00:00
Treehugger Robot
cf2090b962 Merge "<complex.h>: stop using __INTRODUCED_IN_(32|64)." 2023-06-13 21:05:29 +00:00
Elliott Hughes
826ea44822 Merge "Remove PAGE_SIZE call sites." 2023-06-13 20:36:45 +00:00
Zijun Zhao
6a687a136c Merge "Fix iconv_open(3) docs." am: 0594346633
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2624749

Change-Id: I5e22ad8e685bd4c023b679ac29e11043b147a3db
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-13 18:05:54 +00:00
Zijun Zhao
0594346633 Merge "Fix iconv_open(3) docs." 2023-06-13 17:20:41 +00:00