History log of /bionic/libc/SYSCALLS.TXT
Revision Date Author Comments
9e833bf0cf2c5bc0e6b65e4d96aa4f2b33113771 11-Sep-2014 Elliott Hughes <enh@google.com> Fix mips __fadvise64.S build failure.

Bug: 12449798

(cherry picked from commit 9990b3973bdfcda5419c06886215147a878222f1)

Change-Id: Iba92e2aa262666a59fc38b870dfd9f4082eeb628
00008263782e484020420c606f7d145fe7d0a4d8 11-Sep-2014 Elliott Hughes <enh@google.com> Add posix_fadvise(3).

Bug: 12449798
Change-Id: I07cbf3f670a0d1304b68148325a774f266b5c433
5386a741e77bfff4e72ca6861fdd3fe2208452ce 05-Aug-2014 Dan Albert <danalbert@google.com> Revert "Replaces vfork() implementation with fork()"

We're getting cold feet on this one... let's put it back.

This reverts commit 210331d9762037afb9b5ed8413079c6f65872df9.

Change-Id: I6b0d3c2b1dbf7f1dc9566979a91b7504c2189269
(cherry picked from commit 6a918870bab1a55a5f57dd7954abd9a8a27c1bc2)
4f76469e88e255bab1f8264e9ff8b95bff84365f 31-Jul-2014 Elliott Hughes <enh@google.com> Implement <sys/fsuid.h>.

(cherry picked from commit 79310994d2b3826a10598f7e7795acb5edb42a20)

Change-Id: I47688273691e5c95e5e9302eba254ccaaaad40ca
de24f1ac00924b9a523d06784867bc8c9312335d 19-Jul-2014 Elliott Hughes <enh@google.com> Clean up some misinformation around prctl.

prctl shouldn't be in <unistd.h>.

(cherry picked from commit 9c07aee83b4ebbf2dba8e23d6896683187b9724e)

Change-Id: I70cda886fbf4d58d82dc70adaa981506ebff9949
3002131da33401cf1b45abbdbec58b7c751fc43a 16-Jul-2014 Elliott Hughes <enh@google.com> Use VDSO for clock_gettime(2) and gettimeofday(2).

Bug: 15387103

(cherry picked from commit 625993dfbb085a3cde7492eda8ec1cdc1ee39a78)

Change-Id: I0e156d7049ba1495902259071a96936592e74025
3f525d41c2acde2ae3309cf839d83d7f41ab2fe6 25-Jun-2014 Elliott Hughes <enh@google.com> Add splice, tee, and vmsplice.

Change-Id: I5f43380b88d776a8bb607b47dbbc5db5a2fe6163
7086ad6919feb2415c6027163f5c63323bcca27c 20-Jun-2014 Elliott Hughes <enh@google.com> Cache getpid.

In practice, with this implementation we never need to make a system call.
We get the main thread's tid (which is the same as our pid) back from
the set_tid_address system call we have to make during initialization.
A new pthread will have the same pid as its parent, and a fork child's
main (and only) thread will have a pid equal to its tid, which we get for
free from the kernel before clone returns.

