summaryrefslogtreecommitdiffstats
path: root/libc/include
Commit message (Collapse)AuthorAgeFilesLines
* Remove __STDC_FORMAT_MACROS and __STDC_LIMIT_MACROS guards (and fix SIZE_MAX ↵Elliott Hughes2014-01-242-198/+119
| | | | | | | | | | for LP64). The various committees decided that everyone should get all these macros, all the time. Bug: 12708004 Change-Id: Ib56010dcba9b0656e5701546fefb7f78dc0bf916
* Add "__noreturn" to assert and assert2Vadim Markovtsev2014-01-151-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These functions should print assertion violation messages and then call abort(). They do really not return control flow afterwards. Consider the declaration of the similar __assert_fail from glibc: extern void __assert_fail (const char *__assertion, const char *__file, unsigned int __line, const char *__function) __THROW __attribute__ ((__noreturn__)); Bionic has __noreturn defined in sys/cdefs.h to be that GNU noreturn attribute. This patch has a practical value. Consider the following function: void check(void* ptr) { assert(ptr != NULL); } Without this patch applied, gcc (and presumably clang) shows even in debug mode: warning: unused parameter 'ptr' [-Wunused-parameter] In release mode, NDEBUG is defined and assert() becomes a no-op, as one should expect. Thus, the warning is shown correctly then. Another code sample: float array[2]; int i = 3; ... assert(i < 2); array[i] = 0; gcc says, warning: array subscript is below array bounds [-Warray-bounds] In other words, without noreturn attribute, assertions do not allow a compiler's static analyzer to properly understand the preconditions. Change-Id: I3be92e99787c528899cf243ed448c4730c00c45b Signed-off-by: Vadim Markovtsev <gmarkhor@gmail.com>
* Merge "Add some more headers."Elliott Hughes2014-01-104-0/+136
|\
| * Add some more headers.Elliott Hughes2014-01-104-0/+136
| | | | | | | | | | | | | | | | | | This patch adds trivial implementations of the missing sys headers needed by strace. All strace needs are the constants and structures, so this is enough for now. We can come back and add the functions if/when we ever need them. Change-Id: Idb87c1a8b6b1c62f6e16ae94f147e1169722b48e
* | Add extra libc stubs for mntent related functions.JP Abgrall2014-01-101-0/+4
|/ | | | | | This adds stubs for setmntent() and endmntent(). Change-Id: I6ccaa044145405cd7226c1c54a25d435c96a2308
* Merge "Add NT_PRSTATUS to <elf.h>."Elliott Hughes2014-01-091-0/+5
|\
| * Add NT_PRSTATUS to <elf.h>.Elliott Hughes2014-01-091-0/+5
| | | | | | | | | | | | | | Needed by aarch64. Bug: 12476126 Change-Id: I7764664459a06cf4f2a60e707bd968d321a78430
* | Merge "Add <sgidefs.h>."Elliott Hughes2014-01-091-0/+34
|\ \
| * | Add <sgidefs.h>.Elliott Hughes2014-01-091-0/+34
| |/ | | | | | | Change-Id: I543d502a81dcb8d5969f814b8a9a9c819bc4fa2c
* | Fix x86 user_regs_struct.Elliott Hughes2014-01-091-17/+17
|/ | | | | | I fixed x86-64 yesterday, but didn't fix x86 at the same time. Change-Id: I5c081f5956dfedb9389af303369b841dd0fc1953
* Add the glibc-compatible d_fileno.Elliott Hughes2014-01-091-0/+1
| | | | | | | d_ino is the POSIX name, but glibc also offers d_fileno, and that's what strace is using. Change-Id: I3fadbe7a64700b42e78c7f4631620e864d43147b
* Fix <sys/resource.h>.Elliott Hughes2014-01-091-12/+17
| | | | | | | | | | | | | | | | | | The situation here is a bit confusing. On 64-bit, rlimit and rlimit64 are the same, and so getrlimit/getrlimit64, setrlimit/setrlimit64, and prlimit/prlimit64 are all the same. On 32-bit, rlimit and rlimit64 are different. 32-bit architectures other than MIPS go one step further by having an even more limited getrlimit system call, so arm and x86 need to use ugetrlimit instead of getrlimit. Worse, the 32-bit architectures don't have 64-bit getrlimit- and setrlimit-equivalent system calls, and you have to use prlimit64 instead. There's no 32-bit prlimit system call, so there's no easy implementation of that --- what should we do if the result of prlimit64 won't fit in a struct rlimit? Since 32-bit survived without prlimit/prlimit64 for this long, I'm not going to bother implementing prlimit for 32-bit. We need the rlimit64 functions to be able to build strace 4.8 out of the box. Change-Id: I1903d913b23016a2fc3b9f452885ac730d71e001
* Merge "Our dirent is a dirent64."Elliott Hughes2014-01-091-23/+21
|\
| * Our dirent is a dirent64.Elliott Hughes2014-01-081-23/+21
| | | | | | | | Change-Id: Idc9ebfd900fddd4f7c7ac95bc9b74401ebc801a3
* | Add <sys/reg.h>.Elliott Hughes2014-01-081-0/+84
|/ | | | | | | This describes the offsets into ptrace's returned arrays of registers for x86 and x86-64. Change-Id: I044f03e286673999a298b73a813d4ad366625845
* Merge "Fix x86_64 register names in <sys/user.h>."Elliott Hughes2014-01-091-11/+11
|\
| * Fix x86_64 register names in <sys/user.h>.Elliott Hughes2014-01-081-11/+11
| | | | | | | | Change-Id: Ieb327247a41f6195589716170e324d1cd1251b96
* | We shouldn't have a <sys/dirent.h> that's a subset of <dirent.h>.Elliott Hughes2014-01-081-49/+0
|/ | | | | | | glibc has no <sys/dirent.h>. If we do have to bring this back, we should probably just have one file #include the other. Change-Id: I5c0bf9c03769daf3b23f69778e9f01f81c3de9ec
* Merge "<sched.h> should offer both __sched_priority and sched_priority."Elliott Hughes2014-01-081-1/+2
|\
| * <sched.h> should offer both __sched_priority and sched_priority.Elliott Hughes2014-01-071-1/+2
| | | | | | | | | | | | | | | | | | If glibc hadn't already done things this way round, I'd have called the field sched_priority and the macro __sched_priority since that would seem less likely to cause trouble, but glibc source compatibility is probably more important. Change-Id: I8a8a477f2aa87cae641069c5c84b4fcab3152a82
* | Merge "<fcntl.h> should get you the POSIX_FADV_* constants."Elliott Hughes2014-01-081-0/+1
|\ \
| * | <fcntl.h> should get you the POSIX_FADV_* constants.Elliott Hughes2014-01-071-0/+1
| |/ | | | | | | Change-Id: I9de8b840570b228308c12d72b7617b8758237fb8
* | Merge "Add SWAP_FLAG_* constants to <sys/swap.h>."Elliott Hughes2014-01-081-0/+5
|\ \
| * | Add SWAP_FLAG_* constants to <sys/swap.h>.Elliott Hughes2014-01-081-0/+5
| |/ | | | | | | Bug: 9336527 Change-Id: I679be4d8425ba177dd782e714f465caf9daa976c
* | Define fsid_t as well as __fsid_t.Elliott Hughes2014-01-071-3/+4
|/ | | | Change-Id: Ib8efbd913a0e6bfe27b88c1342bd5cec926dd74e
* Merge "Fix dev_t (for LP64)."Elliott Hughes2014-01-062-3/+10
|\
| * Fix dev_t (for LP64).Elliott Hughes2014-01-032-3/+10
| | | | | | | | | | | | | | | | 32-bit Android's dev_t was wrong too. We can't fix that without ABI breakage, but we can at least fix 64-bit Android. And add tests. Bug: https://code.google.com/p/android/issues/detail?id=54966 Change-Id: Ie2e42cc042b78b669a1a44e55f959dbd9c52c5c9
* | Add TCPOPT_* constants.Elliott Hughes2014-01-031-1/+16
|/ | | | | | | | | Adds the TCPOPT_* constants from NetBSD. Note that the BSDs also have TCPOPT_SIGNATURE, but Linux calls that TCPOPT_MD5SIG and glibc doesn't have any corresponding constant yet, so let's wait until we see which name wins out. Change-Id: If53cdada5595285d9a7e7248ef74cd7502d804c0
* Clean up <sched.h>.Elliott Hughes2014-01-022-36/+16
| | | | | | | | This patch switches to using the uapi constants. It also adds the missing setns system call, fixes sched_getcpu's error behavior, and fixes the gensyscalls script now ARM is uapi-only too. Change-Id: I8e16b1693d6d32cd9b8499e46b5d8b0a50bc4f1d
* Remove some old kernel header cruft not needed with uapi.Elliott Hughes2013-12-201-2/+0
| | | | Change-Id: If543b056ae40f0eb660be4a0629ad22f4c4cb92f
* Merge "Allow GCC-built fortified code to run on a clang-built bionic."Elliott Hughes2013-12-202-17/+18
|\
| * Allow GCC-built fortified code to run on a clang-built bionic.Elliott Hughes2013-12-192-17/+18
| | | | | | | | | | | | | | | | Even though code built with clang won't be fully fortified and won't contain calls to our various helpers, binaries built with GCC will. Change-Id: I389b2f1e22a3e89b22aadedc46397bf704f9ca79
* | Fix struct stat for aarch64.Elliott Hughes2013-12-191-82/+81
|/ | | | | | Another kernel, another struct stat. Change-Id: Ia5ee553d4a2ffc878d2fed82a763ff64c02b12e8
* Don't use __kernel_ulong_t.Elliott Hughes2013-12-181-6/+6
| | | | Change-Id: Ifdfbac0ac6da647276a84bd64bb342bb5a07ad61
* Remove <machine/kernel.h>.Elliott Hughes2013-12-181-41/+31
| | | | | Bug: 12175484 Change-Id: I127f7f91f36bd879109d653e0c56ec56e2529d4d
* Move bionic over to GCC's 'warning' attribute.Elliott Hughes2013-12-174-53/+21
| | | | | | | | | | | | | | | This is a better solution than the old __warn_references because it's a compile-time rather than link-time warning, it doesn't rely on something that doesn't appear to be supported by gold (which is why you only used to see these warnings on mips builds), and the errors refer to the exact call site(s) rather than just telling you which object file contains a reference to the bad function. This is primarily so we can build bionic for aarch64; building libc.so caused these warnings to fire (because link time is the wrong time) and warnings are errors. Change-Id: I5df9281b2a9d98b164a9b11807ea9472c6faa9e3
* Make <sys/param.h> more glibc-like.Elliott Hughes2013-12-121-2/+13
| | | | | | | In particular, add MAX and MIN, needed by elfutils. Bug: 11864683 Change-Id: I1b876732cdf68cdf5b930319e5ef5b5647586718
* Add cfi directives to all arm assembly.Christopher Ferris2013-12-021-1/+8
| | | | | | | | | | | | | | | | | | | | | | Since the ENTRY/END macros now have .cfi_startproc/.cfi_endproc, most of the custom arm assembly has no unwind information. Adding the proper cfi directives for these and removing the arm directives. Update the gensyscalls.py script to add these cfi directives for the generated assembly. Also fix the references to non-uapi headers to the proper uapi header. In addition, remove the kill.S, tkill.S, tgkill.S for arm since they are not needed at all. The unwinder (libunwind) is able to properly unwind using the normal abort. After this change, I can unwind through the system calls again. Bug: 11559337 Bug: 11825869 Bug: 11321283 Change-Id: I18b48089ef2d000a67913ce6febc6544bbe934a3
* Finish <sys/user.h>.Elliott Hughes2013-11-261-5/+14
| | | | Change-Id: I1d97d7fa3d5be2ff4728571ed5376705a27091ec
* Make <sys/timerfd.h> standalone.Elliott Hughes2013-11-251-1/+7
| | | | | | | There's no uapi timerfd.h. Bug: 11559337 Change-Id: I77a4b1365fdcf2c9f18673b11341a165e54b4bbd
* am 985c3fbb: Merge "Move arm user.h definitions to sys/user.h."Christopher Ferris2013-11-231-2/+40
|\ | | | | | | | | * commit '985c3fbb3b1dabfa799e2a8c102867349bcb5a76': Move arm user.h definitions to sys/user.h.
| * Move arm user.h definitions to sys/user.h.Christopher Ferris2013-11-221-2/+40
| | | | | | | | | | | | | | | | There is no uapi user.h file for arm, it was included by accident. Move the user struct definition into the file to follow the pattern used by the other architectures. Change-Id: Ib9cea0deca551c9268382ddd6de9202fd32ef941
* | Merge commit '811b0cdb2d6e4a697dbc63a678712759dd0db242' into HEADThe Android Open Source Project2013-11-221-4/+4
|\ \ | |/ |/| | | Change-Id: I786944f80fb1a2d502fed51dc2c391ed5db66761
| * am 4346bd9f: am bffe261a: Merge "Sort the syscalls.mk files, give all ↵Elliott Hughes2013-10-161-1/+1
| |\ | | | | | | | | | | | | | | | | | | generated files the same header." * commit '4346bd9fbcfe4144df7ac0e920bdda274d523fc4': Sort the syscalls.mk files, give all generated files the same header.
| * \ am d6e117b6: am 1f29c2f5: Merge "Switch sigpending over to rt_sigpending."Elliott Hughes2013-10-161-14/+10
| |\ \ | | | | | | | | | | | | | | | | * commit 'd6e117b64bdfbf8d793eb59ea9604b806608ec75': Switch sigpending over to rt_sigpending.
| * \ \ am 4691325d: am abeafbd6: Merge "Wrap sprintf()/snprintf() macros to prevent ↵Stephen Hines2013-10-111-2/+4
| |\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | expansion errors." * commit '4691325d48406033632fe84a944ac9c3bd2e5097': Wrap sprintf()/snprintf() macros to prevent expansion errors.
| * \ \ \ am 95de0df8: am eda2679e: Merge "FORTIFY_SOURCE: fortify read()"Nick Kralevich2013-10-091-0/+33
| |\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | * commit '95de0df8c2daeefca358010f2d15c3346a5284f1': FORTIFY_SOURCE: fortify read()
| * \ \ \ \ am b35ebe3d: am 848efa9d: Merge "Revert "FORTIFY_SOURCE: fortify read()""Nick Kralevich2013-10-091-33/+0
| |\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit 'b35ebe3d7097899fd4498ebb2b93e48fd836ebcf': Revert "FORTIFY_SOURCE: fortify read()"
| * \ \ \ \ \ am 731ced6b: am c147478c: Merge "FORTIFY_SOURCE: fortify read()"Nick Kralevich2013-10-091-0/+33
| |\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit '731ced6b289629a552b5841561fdcccf08d8c43a': FORTIFY_SOURCE: fortify read()
| * \ \ \ \ \ \ am c8bd2c2e: am 458076c3: Merge "Fix the ALIGN and ALIGNBYTES macros for LP64."Elliott Hughes2013-10-081-2/+7
| |\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit 'c8bd2c2e45c93b999a40449e4c6f44470f010367': Fix the ALIGN and ALIGNBYTES macros for LP64.