Commit graph

89 commits

Author SHA1 Message Date
Elliott Hughes
046fe15fb5 Explicitly mention bionic's single C.UTF-8 locale.
Test: treehugger
Change-Id: Iea45c0211d3476579f9778dfc7a0111f2e54a983
2022-12-02 20:15:42 +00:00
Elliott Hughes
82be76b5a2 Add __freadahead.
At the time I added <stdio_ext.h>, I just added what was on the man
page (which matched glibc), not realizing that musl and glibc had
slightly different functionality in their headers.

The toybox maintainer came up with a legitimate use case for this, for
which there is no portable workaround, so I'm adding it here. I'm not
adding the other functions that are in musl but not glibc for lack of a
motivating use case.

Bug: http://lists.landley.net/htdig.cgi/toybox-landley.net/2022-April/020864.html
Test: treehugger
Change-Id: I073baa86ff0271064d4e2f20a584d38787ead6b0
2022-09-22 23:47:42 +00:00
Elliott Hughes
f9fac36f15 Merge "Add C23's memset_explicit()." 2022-08-11 22:01:28 +00:00
Elliott Hughes
1f462dec34 Add %b and %B support to the scanf/wscanf and strto*/wcsto* families.
Coming to C23 via WG14 N2630.

This one is a little interesting, because it actually changes existing
behavior. Previously "0b101" would be parsed as "0", "b", "101" by these
functions. I'm led to believe that glibc plans to actually have separate
versions of these functions for C23 and pre-C23, so callers can have the
behavior they (implicitly) specify by virtue of which -std= they compile
with. Android has never really done anything like that, and I'm pretty
sure app developers have more than enough to worry about with API levels
without having to deal with the cartesian product of API level and C
standard.

Therefore, my plan A is "if you're running on Android >= U, you get C23
behavior". My plan B in the (I think unlikely) event that that actually
causes trouble for anyone is "if you're _targeting_ Android >= U, you
get C23 behavior". I don't think we'd actually want to have two versions
of each of these functions under any circumstances --- that seems by far
the most confusing option.

Test: treehugger
Change-Id: I0bbb30315d3fabd306905ad1484361f5d8745935
2022-08-11 00:25:08 +00:00
Elliott Hughes
0d64243407 Add C23's memset_explicit().
https://open-std.org/jtc1/sc22/wg14/www/docs/n2897.htm

Test: treehugger
Change-Id: Ia0cfc72bdf3c22eda6a4fc9adaa4c0ca0ff9a7c8
2022-08-10 23:36:16 +00:00
Elliott Hughes
b813a6a6be Add %b and %B support to the printf/wprintf family.
Coming to C23 via WG14 N2630, and already in glibc.

We're still missing clang support for %b and %B in format string checking,
but it's probably easier to fix this first. (Apparently GCC already has
support because of glibc.)

Test: treehugger
Change-Id: Ie8bfe4630d00c50e1d047d6756a7f799205356db
2022-08-01 22:18:40 +00:00
Elliott Hughes
a39ac04033 Document another obsolete POSIX function.
ualarm(3) was removed from POSIX in 2008, but somehow wasn't included in
the list of such functions (perhaps because it's not inherently useless
like a lot of the other stuff is; it just has a better replacement).

Test: N/A
Change-Id: I0347d3e7f1357bc2acb870f74e9084872c28ca3e
2022-06-14 17:23:35 -07:00
George Burgess IV
3b51605a79 docs: add a clang_fortify_anatomy doc
This is mostly copy-pasted from go/clang-fortify-anatomy. Since it
offers extensive documentation on how FORTIFY works in Bionic, having it
also live within Bionic seems quite helpful.

Bug: 235150687
Fixes: 235150687
Test: None
Change-Id: I20145a5ba3155b1c7b3977f9b688320a7fda4ea2
2022-06-07 13:28:51 -07:00
Elliott Hughes
02335c7738 T is API level 33, not 32.
The actual constant was fixed, but the docs weren't.