The only time we'd actually have to make a getpid system call now is if
we take a signal during fork and the signal handler calls getpid. (That,
or we call getpid in the dynamic linker while it's still dealing with its
own relocations and hasn't even set up the main thread yet.)

Bug: 15387103
Change-Id: I6d4718ed0a5c912fc75b5f738c49a023dbed5189
607341e226912d95d03216483bdcef6f8d96f8b4 13-Jun-2014 Dan Albert <danalbert@google.com> Remove ioprio_get(2) and ioprio_set(2) from LP64.

Bug: 11156955
Change-Id: I07b596d85e4bd6347d488d1a92c8d0a00b5ef3b3
210331d9762037afb9b5ed8413079c6f65872df9 06-Jun-2014 Dan Albert <danalbert@google.com> Replaces vfork() implementation with fork()

vfork() was removed from POSIX 2008, so this replaces its implementation
with a call to fork().

Bug: 13935372
Change-Id: I6d99ac9e52a2efc5ee9bda1cab908774b830cedc
3d5cb30d23cfc6a72f01c00246e69a2c614c8228 06-Jun-2014 Elliott Hughes <enh@google.com> Remove getdents from bionic.

Bug: 11156955
Change-Id: I6c306989801be552d85fba8a50dcdc79282fb9d2
5d9a7ba0dc9c24ed4e4efa9cac0e796fd524b308 31-May-2014 Elliott Hughes <enh@google.com> Avoid a system call in 'gettid'.

System calls can be pretty slow. This is mako, which has one of our
lowest latencies:

iterations ns/op
BM_unistd_getpid 10000000 209
BM_unistd_gettid 200000000 8

Bug: 15297299 (kernel panic from too many gettid calls)
Bug: 15315766 (excessive gettid overhead in liblogd)
Change-Id: I49656c0fc5b5d092390264a59e4f2c0d8a8b1aeb
b30aff405a220495941f1673b0a5e66c4fa8b84c 28-May-2014 Elliott Hughes <enh@google.com> Revert "Revert "Lose the hand-written futex assembler.""

The problem with the original patch was that using syscall(3) means that
errno can be set, but pthread_create(3) was abusing the TLS errno slot as
a pthread_mutex_t for the thread startup handshake.

There was also a mistake in the check for syscall failures --- it should
have checked against -1 instead of 0 (not just because that's the default
idiom, but also here because futex(2) can legitimately return values > 0).

This patch stops abusing the TLS errno slot and adds a pthread_mutex_t to
pthread_internal_t instead. (Note that for LP64 sizeof(pthread_mutex_t) >
sizeof(uintptr_t), so we could potentially clobber other TLS slots too.)

I've also rewritten the LP32 compatibility stubs to directly reuse the
code from the .h file.

This reverts commit 75c55ff84ebfa686c7ae2cc8ee431c6a33bd46b4.

Bug: 15195455
Change-Id: I6ffb13e5cf6a35d8f59f692d94192aae9ab4593d
75c55ff84ebfa686c7ae2cc8ee431c6a33bd46b4 28-May-2014 Narayan Kamath <narayan@google.com> Revert "Lose the hand-written futex assembler."

This reverts commit ced906c849704f379d7191822f6d74993d4fa296.

Causes issues on art / dalvik due to a broken return value
check and other undiagnosed issues.

bug: 15195455

Change-Id: I5d6bbb389ecefb0e33a5237421a9d56d32a9317c
ced906c849704f379d7191822f6d74993d4fa296 23-May-2014 Elliott Hughes <enh@google.com> Lose the hand-written futex assembler.

Also stop exporting 'futex'.

Bug: 12250341
Change-Id: Icc4fa4296cd04dfe0d1061822c69e2eb40c3433a
6e599a904b1f033cfaf79febff686f6296089a7d 22-May-2014 Elliott Hughes <enh@google.com> Remove the tkill(2) stub.

glibc doesn't have tkill or tgkill and says "use syscall(3) instead".
I've left tgkill since it's quite widely used, but there's no reason
to have tkill as well.

Bug: 11156955
Change-Id: Ifc0af750320086f829bc9914551c172b501f3b60
46a55a4478db9e335bdc7f73ee2cf3a66fe673fd 21-May-2014 Elliott Hughes <enh@google.com> Remove __syslog; we have the public klogctl API.

Bug: 11156955
Change-Id: I5c2cc02f39f76dd32984135f5c12c10bf2853796
4e631ba5688db2fae7bbc476982055a376102146 21-May-2014 Elliott Hughes <enh@google.com> Remove perf_event_open.

This was accidentally added at a time when you couldn't add a constant
to <syscall.h> without generating an assembly stub! (You no longer need
to add the constants at all.)

Bug: 11156955
Change-Id: I053c17879138787976c744a5ecf7d30ee51dc48f
903b78873a744d3fba187e4bd22008ba21162e51 19-May-2014 Sreeram Ramachandran <sreeram@google.com> Mark sockets on creation (socket()) and accept4().

Remove the separate syscall for accept() and implement it as accept4(..., 0).

Change-Id: Ib0b8f5d7c5013b91eae6bbc3847852eb355c7714
7222b1b594a8fab4b9e744d764b70e4c17767794 17-May-2014 Elliott Hughes <enh@google.com> Hide __signalfd4, used to implement signalfd(3).

Bug: 11156955
Change-Id: I50842279cb5b32ec8bd45193435574e415cd806e
8f0cd8aa22906c3e678738eeba20fc1a5c399b6c 14-May-2014 Sreeram Ramachandran <sreeram@google.com> Mark sockets on accept().

(cherry picked from commit 58b1f3f6a30a660ad81637c2b50382c3d279243b)

Change-Id: I5d09be413cf720fbed905f96313b007997ada76c
dedf2922d5c67e8c1e457b542bd71bc53d460b53 14-May-2014 Sreeram Ramachandran <sreeram@google.com> Mark sockets on accept().

Conflicts:
libc/SYSCALLS.TXT

Change-Id: I5d09be413cf720fbed905f96313b007997ada76c
ceb5bd787c8ce281e5f4343c5d4f77b41c3e2919 12-May-2014 Sreeram Ramachandran <sreeram@google.com> Introduce netd_client, a dynamic library that talks to netd.

The library exists outside bionic. It is dynamically loaded, to replace selected
standard socket syscalls with versions that talk to netd.

Change connect() to use the library if available.

(cherry picked from commit 3a6b627a14df8111b03e452f2df4b5f4938e0e49)

Change-Id: Ib6198e19dbc306521a26fcecfdf6e8424d163fc9
dcbef06ce6bb21d62d5a32148a3e64746b47b449 13-May-2014 Elliott Hughes <enh@google.com> Remove the useless indirection in mips' __set_tls.

Change-Id: I12e9d6716c42ccbccc9a186441aca0736bb22d05
9f525644df99cb2f7f81a23ca23840f0a8f82275 09-Apr-2014 Elliott Hughes <enh@google.com> Implement _Exit(3).

Change-Id: Ida6ac844cc87d38c9645b197dd8188bb73e27dbe
8f2a30a92ab6981cccbc1a9e17b738f7542ae33f 26-Mar-2014 Andrei Emeltchenko <andrei.emeltchenko@intel.com> Add accept4() syscall

Add accept4() using SYSCALLS.TXT and gensyscall

Change-Id: I6f19f29144186d15d46423e10f2cc4b4223719c6
4b558f50a42c97d461f1dede5aaaae490ea99e2e 05-Mar-2014 Elliott Hughes <enh@google.com> Rewrite the POSIX timer functions.

This is a much simpler implementation that lets the kernel
do as much as possible.

Co-authored-by: Jörgen Strand <jorgen.strand@sonymobile.com>
Co-authored-by: Snild Dolkow <snild.dolkow@sonymobile.com>
Change-Id: Iad19f155de977667aea09410266d54e63e8a26bf
6ff0c75c838e73d2aeccc0102ab58a7b865172ca 10-Feb-2014 Guillaume Ranquet <guillaumex.ranquet@intel.com> Add recvmmsg and sendmmsg syscalls.

Also add the corresponding constant, struct, and function declarations
to <sys/socket.h>, and perfunctory tests so we know that the symbols
actually exist.

Signed-off-by: Guillaume Ranquet <guillaumex.ranquet@intel.com>
Change-Id: Ib0d854239d3716be90ad70973c579aff4895a4f7
db1ea3474899ebbd783aba872d3005f95a816d0f 18-Jan-2014 Elliott Hughes <enh@google.com> Implement some of the missing LFS64 support.

This gives us:

* <dirent.h>
struct dirent64
readdir64, readdir64_r, alphasort64, scandir64

* <fcntl.h>
creat64, openat64, open64.

* <sys/stat.h>
struct stat64
fstat64, fstatat64, lstat64, stat64.

* <sys/statvfs.h>
struct statvfs64
statvfs64, fstatvfs64.

* <sys/vfs.h>
struct statfs64
statfs64, fstatfs64.

This also removes some of the incorrect #define hacks we've had in the
past (for stat64, for example, which we promised to clean up way back
in bug 8472078).

Bug: 11865851
Bug: 8472078
Change-Id: Ia46443521918519f2dfa64d4621027dfd13ac566
5043212b7615bc4c03463c4d242769de69cd4685 06-Feb-2014 Chris Dearman <chris.dearman@imgtec.com> [MIPS64] Add syscall related files

Change-Id: I2f5d05df0e767538a6fe467ca0a2386325f8b71f
Signed-off-by: Chris Dearman <chris.dearman@imgtec.com>
Signed-off-by: Raghu Gandham <raghu.gandham@imgtec.com>
Signed-off-by: Duane Sand <duane.sand@imgtec.com>
f64b8ea09db3bdd84eed59f7721301743332b3fe 04-Feb-2014 Elliott Hughes <enh@google.com> Add fallocate/fallocate64/posix_fallocate/posix_fallocate64.

Bug: 5287571
Bug: 12612860
Change-Id: I4501b9c6cdf9a830336ce0b3afc4ea716b6a0f6f
d1973ca51325393f304e82a4d79874f33e54ac16 22-Jan-2014 Colin Cross <ccross@android.com> bionic: rename aarch64 target to arm64

Rename aarch64 build targets to arm64. The gcc toolchain is still
aarch64.

Change-Id: Ia92d8a50824e5329cf00fd6f4f92eae112b7f3a3
0f461e35f63200641fc53bba222845a84589c024 09-Jan-2014 Elliott Hughes <enh@google.com> 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
887e1140fe7596fa1239a0bc802d2cdb51c57d3c 02-Jan-2014 Elliott Hughes <enh@google.com> 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
ed76a9361cffe6840b05d0ddfe71892bb25ab42e 12-Dec-2013 Serban Constantinescu <serban.constantinescu@arm.com> AArch64: Fix mmap64() definition for AArch64, X86_64

For 64bit Architectures mmap() is equivalent to mmap64(). This patch
maps mmap64() to mmap() in a similar way to other syscalls that differ
based on the size of off_t and off64_t

Change-Id: If21b21ef71120bad23d9a608d02d4a7de5220a87
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
ed45970ac5a182e512669cfa5c15b9f4fa783ad7 03-Dec-2013 Christopher Ferris <cferris@google.com> 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
36d6188f8cd8b948fb797f11d9620d63d0c2215a 19-Nov-2013 Elliott Hughes <enh@google.com> Clean up forking and cloning.

The kernel now maintains the pthread_internal_t::tid field for us,
and __clone was only used in one place so let's inline it so we don't
have to leave such a dangerous function lying around. Also rename
files to match their content and remove some useless #includes.

Change-Id: I24299fb4a940e394de75f864ee36fdabbd9438f9
877ec6d90418ff1d6597147d355a2229fdffae7e 16-Nov-2013 Elliott Hughes <enh@google.com> Fix pthread_join.

Let the kernel keep pthread_internal_t::tid updated, including
across forks and for the main thread. This then lets us fix
pthread_join to only return after the thread has really exited.

Also fix the thread attributes of the main thread so we don't
unmap the main thread's stack (which is really owned by the
dynamic linker and contains things like environment variables),
which fixes crashes when joining with an exited main thread
and also fixes problems reported publicly with accessing environment
variables after the main thread exits (for which I've added a new
unit test).

