Commit graph

622 commits

Author SHA1 Message Date
Elliott Hughes
a8a3178445 Add the glibc-compatible d_fileno.
d_ino is the POSIX name, but glibc also offers d_fileno, and
that's what strace is using.

Change-Id: I3fadbe7a64700b42e78c7f4631620e864d43147b
2014-01-09 12:37:12 -08:00
Elliott Hughes
0f461e35f6 Fix <sys/resource.h>.
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
2014-01-09 11:00:04 -08:00
Elliott Hughes
8276d2875f Merge "Our dirent is a dirent64." 2014-01-09 01:15:27 +00:00
Elliott Hughes
38f0ef3ff7 Our dirent is a dirent64.
Change-Id: Idc9ebfd900fddd4f7c7ac95bc9b74401ebc801a3
2014-01-08 16:31:36 -08:00
Elliott Hughes
5b17e4da39 Add <sys/reg.h>.
This describes the offsets into ptrace's returned arrays of registers
for x86 and x86-64.

Change-Id: I044f03e286673999a298b73a813d4ad366625845
2014-01-08 16:29:22 -08:00
Elliott Hughes
8a6eec38eb Merge "Fix x86_64 register names in <sys/user.h>." 2014-01-09 00:24:55 +00:00
Elliott Hughes
eddc8ece3d Fix x86_64 register names in <sys/user.h>.
Change-Id: Ieb327247a41f6195589716170e324d1cd1251b96
2014-01-08 15:54:19 -08:00
Elliott Hughes
155b076420 We shouldn't have a <sys/dirent.h> that's a subset of <dirent.h>.
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
2014-01-08 15:51:13 -08:00
Elliott Hughes
4c8caf0ad3 Merge "<sched.h> should offer both __sched_priority and sched_priority." 2014-01-08 02:41:04 +00:00
Elliott Hughes
4faf76ca11 Merge "<fcntl.h> should get you the POSIX_FADV_* constants." 2014-01-08 02:40:44 +00:00
Elliott Hughes
bc4e135a8e Merge "Add SWAP_FLAG_* constants to <sys/swap.h>." 2014-01-08 02:31:55 +00:00
Elliott Hughes
65c6f3099e Add SWAP_FLAG_* constants to <sys/swap.h>.
Bug: 9336527
Change-Id: I679be4d8425ba177dd782e714f465caf9daa976c
2014-01-08 02:23:06 +00:00
Elliott Hughes
bbb34f9536 <sched.h> should offer both __sched_priority and sched_priority.
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
2014-01-07 17:48:30 -08:00
Elliott Hughes
01e505ac9c <fcntl.h> should get you the POSIX_FADV_* constants.
Change-Id: I9de8b840570b228308c12d72b7617b8758237fb8
2014-01-07 17:47:20 -08:00
Elliott Hughes
abfc88fed7 Define fsid_t as well as __fsid_t.
Change-Id: Ib8efbd913a0e6bfe27b88c1342bd5cec926dd74e
2014-01-07 17:44:51 -08:00
Elliott Hughes
b235f8c877 Merge "Fix dev_t (for LP64)." 2014-01-06 20:37:03 +00:00
Elliott Hughes
338e6102a6 Add TCPOPT_* constants.
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
2014-01-03 15:58:40 -08:00
Elliott Hughes
894f8cb139 Fix dev_t (for LP64).
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
2014-01-03 14:49:37 -08:00
Elliott Hughes
887e1140fe Clean up <sched.h>.
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
2014-01-02 12:05:50 -08:00
Elliott Hughes
68d89c7d65 Remove some old kernel header cruft not needed with uapi.
Change-Id: If543b056ae40f0eb660be4a0629ad22f4c4cb92f
2013-12-20 17:26:30 -08:00
Elliott Hughes
aa267685c9 Merge "Allow GCC-built fortified code to run on a clang-built bionic." 2013-12-20 02:54:56 +00:00
Elliott Hughes
b8fa5b1ca9 Fix struct stat for aarch64.
Another kernel, another struct stat.

