Commit graph

178 commits

Author SHA1 Message Date
Dan Albert
6a918870ba Revert "Replaces vfork() implementation with fork()"
We're getting cold feet on this one... let's put it back.

This reverts commit 210331d976.

Change-Id: I6b0d3c2b1dbf7f1dc9566979a91b7504c2189269
2014-08-05 14:11:38 -07:00
Elliott Hughes
79310994d2 Implement <sys/fsuid.h>.
Change-Id: I1e5e50444a1b5a430ba5b5d9b8b1d91219af5e92
2014-07-30 15:19:29 -07:00
Elliott Hughes
9c07aee83b Clean up some misinformation around prctl.
prctl shouldn't be in <unistd.h>.

Change-Id: I29609fc91c033e1ad143b75d9b4eb17aefbd63d6
2014-07-18 16:15:32 -07:00
Elliott Hughes
625993dfbb Use VDSO for clock_gettime(2) and gettimeofday(2).
Bug: 15387103
Change-Id: Ifc3608ea65060c1dc38120b10b6e79874f182a36
2014-07-16 14:27:43 -07:00
Elliott Hughes
3f525d41c2 Add splice, tee, and vmsplice.
Change-Id: I5f43380b88d776a8bb607b47dbbc5db5a2fe6163
2014-06-24 19:03:31 -07:00
Elliott Hughes
7086ad6919 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
2014-06-20 09:06:57 -07:00
Dan Albert
607341e226 Remove ioprio_get(2) and ioprio_set(2) from LP64.
Bug: 11156955
Change-Id: I07b596d85e4bd6347d488d1a92c8d0a00b5ef3b3
2014-06-12 18:10:13 -07:00
Dan Albert
440bd6bcc3 Merge "Replaces vfork() implementation with fork()" 2014-06-10 22:08:45 +00:00
Dan Albert
210331d976 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
2014-06-10 21:38:52 -07:00
Elliott Hughes
3d5cb30d23 Remove getdents from bionic.
Bug: 11156955
Change-Id: I6c306989801be552d85fba8a50dcdc79282fb9d2
2014-06-06 15:05:58 -07:00
Elliott Hughes
5d9a7ba0dc 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
2014-06-02 10:32:55 -07:00
Elliott Hughes
b30aff405a 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 75c55ff84e.

Bug: 15195455
Change-Id: I6ffb13e5cf6a35d8f59f692d94192aae9ab4593d
2014-05-28 18:31:15 -07:00
Narayan Kamath
75c55ff84e Revert "Lose the hand-written futex assembler."
This reverts commit ced906c849.

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

bug: 15195455

Change-Id: I5d6bbb389ecefb0e33a5237421a9d56d32a9317c
2014-05-28 18:03:01 +00:00
Elliott Hughes
ced906c849 Lose the hand-written futex assembler.
Also stop exporting 'futex'.

Bug: 12250341
Change-Id: Icc4fa4296cd04dfe0d1061822c69e2eb40c3433a
2014-05-22 19:49:11 -07:00
Elliott Hughes
6e599a904b 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
2014-05-22 13:41:36 -07:00
Elliott Hughes
46a55a4478 Remove __syslog; we have the public klogctl API.
Bug: 11156955
Change-Id: I5c2cc02f39f76dd32984135f5c12c10bf2853796
2014-05-20 21:01:00 -07:00
Elliott Hughes
4e631ba568 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
2014-05-20 16:24:55 -07:00
Sreeram Ramachandran
903b78873a Mark sockets on creation (socket()) and accept4().
Remove the separate syscall for accept() and implement it as accept4(..., 0).

Change-Id: Ib0b8f5d7c5013b91eae6bbc3847852eb355c7714
2014-05-19 15:19:16 -07:00
Elliott Hughes
7222b1b594 Hide __signalfd4, used to implement signalfd(3).
Bug: 11156955
Change-Id: I50842279cb5b32ec8bd45193435574e415cd806e
2014-05-16 15:47:29 -07:00
Sreeram Ramachandran
8f0cd8aa22 Mark sockets on accept().
(cherry picked from commit 58b1f3f6a30a660ad81637c2b50382c3d279243b)

