Commit Graph

264 Commits

Author SHA1 Message Date
Nick Kralevich
8ffe08c86b am fdd6dfa8: am 2c5153b0: libc: add getauxval()
* commit 'fdd6dfa863ea73251b5d59990e239854c31ecee3':
  libc: add getauxval()
2013-01-11 17:04:04 -08:00
Nick Kralevich
2c5153b043 libc: add getauxval()
Add support for getauxval().  This method allows a program an easy way
to retrieve information from the kernel auxiliary vector, and will
hopefully replace other clumsy ways of accessing this same information.

This particular function was also added to glibc in glibc 2.16.
See the following URLs for more details.

  * http://lwn.net/Articles/519085/
  * http://www.gnu.org/software/libc/manual/html_node/Auxiliary-Vector.html

This change is a prerequisite for bug 7959813.

Bug: http://code.google.com/p/android/issues/detail?id=38441
Change-Id: Iba19d899df334bddc6f4899077ece2fc87564ea8
2013-01-11 16:44:15 -08:00
Elliott Hughes
73dd37d8fe am 34c7a3c2: am 0d3700d9: Merge "Only have one copy of the kernel_sigset_t hack, and add more tests."
* commit '34c7a3c2b0ec50a749e25bd786e670025a6f1c5b':
  Only have one copy of the kernel_sigset_t hack, and add more tests.
2013-01-11 10:54:25 -08:00
Elliott Hughes
7e29f81163 am 4ff6fa97: am 2bbb8fac: Merge "Add signalfd call to bionic"
* commit '4ff6fa97e7cf247e17600cf0d64911c1579df841':
  Add signalfd call to bionic
2013-01-11 10:54:02 -08:00
Elliott Hughes
c5d028fc91 Only have one copy of the kernel_sigset_t hack, and add more tests.
Change-Id: I377522fcba6fb4b5fd2754ab15b091014bd7c16f
2013-01-10 14:42:14 -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
Elliott Hughes
19dd1567a0 Revert "Add signalfd call to bionic"
This reverts commit 0c11611c11

Change-Id: I1a2beae7ed66ec995fdf6c96c53c35598ac6cde0
2013-01-10 10:47:58 -08:00
Rom Lemarchand
0c11611c11 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
2013-01-10 10:25:42 -08:00
Elliott Hughes
e9d6575e10 am 1287d106: am fb62558b: Merge "Define _POSIX_MONOTONIC_CLOCK and implement sysconf(_SC_MONOTONIC_CLOCK)."
* commit '1287d106ed235e7366912bc7ab09df532848dd7a':
  Define _POSIX_MONOTONIC_CLOCK and implement sysconf(_SC_MONOTONIC_CLOCK).
2013-01-02 16:35:08 -08:00
Elliott Hughes
a55f63083f Define _POSIX_MONOTONIC_CLOCK and implement sysconf(_SC_MONOTONIC_CLOCK).
Bug: http://code.google.com/p/android/issues/detail?id=39680
Change-Id: I11cf10a66f9d305868a725f04f581099fb88bbfc
2013-01-02 14:23:43 -08:00
Elliott Hughes
42d7a26d23 am f822e7f6: am 0521ff82: Merge "Use pthread_kill() in raise()"
* commit 'f822e7f68eec30bb175ccb46cd379f4a060b6c74':
  Use pthread_kill() in raise()
2012-12-10 11:42:06 -08:00
Chris Dearman
d8a5a6f513 Use pthread_kill() in raise()
raise() should use pthread_kill() in a pthreads environment.
For bionic this means it should always be used.

Change-Id: Ic679272b664d2b8a7068b628fb83a9f7395c441f
2012-12-10 11:20:57 -08:00
Elliott Hughes
dcb8209409 am 7beaa502: am 16c61f08: Merge "Reduce the exposure of the __set_errno implementation detail."
* commit '7beaa5024f083431ca74ee73b01f5ad1e5b4198f':
  Reduce the exposure of the __set_errno implementation detail.
2012-11-30 14:46:50 -08:00
Elliott Hughes
4a9e837840 Reduce the exposure of the __set_errno implementation detail.
Change-Id: I395e1b46a9491e34fc53e71853e932ea90b3d1cc
2012-11-30 12:05:18 -08:00
Elliott Hughes
2e51dc444f am 4835e6ef: am 97b70b2b: Merge "Replace .S version of x86 crtfiles with .c version"
* commit '4835e6ef519fc941651bbc13909cff971a6ec81b':
  Replace .S version of x86 crtfiles with .c version