Test: treehugger
Change-Id: Id76d38cd8b17be02ddece8bbb2695f5d172fee9b
2022-02-16 14:41:09 -08:00
Elliott Hughes
57f17dea20 Update the status for S and T.
Test: treehugger
Change-Id: I21c4374d7e55dbbb2294cef5cc7bf50b7fe1b549
2022-01-14 16:26:25 -08:00
Elliott Hughes
a73179fe30 Merge "Add some documentation about EINTR." 2021-12-14 00:25:54 +00:00
Elliott Hughes
38be11e88c Add some documentation about EINTR.
It's a common cause of confusion, and even a brief explanation can be
quite involved, so it's worth having something we can point to (and
something that interested parties might just find via a web search).

Bug: http://b/207248554
Test: treehugger
Change-Id: I4a6d8917baf99a8f7abef05ce852a31ebe048d68
2021-12-13 10:16:57 -08:00
Elliott Hughes
32a72522e0 Clarify that fdsan wasn't "enforcing" in its first release.
Change-Id: I02c4ff49446995b5ea33f4fa9ca30cf204307ae8
2021-12-10 01:42:31 +00:00
Elliott Hughes
977867173a Say which API level fdsan/fdtrack appeared at.
Test: N/A
Change-Id: Id29db9a5ec6a039af95ce3cdd421542ac862f339
2021-04-16 13:57:52 -07:00
Peter Collingbourne
7bdca8d16f Fix the adb command to push the memory trace files.
Change-Id: If49d084486486c7899d7655175860f7528aac6ce
2021-04-09 15:11:49 -07:00
Elliott Hughes
aa8db1b9d1 Fix/update notices.
Auto-generate NOTICE files for all the directories, and for each one
individually rather than mixing libc and libm together.

Test: N/A
Change-Id: I7e251194a8805c4ca78fcc5675c3321bcd5abf0a
2021-02-16 15:06:50 -08:00
Josh Gao
12a0eb6c6d Add fdtrack docs.
Test: none
Change-Id: I035be350cfd40cdbff1e95332f96841001922454
2020-08-31 19:12:46 -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
Elliott Hughes
1cd4d4227a Expand a little on the time_t situation.
Since we last touched this file, the Linux kernel has added the missing
API, but time has also moved on enough to make the cost/benefit
unconvincing for Android.

Bug: http://b/156317457
Test: treehugger
Change-Id: I07fa678458ef10d15540b36ab65e0898d2fdadc6
2020-05-19 12:41:25 -07:00
Elliott Hughes
733cedd1c4 Add a libc wrapper for statx(2).
Bug: http://b/127675384
Bug: http://b/146676114
Test: treehugger
Change-Id: I844edc12f62717e579870a040cf03dfe60dc280b
2020-02-23 11:36:53 -08:00
Elliott Hughes
56a9fda610 Remove dead code.
We haven't built any of this for years.

Test: treehugger
Change-Id: I3f8a85e9530af68587f47931d850eb60631a9481
2020-02-13 22:25:02 -08:00
Elliott Hughes
9c381b046f docs/status.md: link to github.
We've had discussions about <monetary.h> (which wasn't previously
mentioned here at all, an oversight) and robust mutexes on github that
are worth linking to.

Bug: https://github.com/android/ndk/issues/1181
Bug: https://github.com/android/ndk/issues/1182
Test: N/A
Change-Id: If0d2c28757a3cbfffc358e8847dc4de1a67d9001
2020-02-05 16:04:57 -08:00
Elliott Hughes
b5a7741bb3 Mention why we don't have pthread_cancel().
It's a somewhat frequently asked question.

Change-Id: I2ad88e8d79607e49a891eb2304e9be63494ad193
2020-01-22 15:10:52 -08:00
Elliott Hughes
91e3bd1f33 Document the changed fdsan default from Q to R.
Change-Id: I98c50232184a8bf929579a7a30460dc33555475e
2020-01-16 15:23:58 -08:00
Christopher Ferris
5a3c920051 Add mallopt M_PURGE benchmark.
Update the native allocator documentation to include running of this
benchmark.

Move the malloc_benchmark.cpp to malloc_sql_benchmark.cpp and use
malloc_benchmark.cpp for benchmarking functions from malloc.h.

Bug: 137795072