Change-Id: I5d09be413cf720fbed905f96313b007997ada76c
2014-05-14 11:10:22 -07:00
Sreeram Ramachandran
ceb5bd787c 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
2014-05-13 11:30:03 -07:00
Elliott Hughes
dcbef06ce6 Remove the useless indirection in mips' __set_tls.
Change-Id: I12e9d6716c42ccbccc9a186441aca0736bb22d05
2014-05-12 16:11:06 -07:00
Elliott Hughes
9f525644df Implement _Exit(3).
Change-Id: Ida6ac844cc87d38c9645b197dd8188bb73e27dbe
2014-04-08 17:16:13 -07:00
Andrei Emeltchenko
8f2a30a92a Add accept4() syscall
Add accept4() using SYSCALLS.TXT and gensyscall

Change-Id: I6f19f29144186d15d46423e10f2cc4b4223719c6
2014-03-26 15:50:01 +02:00
Elliott Hughes
4b558f50a4 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
2014-03-07 16:49:46 -08:00
Guillaume Ranquet
6ff0c75c83 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
2014-02-27 14:29:01 -08:00
Elliott Hughes
db1ea34748 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
2014-02-18 15:39:24 -08:00
Chris Dearman
5043212b76 [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>
2014-02-06 15:39:38 -08:00
Elliott Hughes
f64b8ea09d Add fallocate/fallocate64/posix_fallocate/posix_fallocate64.
Bug: 5287571
Bug: 12612860
Change-Id: I4501b9c6cdf9a830336ce0b3afc4ea716b6a0f6f
2014-02-03 16:20:46 -08:00
Colin Cross
d1973ca513 bionic: rename aarch64 target to arm64
Rename aarch64 build targets to arm64.  The gcc toolchain is still
aarch64.

Change-Id: Ia92d8a50824e5329cf00fd6f4f92eae112b7f3a3
2014-01-23 18:35:39 -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
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
Serban Constantinescu
ed76a9361c 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>
2013-12-12 10:41:52 -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
36d6188f8c 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
2013-11-19 14:08:54 -08:00
Elliott Hughes
877ec6d904 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
2013-11-18 19:48:11 -08:00
Chris Dearman
effaa7824d [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
2013-11-14 16:53:15 -08:00
Elliott Hughes
062092543f 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
2013-11-06 16:33:39 -08:00
Elliott Hughes
8fbf8deb34 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
2013-11-06 13:10:37 -08:00
Serban Constantinescu
feaa89a1bc 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>
2013-10-28 16:16:34 -07:00
Elliott Hughes
6b53c2349a 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
2013-10-24 22:41:50 -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
Elliott Hughes
cac7b9d6ec 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
2013-10-23 09:48:29 -07:00
Elliott Hughes
f8fcfbc85a 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
2013-10-22 16:31:01 -07:00
Elliott Hughes
9ea4d5f3a8 Fix the x86_64 vfork implementation.
Change-Id: I599507f5058e6196dc2d5b5653d06d5135dd8ac1
2013-10-18 18:21:11 -07:00
Elliott Hughes
a6519d6306 Add missing aliases for off64_t functions in 64-bit land.
See the comment in SYSCALLS.TXT for an explanation.

Change-Id: I33d4056e84160c3cca74b7b588e9924a569753ed
2013-10-17 16:56:40 -07:00
Elliott Hughes
c7e9b23317 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
2013-10-17 11:36:55 -07:00
Elliott Hughes
40d105ccb3 Switch sigpending over to rt_sigpending.
Change-Id: I7b28984796b5fb343cfbcc47e0afc3a84293d417
2013-10-16 14:07:01 -07:00
Elliott Hughes
c9da332cce 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
2013-10-15 18:18:58 -07:00
Elliott Hughes
1f5af926fa Fix sigsuspend to use rt_sigsuspend on all platforms.
Change-Id: I981c1a66d35480d4457a0a08a1b042dac94daa5b
2013-10-15 18:15:19 -07:00
Elliott Hughes
19e62325c2 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
2013-10-15 11:23:57 -07:00
Elliott Hughes
232163cf70 Clean up the cpuacct cruft.
Change-Id: I6ed63af8dfc2368e211420389fa8af4d5dc0908f
2013-10-09 17:35:36 -07:00
H.J. Lu
6fe4e87954 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>
2013-10-07 21:37:12 +04:00
Elliott Hughes
4906e5653c 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
2013-10-04 14:55:30 -07:00
Pavel Chupin
9a4127bb0a 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>
2013-10-01 13:56:21 -07:00
Pavel Chupin
f12a18b850 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>
2013-10-01 13:27:07 -07:00
Elliott Hughes
d612165c67 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
2013-09-26 08:57:17 -07:00
Elliott Hughes
5e52279256 Simplify the SYSCALLS.TXT format.
This will make addition of new architectures less unpleasant.

Change-Id: I77c866a63b686e8e70709d08fcf52e8a2d37310a
2013-09-24 00:35:31 -07:00
Elliott Hughes
b4f7616fd6 Ensure we have the off64_t variant of every function that takes an off_t.
Change-Id: Ib2eee0cf13162be3b62559b84e90c6dcf5aab1c3
2013-09-19 16:27:24 -07:00
Rom Lemarchand
d206b560e7 libc: add swapon and swapoff syscalls
Change-Id: Ie79dc8e3f2ff1cd427dd6d95e3850920c4b407b0
Signed-off-by: Rom Lemarchand <romlem@google.com>
2013-06-25 13:18:03 -07:00
Todd Poynor
4200e6203a libc: add timerfd calls
(cherry-pick of 04c0ac14a49e0969333008a9522b64046d58fbdc.)

Change-Id: I06d0b6c2a8781602362b81f48faf1cca76b9ec05
2013-05-14 14:45:02 -07:00
Elliott Hughes
a51916b58b 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
2013-04-03 10:08:09 -07:00
Elliott Hughes
cda62094ef 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
2013-03-22 13:53:43 -07:00
Elliott Hughes
17a8b0db63 Expose wait4 as wait4 rather than __wait4.
This helps strace(1) compile with one fewer hack.

Change-Id: I5296d0cfec5546709cda990abd705ad33d7c4626
2013-03-21 16:14:06 -07:00
Elliott Hughes
0493a6f7be Regenerate NOTICE files.
Also clean up some obsolete cruft.

Change-Id: Iec3b36f6607f7a08b72de99294ed5b6cd910dd5f
2013-03-07 11:51:10 -08:00
Rom Lemarchand
a4b2dc016f 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 0c11611c11, modified to
work with older versions of GCC still in use on some branches.)

Change-Id: I4c6c3f12199559af8be63f93a5336851b7e63355
2013-01-10 13:14:46 -08:00
Chris Dearman
58aaaa730b [MIPS] Fix the MIPS getsid system call
Change-Id: I30a27941125bccb35d73a572a729ecf7dd555389
Signed-off-by: Chris Dearman <chris@mips.com>
2012-11-29 12:05:25 -08:00
Shuo Gao
4e75c4b2d7 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>
2012-10-11 10:24:51 -07:00
Elliott Hughes
1ad05db9ce Add mlockall and munlockall for Google TV.
Change-Id: I10e961d701e74aab07211ec7975f61167e387853
2012-09-06 11:24:45 -07:00
Irina Tirdea
1ad10a566e 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>
2012-09-03 01:38:34 +03:00
Elliott Hughes
316ee626b7 Merge "MIPS support to sigsuspend and sigwait routines" 2012-08-10 15:05:36 -07:00
Jeff Sharkey
e36c826f7a Add unshare() syscall.
(cherry-pick of 5467f25f82934d611c60f8bc57a05114f3c1bea0.)

Bug: 6925012
Change-Id: Ic5ea2fbd606311087de05d7a3594df2fa9b2fef9
2012-08-10 12:57:43 -07:00
Raghu Gandham
abd10011a7 MIPS support to sigsuspend and sigwait routines
Change-Id: I870e798ed7eac5a8c74e5784a670f3a4f24331a9
2012-08-09 18:51:19 -07:00
Elliott Hughes
dbd5ecad26 resolved conflicts for merge of e5408907 to jb-dev-plus-aosp
Change-Id: If4c3f51bf87b28da8074be2e46ae772a374b266f
2012-05-09 13:53:37 -07:00
Raghu Gandham
1fa0d84957 [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>
2012-05-09 11:46:28 -07:00
Elliott Hughes
f848321c4f resolved conflicts for merge of ef987656 to master
Change-Id: I3854de8f4cddaf344444efa6f9da027642a237d9
2012-04-16 14:26:43 -07:00
Elliott Hughes
8ecb4770a0 resolved conflicts for merge of 6b8fd054 to master
Change-Id: Ifc5a10d9c2f7764ad80d64cc552aad81d5fbf5eb
2012-04-16 14:16:42 -07:00
Elliott Hughes
4994deaef5 Merge "Bionic: Fix wrong prototype of system call clock_nanosleep" 2012-04-16 09:09:05 -07:00
Jack Ren
d515ce465b 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>
2012-04-16 23:53:05 +08:00
Jack Ren
41070dd15f 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>
2012-04-16 23:45:36 +08:00
Kenny Root
f0ec06ba60 Add faccessat to syscall list
Change-Id: I427a18811089cb280769ac8da3ed8adc00a65a10
2012-04-13 15:45:42 -07:00
Ben Cheng
1a823691a2 Update kernel headers and add syscall "perf_event_open"
Change-Id: I43f12b727881df002a8524f2738586c043833bae
2012-03-13 12:28:40 -07:00
Jean-Baptiste Queru
7c38f53d19 am 7f28e0b4: Merge "Clean up the remnants of SuperH support"
* commit '7f28e0b4501de7c4f8f627fd3e4be323d737ae82':
  Clean up the remnants of SuperH support
2012-02-29 15:38:55 -08:00
Raghu Gandham
b69060f1ae Clean up the remnants of SuperH support 2012-02-09 15:58:46 -08:00
Jean-Baptiste Queru
25b7a16a6e Merge c4cb87f3
Change-Id: I4cc14eba43fde75a7702fdc7ad07d3d949e9c092
2012-02-01 09:46:08 -08:00
Jean-Baptiste Queru
c4cb87f367 Merge 5b892aa7
Change-Id: Ic82bc2866bdb0c93822c94281301fa127fd4bb0c
2012-02-01 07:12:13 -08:00
David 'Digit' Turner
70b1668a76 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>
2012-01-31 20:28:23 +01:00
Jean-Baptiste Queru
73fa5fdaf9 Merge 2f80f07d
Change-Id: Iff51b8530dbee01499ba4af0ecd6ab837c8c94fb
2012-01-20 16:47:01 -08:00
Jean-Baptiste Queru
2f80f07d81 am 23f56bbb: Merge "Add extended attribute (xattr) system call wrappers to bionic."
* commit '23f56bbb6ae053996dd821f29379aea0c7166055':
  Add extended attribute (xattr) system call wrappers to bionic.
2012-01-20 11:54:47 -08:00
Stephen Smalley
5eb686d105 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
2012-01-18 08:02:23 -05:00
Nick Kralevich
023e5409df am 06f51ba1: am f44de270: add personality() system call.
* commit '06f51ba1af2fafeec7fdfcba5d635bd001a31b3e':
  add personality() system call.
2012-01-17 13:09:53 -08:00
Nick Kralevich
06f51ba1af am f44de270: add personality() system call.
* commit 'f44de270bba32c9b1b5eff8a34be07b10ddff238':
  add personality() system call.
2012-01-17 11:45:25 -08:00
Nick Kralevich
f44de270bb add personality() system call.
Change-Id: Ie899def8ea1d705930ed83adae1343c1353e7c57
2012-01-13 15:50:40 -08:00
Bruce Beare
6519c8124e am e30e9093: sreadahead: adding readahead system call into bionic libc
* commit 'e30e909363c5c706f394050d9cd00ce222caadbf':
  sreadahead: adding readahead system call into bionic libc
2012-01-03 18:37:28 -08:00
Bruce Beare
e30e909363 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>
2012-01-03 15:18:04 -08:00
Jeff Brown
10c8ce59a4 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
2011-11-18 16:40:48 -08:00
David 'Digit' Turner
4aa321538a am 2cae7967: Merge "libc: Fix prctl() declaration."
* commit '2cae7967e6049e45eaef71207481b6f8b2456025':
  libc: Fix prctl() declaration.
2011-06-06 12:27:10 -07:00
David 'Digit' Turner
b083bb57f5 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
2011-05-26 02:46:41 +02:00
Ken Sumrall
ae2d5ba314 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
2011-03-24 18:18:48 -07:00
David 'Digit' Turner
fc2693110e 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)
2011-02-03 18:07:41 +01:00