2012-11-30 10:16:06 -08:00
Pavel Chupin
20c4a3a8ee Replace .S version of x86 crtfiles with .c version
This patch replaces .S versions of x86 crtfiles with .c which are much
easier to support. Some of the files are matching .c version of Arm
crtfiles. x86 files required some cleanup anyway and this cleanup actually
led to matching Arm files.

I didn't change anything to share the same crt*.c between x86 and Arm. I
prefer to keep them separate for a while in case any change is required
for one of the arch, but it's good thing to do in the following patches.

Change-Id: Ibcf033f8d15aa5b10c05c879fd4b79a64dfc70f3
Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>
2012-11-30 17:41:25 +04:00
Elliott Hughes
c7358ee57c am 743a273e: am 1f21ece4: Merge "Clean up the <libgen.h> implementation a little, bring in tests."
* commit '743a273e40e49c199d79462338fc606ae12c999f':
  Clean up the <libgen.h> implementation a little, bring in tests.
2012-10-30 10:11:44 -07:00
Elliott Hughes
d4834a217e am 40e467ec: am 33c4a3ad: Merge "libc: Fix alphasort() signature (and implementation)."
* commit '40e467ec668b59be25491bd44bf348a884d6a68d':
  libc: Fix alphasort() signature (and implementation).
2012-10-30 10:11:41 -07:00
Elliott Hughes
96b52e104a am a67cedb5: am 9e783963: Merge "Clean up the implementation of the <dirent.h> functions."
* commit 'a67cedb52cb57f116a545482bddb979d995fd634':
  Clean up the implementation of the <dirent.h> functions.
2012-10-30 10:11:39 -07:00
Elliott Hughes
58b575485c Clean up the <libgen.h> implementation a little, bring in tests.
Most of these tests were in system/extras, but I've added more to cover other
cases explicitly mentioned by POSIX.

Change-Id: I5e8d77e4179028d77306935cceadbb505515dcde
2012-10-29 14:27:10 -07:00
David 'Digit' Turner
c30396f5f2 libc: Fix alphasort() signature (and implementation).
The declaration for alphasort() in <dirent.h> used the deprecated:

  int alphasort(const void*, const void*);

while both Posix and GLibc use instead:

  int alphasort(const struct dirent** a, const struct dirent** b);

See: http://pubs.opengroup.org/onlinepubs/9699919799/functions/alphasort.html

This patch does the following:

- Update the declaration to match Posix/GLibc
- Get rid of the upstream BSD code which isn't compatible with the new
  signature.
- Implement a new trivial alphasort() with the right signature, and
  ensure that it uses strcoll() instead of strcmp().
- Remove Bionic-specific #ifdef .. #else .. #endif block in
  dirent_test.cpp which uses alphasort().

Even through strcoll() currently uses strcmp(), this does the right
thing in the case where we decide to update strcoll() to properly
implement locale-specific ordered comparison.

Change-Id: I4fd45604d8a940aaf2eb0ecd7d73e2f11c9bca96
2012-10-29 07:44:27 -07:00
Elliott Hughes
063cfb2084 Clean up the implementation of the <dirent.h> functions.
Change-Id: I3c647cc9588525afc41fee90ee468d58cd13503a
2012-10-26 16:42:06 -07:00
Elliott Hughes
0f96dd8dcb am df7f24f3: am 7b68e3f7: Merge "Per-thread -fstack-protector guards for x86."
* commit 'df7f24f310ee3ceb1dc9413d59d5a8816eb584ef':
  Per-thread -fstack-protector guards for x86.
2012-10-25 12:23:56 -07:00
Elliott Hughes
ad88a08631 Per-thread -fstack-protector guards for x86.
Based on a pair of patches from Intel:

  https://android-review.googlesource.com/#/c/43909/
  https://android-review.googlesource.com/#/c/44903/

For x86, this patch supports _both_ the global that ARM/MIPS use
and the per-thread TLS entry (%gs:20) that GCC uses by default. This
lets us support binaries built with any x86 toolchain (right now,
the NDK is emitting x86 code that uses the global).