Change-Id: Ia5ee553d4a2ffc878d2fed82a763ff64c02b12e8
2013-12-19 16:50:22 -08:00
Elliott Hughes
cd0609f4fc Allow GCC-built fortified code to run on a clang-built bionic.
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
2013-12-19 14:20:22 -08:00
Elliott Hughes
ad8842f5c6 Don't use __kernel_ulong_t.
Change-Id: Ifdfbac0ac6da647276a84bd64bb342bb5a07ad61
2013-12-18 12:22:33 -08:00
Elliott Hughes
2b333ea31e Remove <machine/kernel.h>.
Bug: 12175484
Change-Id: I127f7f91f36bd879109d653e0c56ec56e2529d4d
2013-12-18 11:21:55 -08:00
Elliott Hughes
c13fb75cea Move bionic over to GCC's 'warning' attribute.
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
2013-12-17 20:43:30 -08:00
Elliott Hughes
c2f082f655 Make <sys/param.h> more glibc-like.
In particular, add MAX and MIN, needed by elfutils.

Bug: 11864683
Change-Id: I1b876732cdf68cdf5b930319e5ef5b5647586718
2013-12-12 15:31:35 -08:00
Christopher Ferris
ed45970ac5 Add cfi directives to all arm assembly.
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
2013-12-02 19:13:12 -08:00
Elliott Hughes
ab797cb4fd Finish <sys/user.h>.
Change-Id: I1d97d7fa3d5be2ff4728571ed5376705a27091ec
2013-11-26 17:57:31 -08:00
Elliott Hughes
e96d4bffe5 Make <sys/timerfd.h> standalone.
There's no uapi timerfd.h.

Bug: 11559337
Change-Id: I77a4b1365fdcf2c9f18673b11341a165e54b4bbd
2013-11-25 13:58:38 -08:00
Christopher Ferris
dd1d4f1cfd am 985c3fbb: Merge "Move arm user.h definitions to sys/user.h."
* commit '985c3fbb3b1dabfa799e2a8c102867349bcb5a76':
  Move arm user.h definitions to sys/user.h.
2013-11-23 08:02:04 -08:00
Christopher Ferris
363390eaff Move arm user.h definitions to sys/user.h.
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
2013-11-22 18:00:09 -08:00
The Android Open Source Project
f00c938c7f Merge commit '811b0cdb2d6e4a697dbc63a678712759dd0db242' into HEAD
Change-Id: I786944f80fb1a2d502fed51dc2c391ed5db66761
2013-11-22 13:38:33 -08:00
Elliott Hughes
880d0e6c64 Merge "Remove hidden __reboot from header" 2013-11-21 20:37:26 +00:00
Pavel Chupin
811cba00af Remove hidden __reboot from header
This change is required:
https://android-review.googlesource.com/#/c/70570

Change-Id: Idb991f96a424aa5b0f9e06d9fb787fe8c8530750
Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>
2013-11-22 00:19:34 +04:00
Elliott Hughes
9c67d4307c Fix useconds_t for LP64.
Change-Id: I869e60484999c1feda3dcdb86bee5b5373e6b3df
2013-11-21 08:55:46 -08:00
Elliott Hughes
ab61eb366a Switch to upstream sleep(3) and usleep(3).
Also fix the signature of usleep, and the definition of useconds_t which
should be unsigned, as the 'u' in its name implies.

This patch also cleans up the existing FreeBSD hacks by moving the libm
stuff from <sys/cdefs.h> to a libm-private header, and adding comments
about the hacks we use to build FreeBSD source.

Change-Id: Ibe5067a380502df94a0a3a7901969b35411085b6
2013-11-20 16:24:16 -08:00
Elliott Hughes
d8482b6c7e Fix <signal.h> for mips uapi.
Bug: 11559337
Change-Id: I4c6080f162d74ee78c81d698c7b50470b0e09586
2013-11-20 12:51:52 -08:00
Elliott Hughes
e888de81df Provide <sys/user.h>.
strace wants this, for example.

Change-Id: Icb4d64bde392abbc091fa3375a4fa19b2707b12c
2013-11-19 15:32:31 -08:00
Elliott Hughes
2ecc164ae9 Remove the dependency on the non-uapi __kernel_nlink_t.
The kernel doesn't have an nlink_t; it just uses the equivalent of
uint32_t. We already had a usable __nlink_t in the C library, so
let's just define our nlink_t in terms of __nlink_t, which is what
__nlink_t was meant for anyway.

Note that our struct stat just follows the kernel, and doesn't refer
to nlink_t anyway.

Change-Id: I2a56e418e42404b1741b08c50554b03c11caebae
2013-11-08 14:38:12 -08:00
Elliott Hughes
61fb3fc770 Prepare to switch to the uapi <linux/signal.h>.
<time.h> didn't need to copy the cruft from <signal.h>, and
<signal.h> only needs the uid_t hack when it's not using
uapi headers.