Test: Ran new benchmark.
Change-Id: I76856de833032da324ad0bc0b6bd85a4ea8c253d
2019-12-05 15:46:22 -08:00
Christopher Ferris
75edf16f4d Update the native allocator document.
Add extra information I've been using to evaluate scudo.

Test: NA
Change-Id: Ie7ee65890b1a3804c38ba38de504144d43e410b2
2019-11-13 14:00:56 -08:00
Elliott Hughes
502dc0b9c3 Update docs/status.md function counts for recent releases.
Test: N/A
Change-Id: I99b7227334d0858f19ec7544a255fe47f265d810
2019-11-12 21:06:07 -08:00
Christopher Ferris
51863b3671 Add section about libmemunreachable tests.
Test: NA
Change-Id: I0dcb8bbb7a598c44201281c7d493023e7d25c153
2019-10-25 15:27:12 -07:00
Christopher Ferris
2f5fc3372a Updated memory_replay description.
The description of memory_replay talks about unzippping the trace
files, but this is no longer necessary. This language has been
updated to reflect this.

Test: NA
Change-Id: Id808f9bd1286284c8de12b19c08eb8677c76dd53
2019-10-17 15:20:55 -07:00
Elliott Hughes
80e9f65c04 Remove __ANDROID_NDK__ from bionic, and document our #defines.
__ANDROID_NDK__ is moving into the NDK's <android/ndk-version.h>
instead.

Test: treehugger
Change-Id: I192016165a929547009d15dbcc30e8f6dad1ac88
2019-10-15 13:30:12 -07:00
Treehugger Robot
5f112cd756 Merge "Link our two main developer-facing docs together." 2019-08-16 02:08:22 +00:00
Elliott Hughes
8f3f191bf3 Link our two main developer-facing docs together.
Bug: http://b/139329827
Test: N/A
Change-Id: I38e05f1a7eaa8ff31b503541e34f2e362cd4722e
2019-08-15 08:19:49 -07:00
Christopher Ferris
aa22c0cb0c Update location of trace files.
Test: NA
Change-Id: I27f98b84b7701b8747d22dbdfbfa074083c36bc1
2019-08-14 15:17:26 -07:00
Christopher Ferris
05197f7d03 Change all references to PSS to RSS.
RSS is the real measurement by which an allocator should be measured
since RSS is the real memory consumed by the process. PSS is a shared
value.

For memory_replay, PSS and RSS should be the same, so this didn't really
matter in practice, but it's better to use the correct name of RSS.

Also, add a small section about fragmentation.

Bug: 138394907

Test: NA
Change-Id: Ic6f982f9c4619f452342e7c105818e33b8b85e44
2019-08-07 15:34:11 -07:00
Elliott Hughes
da32ff104b Merge "Add memfd_create(2) and mlock2(2)." 2019-08-06 17:08:13 +00:00
Elliott Hughes
3d24d2b088 Add memfd_create(2) and mlock2(2).
These are old enough now that the latest devices will have kernels that
support them.

Also add basic doc comments to <sys/mman.h>.

Test: treehugger
Change-Id: I1b5ff5db0b6270f5c374287cac1d6a751a0259f5
2019-08-05 16:31:08 -07:00
Tom Cherry
f0d9271fe2 Update docs for clockwait/clocklock functions
Test: n/a
Change-Id: Ie4853912c9ed63d29121e62406682896012962ec
2019-08-05 14:13:25 -07:00
Elliott Hughes
05b675e8bf Add renameat2.
Bug: http://b/127675384
Test: new tests
Change-Id: Ia2e3d5679180391ca98e62fa429fa11cbf167507
2019-08-02 09:09:59 -07:00
Christopher Ferris
afce4e897f Merge "Add doc describing native allocator." 2019-06-28 19:55:31 +00:00
Christopher Ferris
4316d43f4d Add doc describing native allocator.
This includes tests that a native allocator has to pass, and the ways
to benchmark a native allocator on Android.

Test: NA
Change-Id: I5e1f4b3eea46ee2240e63a487ca3dfabecff81c0
2019-06-28 10:33:53 -07:00
Christopher Ferris
2671de2896 Fix usage of () and [].
The usage was reversed, [] is used for the name and () is used for the
link destination.