I've also extended the original tests to cover ARM/MIPS too, and
be a little more thorough for x86.

Change-Id: I02f279a80c6b626aecad449771dec91df235ad01
2012-10-25 12:04:03 -07:00
Elliott Hughes
4cdc426207 am 60c7ac26: am d0f2b7e7: Merge "More upstream NetBSD upgrades."
* commit '60c7ac262241588f7942ca068f33d706c8fe5cc4':
  More upstream NetBSD upgrades.
2012-10-23 17:29:47 -07:00
Elliott Hughes
ab44f52202 More upstream NetBSD upgrades.
Change-Id: Idb781d37de3b05585271d7d258ecffd5ba87d0b8
2012-10-23 16:05:09 -07:00
Elliott Hughes
217e616772 am 45f07555: am e3dbe1e3: Merge "Upgrade more functions to the current upstream NetBSD copy."
* commit '45f075556b26cfe91b1b7e1299b54f0328a06acb':
  Upgrade more functions to the current upstream NetBSD copy.
2012-10-23 13:58:25 -07:00
Elliott Hughes
e8bcca3a2c Upgrade more functions to the current upstream NetBSD copy.
Change-Id: Ie0b3f8b3fccef28609eb210434413ebd51d6ef45
2012-10-23 12:29:53 -07:00
Elliott Hughes
1d212fa6eb am 4280143d: am fb93e6a5: Merge "Move setlocale(3) and the wchar stubs over to .cpp."
* commit '4280143d371eae2123a5d8c4d8779db159ecd1e2':
  Move setlocale(3) and the wchar stubs over to .cpp.
2012-10-22 18:08:54 -07:00
Elliott Hughes
29c7f0b4d1 Move setlocale(3) and the wchar stubs over to .cpp.
Also separate out the C++ files so we can use -Werror on them. I'd
rather wait for LOCAL_CPPFLAGS to be in AOSP, but this also lets us
see which files still need to be sorted into one bucket or the other.

Change-Id: I6acc1f7c043935c70a3b089f705d218b9aaaba0a
2012-10-22 17:05:27 -07:00
Elliott Hughes
8b8cc88d39 am 75f33adc: am 4e457759: Merge "Move the FORTIFY_SOURCE helpers over to .cpp."
* commit '75f33adcb1f845ae121eb5508b120aaaa9f7a217':
  Move the FORTIFY_SOURCE helpers over to .cpp.
2012-10-22 16:00:03 -07:00
Elliott Hughes
4035b7a321 Move the FORTIFY_SOURCE helpers over to .cpp.
Change-Id: Ib5067d51b983cac7760c975becce7fe2408ead04
2012-10-22 15:32:01 -07:00
Elliott Hughes
c0e8400361 am 79c6a8d2: am ca7466d2: Merge "Make bionic\'s dependency on the tzdata explicit."
* commit '79c6a8d2b163e40eb6f19bbf8f59eb85fb7996e6':
  Make bionic's dependency on the tzdata explicit.
2012-10-18 13:40:19 -07:00
Elliott Hughes
914d8d4cff Make bionic's dependency on the tzdata explicit.
Also stop building the obsolete three files, now bionic and libcore
both use the new single file.

Bug: 7012465
Change-Id: I1b9b49af7382c57b6cb8820c2275e6d4044b2bb6
2012-10-18 12:23:34 -07:00
Elliott Hughes
f0a9cd7847 am 92e6de6f: am b95ad82f: am 95a2a7f3: Merge "Fix MIPS build."
* commit '92e6de6f940fee6362dd306ad77c6d7bfa56e4cb':
  Fix MIPS build.
2012-10-02 11:34:14 -07:00
Elliott Hughes
857fed50cb Fix MIPS build.
ARM and x86 have custom memcpy implementations, but MIPS relies on the generic
one, which I recently moved.

Change-Id: I9e49243f63b27a4123f2c6623d6286ec82d333c7
2012-10-02 11:20:07 -07:00
Elliott Hughes
6cdf8dd025 am 80a29832: am 90172541: am b98204a9: Merge "Move non-upstream code into the libc/bionic directory."
* commit '80a298327299aa28b564941f90818911023ae544':
  Move non-upstream code into the libc/bionic directory.