In passing I also fixed a bug where if the clone(2) inside
pthread_create(3) fails, we'd unmap the child's stack and TLS (which
contains the mutex) and then try to unlock the mutex. Boom! It wasn't
until after I'd uploaded the fix for this that I came across a new
public bug reporting this exact failure.

Bug: 8206355
Bug: 11693195
Bug: https://code.google.com/p/android/issues/detail?id=57421
Bug: https://code.google.com/p/android/issues/detail?id=62392
Change-Id: I2af9cf6e8ae510a67256ad93cad891794ed0580b
effaa7824da1af4db5cef50c78079d4c4e1717a7 13-Nov-2013 Chris Dearman <chris.dearman@imgtec.com> [MIPS] Reimplement syscall to invoke the system call directly

Some MIPS kernels do not correctly restart interrupted system calls that
have been invoked using the indirect syscall (NR_syscall).

The simplest workaround is to handle the indirection in userland and then
call the required system call directly.

Change-Id: I8385399621529db9a52b463c96925f6decaaca30
062092543fdbd6fa2676e4f5b37a15f7bba94332 07-Nov-2013 Elliott Hughes <enh@google.com> Clean up the 32-bit kernel support, fix LP64 fcntl declaration.

In practice, thanks to all the registers the stubs don't actually change,
but it's confusing to have an incorrect declaration.

I suspect that fcntl remains broken for aarch64; it happens to work for
x86_64 because the first vararg argument gets placed in the right register
anyway, but I have no reason to believe that's true for aarch64.

This patch adds a unit test, though, so we'll be able to tell when we get
as far as running the unit tests.

Change-Id: I58dd0054fe99d7d51d04c22781d8965dff1afbf3
8fbf8deb34d0bd1efc22d2b67d660ad32ecc4c5c 06-Nov-2013 Elliott Hughes <enh@google.com> Fix pread/pwrite for LP64.

Unlike on 32-bit systems where off_t is 32-bit, we don't want to
throw away the top 32 bits of an LP64 system's 64-bit off_t.

Change-Id: Ib2e0daeb4fc0b8ab3d1b983d0b371d8f81033b50
feaa89a1bcc643a9c3892bb56e020e00779bbb3a 07-Oct-2013 Serban Constantinescu <serban.constantinescu@arm.com> AArch64: Add support for AArch64 to the syscall interface