Test: NA
Change-Id: I07bf8645a888d5690d6c3d58edc3899b3e287df4
2019-06-27 20:42:38 -07:00
Elliott Hughes
4206711352 threads.h: Add C11 thread support.
FreeBSD, glibc, and musl have all implemented C11 threads at this
point. POSIX is looking at how to align with it. Probably time to jump
on the bandwagon ourselves...

Implemented in the same style as <termios.h> so we can provide this
functionality even on older API levels. This does mean that this is
strictly more expensive than calling pthread functions directly.

Although this isn't in POSIX yet, assume that it's going to be basically
the same as C11 and add the header test anyway. We should revisit this
when POSIX actually adds <threads.h>.

Test: new tests
Change-Id: I8602d67ce71ca7f8ed1529daa0a8ea1feb083dd6
2019-04-24 09:12:29 -07:00
Elliott Hughes
a1fb15bb67 strptime: support everything that strftime supports.
Our strptime was missing `%F`, `%G`, `%g`, `%P`, `%u`, `%V`, and
`%v`. Most of these are already supported upstream (and I've just pulled
their current implementation), but some aren't. We're horribly out of
sync anyway, so I'll upstream the missing pieces and then try to get us
back in sync later.

Test: new tests, but originally found by toybox trying to use %F
Change-Id: Ib1a10801a7a3b9c9189440c3b300109bde535fd9
2019-03-26 19:07:40 -07:00
Elliott Hughes
b282a6d4d3 Document various libc behavior changes.
Test: N/A
Change-Id: I3044c394180058ba500762239b16a4c740caca44
2019-03-20 11:23:53 -07:00
Christopher Ferris
a22f5d5175 Make aligned_alloc match the standard.
Jemalloc does not verify that the size parameter is a multiple of
alignment. Fix this since it only went into P.

Fix the unit tests, and fix malloc debug/malloc hooks to handle this
new restrictive behavior.

Bug: 126944692

Test: Ran bionic unit tests.
Test: Ran bionic unit tests with malloc hooks enabled (no new tests fail).
Test: Ran bionic unit tests with malloc debug enabled (no new tests fail).
Test: Ran malloc debug unit tests.
Change-Id: I4d50785928815679c781ca729f998454d76b9192
2019-03-01 23:56:23 -08:00
Ryan Prichard
9491c54619 Publish the current draft of my ELF TLS doc
I have a script that converts the internal Google Doc to this markdown
file.

Bug: http://b/78026329
Test: review document
Change-Id: I16cfa60f1e480f859eb79cb0e5f0c519f5622cfd
2018-11-09 15:24:16 -08:00
Elliott Hughes
2d0b28bc0d Add getloadavg(3).
Lets us build ninja with bionic.

Bug: N/A
Test: ran tests
Change-Id: I97eef1247d794b58a2b9aee4851551632e5a4e48
2018-10-23 11:23:00 -07:00
Elliott Hughes
b177085ce7 Add reallocarray(3).
Originally a BSD extension, now in glibc too. We've used it internally
for a while.

(cherry-pick of e4b13f7e3ca68edfcc5faedc5e7d4e13c4e8edb9.)

Bug: http://b/112163459
Test: ran tests
Change-Id: I813c3a62b13ddb91ba41e32a5a853d09207ea6bc
Merged-In: I813c3a62b13ddb91ba41e32a5a853d09207ea6bc
2018-09-26 14:24:18 -07:00
Josh Gao
ce9d653b38 Merge changes from topics "fdsan_ziparchive_type", "fdsan_java_socket"
* changes:
  fdsan: improve documentation.
  fdsan: add type for libziparchive's ZipArchive.
  fdsan: add types for Java sockets.
2018-09-20 19:22:03 +00:00
Josh Gao
d747bb8f3f fdsan: improve documentation.
Fix a race condition in the example, and add a linearized version to
make it more clear what's going on.

Test: none
Change-Id: Id9158e4fd407b676ef364e7076985de3ad477457
2018-09-18 13:42:08 -07:00