2012-10-02 09:28:31 -07:00
Elliott Hughes
a89864a20b Move non-upstream code into the libc/bionic directory.
I'll need at least one more pass, because there's some upstream code
lurking in libc/bionic, but this is still a step in the right direction.

Change-Id: I55927315972da8327ae01c5240ed587db17e8462
2012-10-01 17:35:49 -07:00
Elliott Hughes
b5d5173139 am a54d08a7: am a428bc12: am fe712e6c: Merge "Upgrade seed48 too."
* commit 'a54d08a7c15e15f24d94ca6fb97329134d4441a2':
  Upgrade seed48 too.
2012-10-01 14:48:57 -07:00
Elliott Hughes
b28c547aa4 am 6ed5bc12: am b650111a: am cd195eba: Merge "Upgrade to the current NetBSD rand implementation."
* commit '6ed5bc12dac544004f8e79b6393b2a8e260a7cc1':
  Upgrade to the current NetBSD rand implementation.
2012-10-01 14:16:53 -07:00
Elliott Hughes
31a1060a5a Upgrade seed48 too.
Missed this in 774c7f54ff.

Change-Id: Ic24fd67f003d0e2d192cfb08f96f63024ca817eb
2012-10-01 14:14:21 -07:00
Elliott Hughes
774c7f54ff Upgrade to the current NetBSD rand implementation.
Also add basic unit tests.

Change-Id: I7fc7ef61d47c1e8fdf8b8eff67a635220c3afd56
2012-10-01 13:53:41 -07:00
Elliott Hughes
2e223d208f am fb1e192e: am 72b08af3: am f9163dd1: Merge "Add getdelim(3) and getline(3) to bionic"
* commit 'fb1e192e12fb4047bf5f01ccf0fd4e5644743adb':
  Add getdelim(3) and getline(3) to bionic
2012-09-28 09:57:11 -07:00
Irina Tirdea
eac9eb462e Add getdelim(3) and getline(3) to bionic
Some userspace programs (e.g. perf) need getline.

Changes:
() add getdelim.c, getline.c from NetBSD (http://netbsd.org/) under the
NetBSD Foundation's (TNF) license ("2 clause" Berkeley-style license).
() add stub for reentrant.h header that is needed by getdelim.c
() add tests for getdelim(3) and getline(3).
() update NOTICE file.

Change-Id: I22ed82dd5904b9d7a3695535c04f502be3c27c5d
Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
2012-09-27 11:38:57 -07:00
Elliott Hughes
0a2d31838f am 66569e3d: am a48d5e5f: am 855dde44: Merge "Fix tmpfile(3)."
* commit '66569e3d53643fe4682091c4e11c25449e9b7fdc':
  Fix tmpfile(3).
2012-09-26 12:21:02 -07:00
Elliott Hughes
855dde4426 Merge "Fix tmpfile(3)." 2012-09-26 12:04:59 -07:00
Elliott Hughes
91875dcd6e Fix tmpfile(3).
This could be better, but at least now it works.

Change-Id: I88b7cf3f7ce8e5fa0b3fe678b7d1679a68ffffc9
2012-09-26 12:02:17 -07:00
Nick Kralevich
0147bd2f78 am 06abf4ed: am 5989ed5c: am 25937d36: Merge "FORTIFY_SOURCE: add umask check"
* commit '06abf4edbf4b6d10ee82369ed48b8145a94ba1aa':
  FORTIFY_SOURCE: add umask check
2012-09-26 11:15:38 -07:00
Nick Kralevich
cd587701c8 FORTIFY_SOURCE: add umask check
Verify that the call to umask makes sense. While this wouldn't
have detected bug 7094213 (because the low order bits were all zero),
it might detect other similar bugs.

References: https://code.google.com/p/android-source-browsing/source/detail?r=acba45cc4b1f98f67fcdeda2f7c13ed57659b92a&repo=platform--libcore

Change-Id: I966a531d6b3cf8e1c5eacd69bd3cbec475b5fa58
2012-09-26 10:19:31 -07:00
Elliott Hughes
62466a55bf am 7e9d6d8a: am b2af8b68: am 66a97ea9: am 4e9d953a: Merge "libc: add ftw / nftw functions"
* commit '7e9d6d8abba781992b1f55f36e02b2baae368d07':
  libc: add ftw / nftw functions
2012-09-14 10:28:47 -07:00