This patch adds support for AArch64 to the syscall interface. The kernel
implementation exports a set of canonical syscalls, therefore some of
the userspace exported syscalls are implemented as stubs based on the
canonical set.

Change-Id: Ia965d71e97769b8be9d7655193fc40303964c4df
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
6b53c2349a5a3fc70a475de6a66131b615e88e48 25-Oct-2013 Elliott Hughes <enh@google.com> Fix the exit syscall stub's name.

I've left the exit_group syscall as _exit because otherwise we'd have to
convince the compiler that our _exit (which just calls __exit_group) is
actually "noreturn", and it seems like that would be less clean than just
cutting out the middleman.

We'll just have to trust ourselves not to add anything to SYSCALLS.TXT
that ought to be private but that only has a single leading underscore.
Hopefully we can manage that.

Change-Id: Iac47faea9f516186e1774381846c54cafabc4354
11952073af22568bba0b661f7a9d4402c443a888 25-Oct-2013 Elliott Hughes <enh@google.com> Remove dependencies on obsolete __ARCH_WANT_SYSCALL_DEPRECATED system calls.

(aarch64 kernels don't have these system calls.)

Change-Id: I6f64075aa412f71520f2df71c3d69b647f91c1ca
cac7b9d6ec1a09814bc028e2f768db732f018891 23-Oct-2013 Elliott Hughes <enh@google.com> Remove dependencies on obsolete __ARCH_WANT_SYSCALL_NO_FLAGS syscalls.

(aarch64 kernels only have the newer system calls.)

Also expose the new functionality that's exposed by glibc in our header files.

Change-Id: I45d2d168a03f88723d1f7fbf634701006a4843c5
f8fcfbc85a3ce3e195626b90736d3a484331494b 22-Oct-2013 Elliott Hughes <enh@google.com> Move away from the __ARCH_WANT_SYSCALL_NO_AT system calls.

Modern architectures only get the *at(2) system calls. For example,
aarch64 doesn't have open(2), and expects userspace to use openat(2)
instead.

Change-Id: I87b4ed79790cb8a80844f5544ac1a13fda26c7b5
9ea4d5f3a852a03b5a2c5676da148a2779821518 19-Oct-2013 Elliott Hughes <enh@google.com> Fix the x86_64 vfork implementation.

Change-Id: I599507f5058e6196dc2d5b5653d06d5135dd8ac1
a6519d63063fe3c543bfd3b75b1145ddcd3b36b8 18-Oct-2013 Elliott Hughes <enh@google.com> Add missing aliases for off64_t functions in 64-bit land.

See the comment in SYSCALLS.TXT for an explanation.

Change-Id: I33d4056e84160c3cca74b7b588e9924a569753ed
c7e9b2331771e5e87c34a8ee3dc6cc41d35b02fe 17-Oct-2013 Elliott Hughes <enh@google.com> Fix sigaction(3) for 64-bit.

Also clean up <signal.h> and revert the hacks that were necessary
for 64-bit in linker/debugger.cpp until now.

Change-Id: I3b0554ca8a49ee1c97cda086ce2c1954ebc11892
40d105ccb3e6283566ce54b693b3088f31aa4f26 16-Oct-2013 Elliott Hughes <enh@google.com> Switch sigpending over to rt_sigpending.

Change-Id: I7b28984796b5fb343cfbcc47e0afc3a84293d417
c9da332cce903ebd4bec97da1d78d363fcf41f6d 16-Oct-2013 Elliott Hughes <enh@google.com> Remove support for the useless 'custom' option in SYSCALLS.TXT.

This cruft dates from a time when bionic would only output syscall
contants for the syscalls mentioned in SYSCALLS.TXT. I fixed that
a long time ago, but never followed through with the removal of what
was then confusingly called "stub" and was recently renamed "custom".

Change-Id: I8f3872a200b2dc8325e357cc5ee505ea4212ef95
1f5af926fa626734981d6b4dcc0ab54e520032a9 16-Oct-2013 Elliott Hughes <enh@google.com> Fix sigsuspend to use rt_sigsuspend on all platforms.

Change-Id: I981c1a66d35480d4457a0a08a1b042dac94daa5b
19e62325c268a668692e2b65fde2284079f369aa 15-Oct-2013 Elliott Hughes <enh@google.com> Clean up the sigprocmask/pthread_sigmask implementation.

Let's have both use rt_sigprocmask, like in glibc. The 64-bit ABIs
can share the same code as the 32-bit ABIs.

Also, let's test the return side of these calls, not just the
setting.

Bug: 11069919
Change-Id: I11da99f85b5b481870943c520d05ec929b15eddb
232163cf70712fe00436b70dd495f4cf405e9eab 10-Oct-2013 Elliott Hughes <enh@google.com> Clean up the cpuacct cruft.

Change-Id: I6ed63af8dfc2368e211420389fa8af4d5dc0908f
6fe4e8795452651862c1e02994f434ec5f0d5832 04-Oct-2013 H.J. Lu <hjl.tools@gmail.com> Add an optional alias list to SYSCALLS.TXT

This patch adds an optional alias list to SYSCALLS.TXT. It is used to
create aliases for a syscall. For x86-64, lseek64 is an alias for lseek.

Change-Id: Icb11fd2bb461ea4f5f0a26bfc585471d7d7cc468
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>
4906e5653c57d49f94940f28556009a88c42a583 04-Oct-2013 Elliott Hughes <enh@google.com> Add arch-x86_64/bionic.

This is basically half of I5de76f6c46ac87779f207d568a86bb453e2414de from
Pavel Chupin <pavel.v.chupin@intel.com>, but with the stock upstream
setjump/sigsetjmp and H.J. Lu's suggested changes to __rt_sigreturn.

Change-Id: I8167ec228faeb2065391e5bec0413cca662f3d33
9a4127bb0a174dd0c9d479ebc51c878f31d39ed6 12-Dec-2012 Pavel Chupin <pavel.v.chupin@intel.com> x86_64: add new __NR_arch_prctl syscall

This is used to set/get TLS on x86_64. There's no public declaration
of this because it's not meant to be used outside the C library, like
glibc (though we don't currently have any visibility controls to ensure
this).

Change-Id: I5fc0a5e3ffc3f4cd597d92ee685ab19568ea18f7
Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>
f12a18b85061e7121c7534faf3625137e56b770d 12-Dec-2012 Pavel Chupin <pavel.v.chupin@intel.com> x86_64: Add x86_64 syscalls and tune gen scripts for x86_64

* Tune syscall stubs generator for 4th target: x86_64
* Update SYSCALLS.TXT with x86_64 syscalls:
- Most of the x86 syscalls are equally supported
- *32 syscalls are not supported on 64-bit
- *64 syscalls are replaced accordingly without 64 suffix
- Some syscalls are not supported, replaced with x86_64 analog

Syscalls are regenerated as separate patch for review convenience.

Change-Id: I4ea2e0f13759b0aa61f05208ca68da8d6bc7c048
Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>
d612165c6705379aa50144afc35aa40c16793728 26-Sep-2013 Elliott Hughes <enh@google.com> Make it easier to add syscalls for another architecture.

Much of the per-architecture duplication can be removed, so let's do so
before we add the 64-bit architectures.

Change-Id: Ieb796503c8e5353ea38c3bab768bb9a690c9a767
5e52279256e9faa25378edf2ed40c18983ed6015 24-Sep-2013 Elliott Hughes <enh@google.com> Simplify the SYSCALLS.TXT format.

This will make addition of new architectures less unpleasant.

Change-Id: I77c866a63b686e8e70709d08fcf52e8a2d37310a
b4f7616fd618875768b8fffc122b58bdb84a9969 20-Sep-2013 Elliott Hughes <enh@google.com> Ensure we have the off64_t variant of every function that takes an off_t.

Change-Id: Ib2eee0cf13162be3b62559b84e90c6dcf5aab1c3
d206b560e72e791b5dfeb339b5f7c18354bf95fd 06-Jun-2013 Rom Lemarchand <romlem@google.com> libc: add swapon and swapoff syscalls

Change-Id: Ie79dc8e3f2ff1cd427dd6d95e3850920c4b407b0
Signed-off-by: Rom Lemarchand <romlem@google.com>
4200e6203aaa67c37874ad2b2271bff920297c7f 09-May-2013 Todd Poynor <toddpoynor@google.com> libc: add timerfd calls

(cherry-pick of 04c0ac14a49e0969333008a9522b64046d58fbdc.)

Change-Id: I06d0b6c2a8781602362b81f48faf1cca76b9ec05
04c0ac14a49e0969333008a9522b64046d58fbdc 09-May-2013 Todd Poynor <toddpoynor@google.com> libc: add timerfd calls

Change-Id: Id63b907266d5b87c7422a51d393a1430551ca33d
a69103ffe4b3d55f5bab7e7bfba36ccecddfa4da 03-Apr-2013 Elliott Hughes <enh@google.com> Fix the SYSCALLS.TXT documentation and remove a dead script.

We use the system call constants from the kernel header files now,
so there's no need to check that they've been correctly transcribed
into SYSCALLS.TXT.

This is a work in progress. I've added TODOs to SYSCALLS.TXT explaining
what's left to do.

(cherry-pick of a51916b58b2d211bcf8ffdbe9cf7faa58e57382f.)

Change-Id: I4484acd946b1f548ac3d95327e58add9f98246ab
a51916b58b2d211bcf8ffdbe9cf7faa58e57382f 03-Apr-2013 Elliott Hughes <enh@google.com> Fix the SYSCALLS.TXT documentation and remove a dead script.

We use the system call constants from the kernel header files now,
so there's no need to check that they've been correctly transcribed
into SYSCALLS.TXT.

This is a work in progress. I've added TODOs to SYSCALLS.TXT explaining
what's left to do.

Change-Id: I3b86acfe7f84b4da1c802ee5a4ef13a2e83e7939
cda62094ef6ab44d3804954fff75be1246725c36 22-Mar-2013 Elliott Hughes <enh@google.com> Use the correct names for the __ARM_NR_* syscalls.

This lets us move all the ARM syscall stubs over to the kernel <asm/unistd.h>.
Our generated <sys/linux-syscalls.h> is now unused, but I'll remove that in a
later change.

Change-Id: Ie5ff2cc4abce1938576af7cbaef615a79c7f310d
17a8b0db63d54e9d79bf11112ace0c4fe9606289 21-Mar-2013 Elliott Hughes <enh@google.com> Expose wait4 as wait4 rather than __wait4.

This helps strace(1) compile with one fewer hack.

Change-Id: I5296d0cfec5546709cda990abd705ad33d7c4626
0493a6f7be42e22d68e1d6ddb8eb2edaf818756f 07-Mar-2013 Elliott Hughes <enh@google.com> Regenerate NOTICE files.

Also clean up some obsolete cruft.

Change-Id: Iec3b36f6607f7a08b72de99294ed5b6cd910dd5f
a4b2dc016fa62bd172a73c3f8971c805700ffb0f 10-Jan-2013 Rom Lemarchand <romlem@google.com> Add signalfd call to bionic

Add signalfd() call to bionic.

Adding the signalfd call was done in 3 steps:
- add signalfd4 system call (function name and syscall
number) to libc/SYSCALLS.TXT
- generate all necessary headers by calling
libc/tools/gensyscalls.py. This patch is adding
the generated files since the build system
does not call gensyscalls.py.
- create the signalfd wrapper in signalfd.cpp and add
the function prototype to sys/signalfd.h

(cherry-pick of 0c11611c11f4dc1b6d43587b72c3ccbe8c51a51c, modified to
work with older versions of GCC still in use on some branches.)

Change-Id: I4c6c3f12199559af8be63f93a5336851b7e63355
19dd1567a0aee5e2e46b22352569d37b4c3844c5 10-Jan-2013 Elliott Hughes <enh@google.com> Revert "Add signalfd call to bionic"

This reverts commit 0c11611c11f4dc1b6d43587b72c3ccbe8c51a51c

Change-Id: I1a2beae7ed66ec995fdf6c96c53c35598ac6cde0
0c11611c11f4dc1b6d43587b72c3ccbe8c51a51c 10-Jan-2013 Rom Lemarchand <romlem@google.com> Add signalfd call to bionic

Add signalfd() call to bionic.

Adding the signalfd call was done in 3 steps:
- add signalfd4 system call (function name and syscall
number) to libc/SYSCALLS.TXT
- generate all necessary headers by calling
libc/tools/gensyscalls.py. This patch is adding
the generated files since the build system
does not call gensyscalls.py.
- create the signalfd wrapper in signalfd.cpp and add
the function prototype to sys/signalfd.h

Change-Id: I7ee1d3e60d5d3e1c73d9820e07d23b9ce6e1a5ab
58aaaa730b5b33bc4ee524eb04985e5b8cf540bb 29-Nov-2012 Chris Dearman <chris@mips.com> [MIPS] Fix the MIPS getsid system call

Change-Id: I30a27941125bccb35d73a572a729ecf7dd555389
Signed-off-by: Chris Dearman <chris@mips.com>
4e75c4b2d745c673f5fe20676f7b53eedbec2853 11-Oct-2012 Shuo Gao <shuo.gao@intel.com> Fix perf_event_open syscall for x86 and mips

perf_event_open syscall has a different syscall number for
the 3 supported architectures: arm, x86 and mips. Currenlty
only the arm syscall number is defined for all architectures.
Tracing tools like perf will not work on other architectures
than arm.

Add the different values for perf_event_open on x86 and mips
and run gensyscalls.py to update generated headers.

Change-Id: I2ed78bd42c0e5df8dbc51d784be49cccda5fab30
Author: Irina Tirdea <irina.tirdea@intel.com>
Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Signed-off-by: Shuo Gao <shuo.gao@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
1ad05db9cef23c1ca28ffd51852fa2a0b0c9b4b7 06-Sep-2012 Elliott Hughes <enh@google.com> Add mlockall and munlockall for Google TV.

Change-Id: I10e961d701e74aab07211ec7975f61167e387853
1ad10a566e042676c95a0bdbf3cbc48e99ddafb2 29-Aug-2012 Irina Tirdea <irina.tirdea@intel.com> Add getsid system call to bionic

Add getsid() system call to bionic for
all architectures. This is needed for various tools
(e.g. perf).

Adding the getsid system call was done in 3 steps:
() add getsid system call (function name and syscall
number) to libc/SYSCALLS.TXT
() generate all necessary headers by calling
libc/tools/gensyscalls.py. This patch is adding
the generated files since the build system
does not call gensyscalls.py.
() add the system call signature to libc/include/unistd.h

Change-Id: Id69a257e13ec02e1a44085a6b217a3f19ab025b1
Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
e36c826f7a6580227e9e70f6ec70aa88ba0f577e 10-Aug-2012 Jeff Sharkey <jsharkey@android.com> Add unshare() syscall.

(cherry-pick of 5467f25f82934d611c60f8bc57a05114f3c1bea0.)

Bug: 6925012
Change-Id: Ic5ea2fbd606311087de05d7a3594df2fa9b2fef9
5467f25f82934d611c60f8bc57a05114f3c1bea0 10-Aug-2012 Jeff Sharkey <jsharkey@android.com> Add unshare() syscall.

Bug: 6925012
Change-Id: I2530a8f6cea49eb32b60f8f9c4d86963773456ca
abd10011a7a6066df76de7acf5eecb2cc870b0c4 09-Aug-2012 Raghu Gandham <raghu@mips.com> MIPS support to sigsuspend and sigwait routines

Change-Id: I870e798ed7eac5a8c74e5784a670f3a4f24331a9
1fa0d849576555577ffd9675677a3c95f21b754e 28-Jan-2012 Raghu Gandham <raghu@mips.com> [MIPS] Add support for MIPS syscalls

Change-Id: I4deba67e15c865c4c2db03064c04098a09828ea6
Signed-off-by: Raghu Gandham <raghu@mips.com>
Signed-off-by: Chris Dearman <chris@mips.com>
d515ce465be909d830a39462c3f196b5d7f35c66 17-Apr-2012 Jack Ren <jack.ren@intel.com> Bionic: Fix wrong prototype of system call clock_nanosleep

In bionic/libc/SYSCALLS.TXT, the prototype of system call
clock_nanosleep is incorrect.

According to man page:
int clock_nanosleep(clockid_t clock_id, int flags,
const struct timespec *request,
struct timespec *remain);

Change-Id: Ic44c6db3d632293aa17998035554eacd664c2d57
Signed-off-by: Jin Wei <wei.a.jin@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
41070dd15f2c5916dfc96da4c256dd04d7f9c837 17-Apr-2012 Jack Ren <jack.ren@intel.com> bionic: Fix wrong prototype of system call getresuid/getresgid

In bionic/libc/SYSCALLS.TXT, the prototypes of system call
getresuid/getresgid are incorrect.

According to man page, they should be:
int getresuid(uid_t *ruid, uid_t *euid, uid_t *suid);
int getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid);