pthread_exit.cpp should include what it uses.

Change-Id: I836c36abe0f0a781d41fc425b249d1c7686bb124
2013-11-07 12:29:07 -08:00
Elliott Hughes
40596aa005 Make cpp.py less braindead.
The old code ignored operator precedence (!), despite having two tables
of operator precedence. The code's still pretty awful, but I've cleaned
it up enough to fix this, the most important bug.

This patch lets us correctly clean the uapi unistd.h, stat.h, and swab.h files,
and also fixes the mess we were already making of various old kernel
header files. I've added a bunch more tests, fixed the existing tests that
the existing script was already failing (!), and changed the script so that
the tests are run every time the script is run.

We can probably remove some of the old kernel header files that we were
parsing incorrectly, but we can worry about that later.

Bug: 11253477
Change-Id: Ie66c65b3a7ae13b4e98ed8038a6a534f06eae0e5
2013-11-06 12:04:48 -08:00
Elliott Hughes
3503ce2177 Fix <sys/select.h> for LP64, clean up <time.h>.
The 64-bit uapi headers don't define FD_CLR and friends, so this
patch updates libc/kernel/common/linux/time.h after the change
b934bbec145e9e084bf48149a3a94ae3dd132157 in external/kernel-headers,
then fixes <sys/select.h> to work in this new world, and removes
some now-unnecessary duplication from <time.h> (with other cruft
cleaned up while I'm here).

Change-Id: Ifd26f901b4d200c65065b3e6ef1b74055127e052
2013-11-05 13:28:36 -08:00
Elliott Hughes
c3f114037d <pthread.h> fixes and pthread cleanup.
<pthread.h> was missing nonnull attributes, noreturn on pthread_exit,
and had incorrect cv qualifiers for several standard functions.

I've also marked the non-standard stuff (where I count glibc rather
than POSIX as "standard") so we can revisit this cruft for LP64 and
try to ensure we're compatible with glibc.

I've also broken out the pthread_cond* functions into a new file.

I've made the remaining pthread files (plus ptrace) part of the bionic code
and fixed all the warnings.

I've added a few more smoke tests for chunks of untested pthread functionality.

We no longer need the libc_static_common_src_files hack for any of the
pthread implementation because we long since stripped out the rest of
the armv5 support, and this hack was just to ensure that __get_tls in libc.a
went via the kernel if necessary.

This patch also finishes the job of breaking up the pthread.c monolith, and
adds a handful of new tests.

Change-Id: Idc0ae7f5d8aa65989598acd4c01a874fe21582c7
2013-10-31 12:31:16 -07:00
Elliott Hughes
126405039e Update <sys/exec_elf.h> to include EM_AARCH64.
Upstream added the constant for us.

Change-Id: I197e32d2e5b3fd499d069546ccfcc1d35d65e0a0
2013-10-28 21:28:40 -07:00
Serban Constantinescu
7f8863dc07 AArch64: Autogenerated syscalls for AArch64
This patch adds AArch64 syscalls, autogenerated using:
        ./libc/tools/gensyscalls.py

Change-Id: I1cc60430423ecb52a35448bf2c358b82136b2f16
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
2013-10-28 16:18:42 -07:00
Elliott Hughes
74ce45972d Update <sys/exec_elf.h> to get the DF_* flags.
Change-Id: Ia9e785f6b95122f94ee3b01a312db1d5bb91a72e
2013-10-28 14:59:41 -07:00
Elliott Hughes
e4d792adb8 Don't allow text relocations on 64-bit.
I've also updated our <sys/exec_elf.h> to match upstream.

Change-Id: I52f9fce3167541811208d273ff23ceaa112f7135
2013-10-28 14:34:56 -07:00
Elliott Hughes
27586ebe1a Fix utime/utimes when passed a NULL pointer.
Bug: 11383777
Change-Id: If944a42f3adfa8a6ce91c167c249e009ed63300a
2013-10-28 13:21:06 -07:00
Elliott Hughes
11952073af Remove dependencies on obsolete __ARCH_WANT_SYSCALL_DEPRECATED system calls.
(aarch64 kernels don't have these system calls.)

Change-Id: I6f64075aa412f71520f2df71c3d69b647f91c1ca
2013-10-24 15:48:32 -07:00