Commit graph

39082 commits

Author SHA1 Message Date
Colin Cross
9da60c4bce Merge "Remove symbols that don't exist in musl from linker benchmark" am: 0ba161b6af am: 2c071df366
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2626244

Change-Id: Idd6a098733e0ec8bdc357d141f534b91ba1dcdba
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-20 17:52:10 +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
Colin Cross
0ba161b6af Merge "Remove symbols that don't exist in musl from linker benchmark" 2023-06-20 16:28:05 +00:00
Elliott Hughes
ecb17c8cf4 Merge "Expose tzalloc()/localtime_rz()/mktime_z()/tzfree()." am: f5cd29269f am: 472f1d099e
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2626240

Change-Id: Ic74d7c1db0807eae3bafaca6bcd38974f148b9fb
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-16 16:50:22 +00: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
f11be221ad Merge "Use more appropriate param type for __early_abort" am: 81d1e3df44 am: 344ab813b3
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2627970

Change-Id: Ie07ed2ed5cab1a37f67cf7e3166cd1ff1c1d3b2a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-16 11:11:16 +00: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
f0ff731e8b Merge "Nullability check for socket module." am: 0181dd9f05 am: 3960b11233
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2605708

Change-Id: I04aa1fc5015dda715f705eb519af2f6fee5d60fd
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-16 04:15:11 +00: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
4cb0d63209 Merge "Nullability check for wctype module." am: 5c6961ff6d am: 957f7a1203
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2626775

Change-Id: I7415380dbb5db1e9c093002dc9de5b628db06123
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-15 02:24:33 +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
1174fd0360 Merge "<iconv.h>: clarify the docs a bit more." am: 42e7ac10ed am: 5e6c6e6e0f
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2627204

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

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

Change-Id: I87ba9d310f559fbedee3a9996371631029a918c5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-15 00:09:22 +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
Treehugger Robot
4a4fb53b3b Merge "Implement C23 scanf 'wf' length modifiers" am: 6ab3be5f03 am: 2a08cfbb73
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2623058

Change-Id: I7699a16f840814957c3910efd1de09ccebcc1f9b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-14 22:15:54 +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
a144dce88d Merge "Nullability check for socket module." am: 6045af2931 am: fe05401ae1
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2623713

Change-Id: I0f7a25d359e597f070a77f4c81f874b3f1818909
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-14 02:30:22 +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
Treehugger Robot
dd7a737a39 Merge "<complex.h>: stop using __INTRODUCED_IN_(32|64)." am: cf2090b962 am: dbe4f8309d
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2621721

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

Change-Id: I14d8ca6a7d4f9b3aeac0190232e9b6dd00b3d35d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-13 21:54:23 +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
ff0601d40d Merge "Fix iconv_open(3) docs." am: 0594346633 am: 6a687a136c
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2624749

Change-Id: I4809f9224b281fd7963ed9dc23724bd8fca085a9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-13 18:50:06 +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
Elliott Hughes
7a5d9925b7 Fix iconv_open(3) docs.
Strictly the _doc comment_ is correct, but the names of the parameters
are the wrong way round. (Although iconv_open() follows the usual C
tradition of "destination first", iconv() itself doesn't, so these
functions are inherently confused/confusing.)

Bug: https://github.com/android/ndk/issues/1895
Test: N/A
Change-Id: Iafc9bd630ece1d3c55986b04bb9a99c477716530
2023-06-13 07:38:02 -07:00
Zijun Zhao
d75e140c6d Merge "Nullability check for string modules." am: 71a03774d5 am: e59cd02ed0
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2618675

Change-Id: Ia430ce25823a55bf282e030b9c7099f416fb0815
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-12 18:32:01 +00:00