Change-Id: I676098868bb05a9e1fe45419b234cf397626fdad
Signed-off-by: Jin Wei <wei.a.jin@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
f0ec06ba609a15cf9343aabd5b2486f9a8af9adb 13-Apr-2012 Kenny Root <kroot@google.com> Add faccessat to syscall list

Change-Id: I427a18811089cb280769ac8da3ed8adc00a65a10
1a823691a21519014daf252691a314f0726d7c3a 13-Mar-2012 Ben Cheng <bccheng@google.com> Update kernel headers and add syscall "perf_event_open"

Change-Id: I43f12b727881df002a8524f2738586c043833bae
b69060f1ae0bd14c93caed2d113a72cf81d98f1d 10-Feb-2012 Raghu Gandham <raghu@mips.com> Clean up the remnants of SuperH support
70b1668a76d3b719ae690903ea790fda964a5458 30-Jan-2012 David 'Digit' Turner <digit@google.com> remove obsolete SuperH support

We don't have a toolchain anymore, we don't have working original
kernel headers, and nobody is maintaining this so there is really
no point in keeping this here. Details of the patch:

- removed code paths from Android.mk files related to the SuperH
architecture ("sh")

- removed libc/arch-sh, linker/arch-sh, libc/kernel/arch-sh

- simplified libc/SYSCALLS.TXT

