summaryrefslogtreecommitdiffstats
path: root/libc/arch-x86/syscalls
Commit message (Collapse)AuthorAgeFilesLines
* Add posix_fadvise(3).Elliott Hughes2014-09-101-0/+46
| | | | | Bug: 12449798 Change-Id: I07cbf3f670a0d1304b68148325a774f266b5c433
* Ensure __set_errno is still visible on LP32.Elliott Hughes2014-09-08195-585/+195
| | | | | | | | | | | | | | | | The use of the .hidden directive to avoid going via the PLT for __set_errno had the side-effect of actually making __set_errno hidden (which is odd because assembler directives don't usually affect symbols defined in a different file --- you can't even create a weak reference to a symbol that's defined in a different file). This change switches the system call stubs over to a new always-hidden __set_errno_internal and has a visible __set_errno on LP32 just for binary compatibility with old NDK apps. Bug: 17423135 Change-Id: I6b6d7a05dda85f923d22e5ffd169a91e23499b7b
* Make __set_errno hidden in asm.Dan Albert2014-08-08195-0/+390
| | | | | | | | This fixes the build after the -Bsymbolic change. Bug: 16853291 Change-Id: I989c9fec3c32e0289ea257a3bd2b7fd2709b6ce2 (cherry picked from commit bc9f9f25bf1247a6a638a2a2df8441bdd9fabad7)
* Implement <sys/fsuid.h>.Elliott Hughes2014-07-302-0/+42
| | | | | | (cherry picked from commit 79310994d2b3826a10598f7e7795acb5edb42a20) Change-Id: I47688273691e5c95e5e9302eba254ccaaaad40ca
* Add splice, tee, and vmsplice.Elliott Hughes2014-06-243-0/+118
| | | | Change-Id: I5f43380b88d776a8bb607b47dbbc5db5a2fe6163
* Cache getpid.Elliott Hughes2014-06-201-2/+2
| | | | | | | | | | | | | | | | | 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
* Remove ioprio_get(2) and ioprio_set(2) from LP64.Dan Albert2014-06-122-57/+0
| | | | | Bug: 11156955 Change-Id: I07b596d85e4bd6347d488d1a92c8d0a00b5ef3b3
* Remove getdents from bionic.Elliott Hughes2014-06-061-2/+2
| | | | | Bug: 11156955 Change-Id: I6c306989801be552d85fba8a50dcdc79282fb9d2
* Remove unnecessary instructions from x86/x86_64 syscalls.Elliott Hughes2014-06-05192-192/+0
| | | | | | | | __set_errno returns -1 exactly so that callers don't need to bother. The other architectures were already taking advantage of this, but no one had ever fixed x86 and x86_64. Change-Id: Ie131494be664f6c4a1bbf8c61bbbed58eac56122
* Avoid a system call in 'gettid'.Elliott Hughes2014-06-021-17/+0
| | | | | | | | | | | | | 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
* Fix x86 cfi directives for syscalls.Christopher Ferris2014-05-29184-567/+865
| | | | | | | | The syscall generation always used 4 bytes for each push cfi directive. However, the first push should always use an offset of 8 bytes, each subsequent push after that is only 4 bytes though. Change-Id: Ibaabd107f399ef67010b9a08213783957c2f74a9
* Revert "Revert "Lose the hand-written futex assembler.""Elliott Hughes2014-05-281-42/+0
| | | | | | | | | | | | | | | | | | | | | | 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
* Revert "Lose the hand-written futex assembler."Narayan Kamath2014-05-281-0/+42
| | | | | | | | | | 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
* Lose the hand-written futex assembler.Elliott Hughes2014-05-221-42/+0
| | | | | | | Also stop exporting 'futex'. Bug: 12250341 Change-Id: Icc4fa4296cd04dfe0d1061822c69e2eb40c3433a
* Remove the tkill(2) stub.Elliott Hughes2014-05-221-26/+0
| | | | | | | | | 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
* Remove __syslog; we have the public klogctl API.Elliott Hughes2014-05-201-30/+0
| | | | | Bug: 11156955 Change-Id: I5c2cc02f39f76dd32984135f5c12c10bf2853796
* Remove perf_event_open.Elliott Hughes2014-05-201-38/+0
| | | | | | | | | 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
* Mark sockets on creation (socket()) and accept4().Sreeram Ramachandran2014-05-193-31/+4
| | | | | | Remove the separate syscall for accept() and implement it as accept4(..., 0). Change-Id: Ib0b8f5d7c5013b91eae6bbc3847852eb355c7714
* Hide __signalfd4, used to implement signalfd(3).Elliott Hughes2014-05-161-2/+2
| | | | | Bug: 11156955 Change-Id: I50842279cb5b32ec8bd45193435574e415cd806e
* Mark sockets on accept().Sreeram Ramachandran2014-05-141-2/+2
| | | | | | (cherry picked from commit 58b1f3f6a30a660ad81637c2b50382c3d279243b) Change-Id: I5d09be413cf720fbed905f96313b007997ada76c
* Introduce netd_client, a dynamic library that talks to netd.Sreeram Ramachandran2014-05-131-2/+2
| | | | | | | | | | | 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
* Implement _Exit(3).Elliott Hughes2014-04-081-0/+3
| | | | Change-Id: Ida6ac844cc87d38c9645b197dd8188bb73e27dbe
* Add accept4() syscallAndrei Emeltchenko2014-03-261-0/+27
| | | | | | Add accept4() using SYSCALLS.TXT and gensyscall Change-Id: I6f19f29144186d15d46423e10f2cc4b4223719c6
* Add recvmmsg and sendmmsg syscalls.Guillaume Ranquet2014-02-272-0/+54
| | | | | | | | | 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
* Fix build by avoiding the _C_LABEL macro.Elliott Hughes2014-02-182-4/+4
| | | | Change-Id: Ide367c2b65071388bd95fbc81a4ed6ae94aec4e4
* Implement some of the missing LFS64 support.Elliott Hughes2014-02-182-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Add fallocate/fallocate64/posix_fallocate/posix_fallocate64.Elliott Hughes2014-02-031-0/+42
| | | | | | Bug: 5287571 Bug: 12612860 Change-Id: I4501b9c6cdf9a830336ce0b3afc4ea716b6a0f6f
* Fix <sys/resource.h>.Elliott Hughes2014-01-091-0/+34
| | | | | | | | | | | | | | | | | | 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
* Add cfi directives to x86 syscalls.Christopher Ferris2014-01-06184-0/+668
| | | | | | | | | Modify the syscalls script to generate the cfi directives for x86 syscalls. Update the x86 syscalls. Change-Id: Ia1993dc714a7e79f917087fff8200e9a02c52603
* Clean up <sched.h>.Elliott Hughes2014-01-021-0/+23
| | | | | | | | 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
* Clean up forking and cloning.Elliott Hughes2013-11-191-32/+0
| | | | | | | | | 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
* Fix pthread_join.Elliott Hughes2013-11-181-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Stop using the non-uapi <linux/err.h> header file.Elliott Hughes2013-11-07192-576/+192
| | | | | | | We only need it for MAX_ERRNO, and it's time we had somewhere to put the little assembler utility macros we've been putting off writing. Change-Id: I9354d2e0dc47c689296a34b5b229fc9ba75f1a83
* Clean up the 32-bit kernel support, fix LP64 fcntl declaration.Elliott Hughes2013-11-061-28/+0
| | | | | | | | | | | | | | 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
* Fix the exit syscall stub's name.Elliott Hughes2013-10-241-2/+2
| | | | | | | | | | | | | 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
* Remove dependencies on obsolete __ARCH_WANT_SYSCALL_DEPRECATED system calls.Elliott Hughes2013-10-248-116/+31
| | | | | | (aarch64 kernels don't have these system calls.) Change-Id: I6f64075aa412f71520f2df71c3d69b647f91c1ca
* Remove dependencies on obsolete __ARCH_WANT_SYSCALL_NO_FLAGS syscalls.Elliott Hughes2013-10-234-33/+14
| | | | | | | | (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
* Move away from the __ARCH_WANT_SYSCALL_NO_AT system calls.Elliott Hughes2013-10-2215-290/+33
| | | | | | | | 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
* Fix sigaction(3) for 64-bit.Elliott Hughes2013-10-171-2/+2
| | | | | | | Also clean up <signal.h> and revert the hacks that were necessary for 64-bit in linker/debugger.cpp until now. Change-Id: I3b0554ca8a49ee1c97cda086ce2c1954ebc11892
* Sort the syscalls.mk files, give all generated files the same header.Elliott Hughes2013-10-16209-209/+418
| | | | | | No non-comment changes to the .S files. Change-Id: Iafcfd004c3ea92b64268f80ab16df615b97cefac
* Switch sigpending over to rt_sigpending.Elliott Hughes2013-10-161-4/+7
| | | | Change-Id: I7b28984796b5fb343cfbcc47e0afc3a84293d417
* Fix sigsuspend to use rt_sigsuspend on all platforms.Elliott Hughes2013-10-151-8/+5
| | | | Change-Id: I981c1a66d35480d4457a0a08a1b042dac94daa5b
* Clean up the sigprocmask/pthread_sigmask implementation.Elliott Hughes2013-10-151-27/+0
| | | | | | | | | | | 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
* Clean up the cpuacct cruft.Elliott Hughes2013-10-093-6/+6
| | | | Change-Id: I6ed63af8dfc2368e211420389fa8af4d5dc0908f
* Regenerate the system call stubs (to get x86_64).Elliott Hughes2013-10-01210-210/+210
| | | | | | | | This touches the x86 stubs too because arm, x86, and x86_64 now all share the same header (at a source level), which causes a reordering of the #include lines. Change-Id: If9a1e2b2718bd41d8399fea748bce672c513ef84
* Ensure we have the off64_t variant of every function that takes an off_t.Elliott Hughes2013-09-192-0/+57
| | | | Change-Id: Ib2eee0cf13162be3b62559b84e90c6dcf5aab1c3
* libc: add swapon and swapoff syscallsRom Lemarchand2013-06-252-0/+45
| | | | | Change-Id: Ie79dc8e3f2ff1cd427dd6d95e3850920c4b407b0 Signed-off-by: Rom Lemarchand <romlem@google.com>
* libc: add timerfd callsTodd Poynor2013-05-143-0/+78
| | | | | | (cherry-pick of 04c0ac14a49e0969333008a9522b64046d58fbdc.) Change-Id: I06d0b6c2a8781602362b81f48faf1cca76b9ec05
* The SYS_ constants should cover all __NR_ values.Elliott Hughes2013-03-21203-203/+203
| | | | | | | | | | | <sys/linux-syscalls.h> only contains constants for the syscalls we're generating stubs for. We want all the syscalls available on the architecture in question. Keep using <sys/linux-syscalls.h> on ARM for now because the __NR_ARM_set_tls and __NR_ARM_cacheflush values aren't in <asm/unistd.h>. Change-Id: I66683950d87d9b18d6107d0acc0ed238a4496f44
* Expose wait4 as wait4 rather than __wait4.Elliott Hughes2013-03-211-2/+2
| | | | | | This helps strace(1) compile with one fewer hack. Change-Id: I5296d0cfec5546709cda990abd705ad33d7c4626