- simplified the scripts in libc/tools/ and libc/kernel/tools

Change-Id: I26b0e1422bdc347489e4573e2fbec0e402f75560

Signed-off-by: David 'Digit' Turner <digit@android.com>
5eb686d105ebd7cea332fd1ef0bb3af9386e19f7 13-Jan-2012 Stephen Smalley <sds@tycho.nsa.gov> Add extended attribute (xattr) system call wrappers to bionic.

The xattr system calls are required for the SE Android userspace in
order to get and set file security contexts. In particular, libselinux
requires these calls.

Change-Id: I78f5eb3d8f3384aed0a5e7c6a6f001781d982017
f44de270bba32c9b1b5eff8a34be07b10ddff238 13-Jan-2012 Nick Kralevich <nnk@google.com> add personality() system call.

Change-Id: Ie899def8ea1d705930ed83adae1343c1353e7c57
e30e909363c5c706f394050d9cd00ce222caadbf 13-Jul-2011 Bruce Beare <bruce.j.beare@intel.com> sreadahead: adding readahead system call into bionic libc

Add bionic libc to support readahead system call.
This is needed to enable sreadahead to work.

Change-Id: I3856e1a3833db82e6cf42fd34af7631bd40cc723
Author: Winson Yung <winson.w.yung@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
10c8ce59a40a1d8ae8f49145eca365b364aabe58 19-Nov-2011 Jeff Brown <jeffbrown@google.com> Add tgkill syscall.

Use tgkill instead of tkill to implement pthread_kill.
This is safer in the event that the thread has already terminated
and its id has been reused by a different process.

Change-Id: Ied715e11d7eadeceead79f33db5e2b5722954ac9
b083bb57f5cae6b1fa3fd756a2720a3de806da2b 26-May-2011 David 'Digit' Turner <digit@android.com> libc: Fix prctl() declaration.

This change fixes the prctl() declaration to match GLibc, and allow us
to build gcc-4.6 for Android (among other things). Note that this does
not change the source and binary interfaces.

Change-Id: I3900c957f0da8b3548cbe9da8c41d50099dc19d6
ae2d5ba31412c4f382ef405000baa866f35dd736 18-Mar-2011 Ken Sumrall <ksumrall@android.com> Add support for the utimensat(2) syscall to bionic.

The kernel has supported this syscall for quite some time now,
but bionic did not. Now that there is a need for it, let's
add it to bionic.

Change-Id: Ifcef3e46f1438d79435b600c4e6063857ab16903
fc2693110ee8a2ba22a445ad9855fbe9e118d439 11-Oct-2010 David 'Digit' Turner <digit@google.com> libc: Update auto-gen scripts

Make the scripts use external/kernel-headers/original by default.

clean_header.py: Document -k<path>, add -d<path>
find_headers.py: Make kernel config files optional
update_all.py: Allow setting the path to kernel headers on the command-line
update_all.py: Better formatting of output on ttys
update_all.py: Automatically perform "git add/rm" on affected files.
SYSCALLS.TXT: Fix typo in __socketcall definition.
checksyscalls.py: Add support for superH architecture in the checks.
gensyscalls.py: Automatically perform "git add/rm" on affected files.
cpp.py: Fixed a bug that prevented certain type definitions to
be kept in the generated clean header (e.g.
struct ethtool_drvinfo in <linux/ethtool.h>)

All scripts will use the content of external/kernel-headers/original by default now.

The generated code removes all empty lines and trailing whitespace. This is useful
to ensure a unified output even if we change the parser again in the future.

The top-level disclaimer has been edited with update instructions to regenerate
the headers when needed.

Also, a warning is now inserted every 8th line in the final output:

/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */

Changes under kernel/arch-arm and kernel/arch-x86 should correspond to whitespace
differences and additionnal struct definitions that were missed by the previous
parser implementation.

Change-Id: Icd1c056bacd766759f3e9b7bb5d63a246f3d656a

WARNING: If you run these script, do not submit the result to gerrit for now.
It seems there are discrepancies between the content of original headers
and those currently commited under bionic/libc/kernel/.

(This problem is the main motivation to insert the warning repeatedly).

Current list of issues:

- Missing SuperH headers (i.e. external/kernel-headers/original/asm-sh)
95d751feacdb58d3fbc36f3f21a895a3ec2f065b 16-Dec-2010 David 'Digit' Turner <digit@google.com> libc: Add ftruncate64 and improve 64-bit parameter syscall handling.

This patch improves the handling of 64-bit parameters in syscalls on ARM.
The ARM EABI mandates that 64-bit quantities be passed in even/odd register
pairs, which requires special treatment.

This allows us to simplify our implementations of pread() and pwrite()
and remove the C stubs for pread64() and pwrite64().

Also add ftruncate64() to <unistd.h>

Change-Id: I407e2fd223ba0093dd2d0b04c6152fadfc9ce3ef

Bug 3107933
4a7f31fad74417696ce740b1f5c14e4de0740e33 16-Dec-2010 David 'Digit' Turner <digit@google.com> libc: Remove duplicate eventfd declaration from SYSCALLS.TXT

The second declaration came from an incorrect change in AOSP.
The eventfd stubs are not affected by this, they are already correct.

Change-Id: Icfc7612a68fc37a48dde2687137960a5d1dbc534
72e6fd42421dca80fb2776a9185c186d4a04e5f7 03-Dec-2010 David 'Digit' Turner <digit@google.com> <sched.h>: Add sched_getcpu() and cpu_set_t

This adds the cpu_set_t type definition and related functions
and macros used to handle CPU thread affinity.

sched_getcpu()
sched_setaffinity()
sched_getaffinity()

Change-Id: If382ecafde8926341a88478062b275553645065b
defd162212de3789d2268a1f3339c2a6097fa825 26-Sep-2010 David 'Digit' Turner <digit@google.com> libc: add <sys/eventfd.h> and corresponding implementations.

Change-Id: Ide040884c456190226e580513099fdb8377e015b
9973a564222b842eb7497fd6e659fe8c8c49e2b3 27-Sep-2010 David 'Digit' Turner <digit@google.com> libc: Add missing waitid() implementation.

Change-Id: I312ee608dbf9249e4886a10d45d13e3cda8a9042
a3ae60d343661784e3f6f4566b276d8e6b8a06a7 27-Sep-2010 David 'Digit' Turner <digit@google.com> libc: Add missing fdatasync() implementation

Change-Id: I04bb655d77e414021e1f2a973329167ad76ca1c4
275cd48511daabe4591caa49c3ad0df34a6889ff 27-Sep-2010 David 'Digit' Turner <digit@google.com> libc: Add missing pipe2() declaration and implementation.

Change-Id: Iacb914bd6ac5adc60c5671e6fef680ede21f9b0c
3a1bbee36b773862e88c6f1895b607c0cd81b499 31-Aug-2010 Keith Deacon <kdeacon@ti.com> Add eventfd system call support
18c5bcc66a9a7b2178dcdcf04a0716958798ab81 30-Jul-2010 Dima Zavin <dima@android.com> Revert "Set SA_RESTORER in sigaction()"

This reverts commit e4fa46e75cd0d433b5c6c064720ed7e195cba7c8.
ab8b54101eed0a4b92ebf8fa6994cd1b4f22d8f4 09-Jul-2010 David 'Digit' Turner <digit@google.com> libc: fix fstatfs() implementation.

The syscall expects the size of the buffer as the second argument.

Change-Id: I99ede2fec7fcd385ca03ff022c2cffa4297bea8d
aa4b1d042927872224e4bf5d22e4db5367e389fa 20-May-2010 David 'Digit' Turner <digit@google.com> Add missing sysinfo() implementation (already declared in <sys/sysinfo.h>) - DO NOT MERGE

Change-Id: Iac4eb5911ffe4a7ab72b84df44e907685ac816af
5d726df15e1391b62f09e91f113f6a1555cd8f2b 20-May-2010 David 'Digit' Turner <digit@google.com> Add missing sysinfo() implementation (already declared in <sys/sysinfo.h>)

Change-Id: Ie9168238c3a8e77daab4f39939756d4c53d8af37
e4fa46e75cd0d433b5c6c064720ed7e195cba7c8 11-Jan-2010 Matt Fischer <matt.fischer@garmin.com> Set SA_RESTORER in sigaction()

GDB looks for specific opcode sequences when trying to recognize a stack
frame as a signal trampoline. The sequences it looks for happen to be those
created when SA_RESTORER is set, since glibc always sets a restorer. This
patch does the same here, so that the trampolines can be correctly identified.

Change-Id: I0ac574a68818cb24d939c3527f3aaeb04b853d04
9f6915631b918a56e0e6be958fb14d274cbab322 02-Mar-2010 Mike Chan <mike@android.com> bonic: libc: cpuacct support for setuid functions

Any of the setuid functions now updates /acct/uid/ with its own tid
before changing users. This is so we can properly account for cpu time
per uid.

Change-Id: I34186cf4d5228cac8439e582a9e26c01ef3011e4
Signed-off-by: Mike Chan <mike@android.com>
eb9d5ed3477ef8cd9ccfa424ea585541ea3af84a 25-Feb-2010 Andrei Popescu <andreip@google.com> add sigaltstack syscall
75c5e25ae3615c34f4bcc7dcbe9b29e548e26b9c 24-Feb-2010 San Mehat <san@google.com> bionic: syscalls: Add ioprio_set/ioprio_get syscall wrappers

Signed-off-by: San Mehat <san@google.com>
97cf7f3394780d524038fc083e2c134031b54728 23-Jan-2010 David 'Digit' Turner <digit@google.com> Implement clone() C library function properly.

Only provide an implementation for ARM at the moment, since
it requires specific assembly fragments (the standard syscall
stubs cannot be used because the child returns in a different
stack).
ce0595d01de9103d40b83b35e0d6ac8b123aa24c 01-Sep-2009 Shin-ichiro KAWASAKI <shinichiro.kawasaki.mg@hitachi.com> modified SYSCALLS.TXT to support SuperH architecture
1dc9e472e19acfe6dc7f41e429236e7eef7ceda1 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
1767f908af327fa388b1c66883760ad851267013 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
6f04a0f4c72acff80dad04828cb69ef67fa609d1 19-Feb-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@132276
4e468ed2eb86a2406e14f1eca82072ee501d05fd 18-Dec-2008 The Android Open Source Project <initial-contribution@android.com> Code drop from //branches/cupcake/...@124589
a27d2baa0c1a2ec70f47ea9199b1dd6762c8a349 21-Oct-2008 The Android Open Source Project <initial-contribution@android.com> Initial Contribution