Commit graph

646 commits

Author SHA1 Message Date
Elliott Hughes
346fa721ca Merge "Get the full set of PRNG functions in <stdlib.h>" 2014-06-12 03:32:07 +00:00
Elliott Hughes
a0beeeabbc Get the full set of PRNG functions in <stdlib.h>
Bug: https://code.google.com/p/android/issues/detail?id=58888
Change-Id: I435250bdae302e8bd7e29977d0fde7b9afbfca5e
2014-06-12 14:37:31 -07:00
Christopher Ferris
3d5e0b2045 Merge "Add/Remove mmap tests." 2014-06-12 03:32:07 +00:00
Christopher Ferris
eda26bc1ff Add/Remove mmap tests.
Remove the incorrect tests that use a negative offset for mmap without
a fd.

Add a small set of tests for mmap.

Bug: 15436969

Change-Id: Id537d33cd4cdc26dee6cdfa9bf9cf35754bce335
2014-06-12 13:16:36 -07:00
Dan Albert
37b845f9e4 Merge "Remove declaration for putw(3)/getw(3)." 2014-06-12 05:34:11 +00:00
Dan Albert
8e613cf342 Remove declaration for putw(3)/getw(3).
These were both removed from POSIX 2004, and we don't define an
implementation for getw(3). Keep the definition of put(3) on LP32 for
binary compatibility.

Bug: 13935372
Change-Id: Iba384b45093ac6d2d7c2d81f7980cd7701dd6f56
2014-06-11 14:41:45 -07:00
Christopher Ferris
e9f7a9c340 Allow bionic-unit-tests-glibc to be built again.
When we switched to 64 bit host build be default, we no longer build
the glibc unit tests. Fix that, and also set all host targets to build
multilib.

This change also changes the name of bionic-unit-tests-glibc to add
the suffix of 32 or 64 depending on the host type built.

Change-Id: Ife13f9d80f351750ff02825b086d44bb0c2df828
2014-06-10 19:46:07 -07:00
Alexander Ivchenko
68b01665b3 Fix mbrtoc32 test from tests/uchar_test.cpp for x86.
Without that fix the test fails with:
"error: comparison between signed and unsigned integer expressions" on x86,
due to the fact that char is signed on x86.

Change-Id: I44462d67c15c7e9b730ad5da52eb9c05e207d34b
Signed-off-by: Alexander Ivchenko <alexander.ivchenko@intel.com>
2014-06-11 15:57:57 -07:00
Serban Constantinescu
2aca7fe821 AArch64: Fix memcmp16() test
__memcmp16() should return an integer less than, equal to, or greater than
zero. However the tests looks for a specific value.

Change-Id: I06052f58f9ccc67146a3df9abb349c4bc19f090e
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
2014-06-10 17:51:10 +01:00
Ying Wang
199e8638df Merge "Use PRIVATE_POST_INSTALL_CMD to create symlink." 2014-06-09 23:55:19 +00:00
Ying Wang
7f722b366a Use PRIVATE_POST_INSTALL_CMD to create symlink.
Bug: 15520908
Change-Id: Ib3349f7adb6def81abf07bfb9d37093e4a599d09
2014-06-09 16:32:51 -07:00
Elliott Hughes
18b17e9775 Add a regression test for two libm bugs we didn't have.
Reported on the OpenBSD list, but we already had the fix for one from FreeBSD,
and I think the other only affected ld80 anyway. Worth having tests thuogh.

Change-Id: Ic4bbeb2384fd578a3ef13e4907be83deda50815f
2014-06-06 21:55:27 -07:00
Elliott Hughes
c3bdc792be Merge "Fix the printf family for non-ASCII." 2014-06-06 18:06:44 +00:00
Elliott Hughes
69f05d291d Fix the printf family for non-ASCII.
The bug here turned out to be that we hadn't increased the constant
corresponding to the maximum number of bytes in a character to match
our new implementation, so any character requiring more than a byte
in UTF-8 would break our printf family.

Bug: 15439554
Change-Id: I693e5e6eb11c640b5886e848502908ec5fff53b1
2014-06-05 23:19:15 -07:00
Varvara Rainchik
fce861498c Fix for slm-tuned memmove (both 32- and 64-bit).
Introduce a test for memmove that catches a fault.
Fix both 32- and 64-bit versions of slm-tuned memmove.

Change-Id: Ib416def2610a0972e32c3b9b6055b54967643dc3
Signed-off-by: Varvara Rainchik <varvara.rainchik@intel.com>
2014-06-05 11:08:09 -07:00
Dan Albert
001f8f041b Removes wcswcs from bionic for LP64.
Bug: 13935372
Change-Id: I0deb15e769da4fa81bb65a87f3c86db5163a5796
2014-06-04 12:01:56 -07:00
Dan Albert
452e091300 Merge "Adds functionality specified by uchar.h" 2014-06-04 16:10:50 +00:00
Dan Albert
7a7f9952c1 Adds functionality specified by uchar.h
mbrtoc32 and c32rtomb get their implementations from mbrtowc and wcrtomb. The
wc functions now simply call the c32 functions.

Bug: 14646575
Change-Id: I49d4b95fed0f9d790260c996c4d0f8bfd1686324
2014-06-04 08:39:24 -07:00
Elliott Hughes
d286796fce Turn on -Wunused and fix the mistakes it uncovers.
Change-Id: I023d2d8b547fbc21d4124bb7510d42b06a0dc501
2014-06-03 15:22:34 -07:00
Dmitriy Ivanov
214e64135e Make atexit.dlclose work for glibc
* build libtest_atexit.so
 * remove atexit(NULL) - glibc segfaults on it

Bug: 15350494
Change-Id: I27d79130c32c5691b0e8790a57d92f9710f5bf4a
2014-05-30 18:16:09 -07:00
Christopher Ferris
39036f655a Do not run dlclose test on glibc.
The support library for this test is not built for host by default.
Even if the support library is built, the test segfaults on glibc.

Change-Id: I9cb7a364c59b55d4bf5d8634293037cd9bae020b
2014-05-30 11:23:21 -07:00
Christopher Ferris
d178c83d45 Fix unwinding_through_signal_frame test.
I accidentally removed the compilcation of the test implementation file
with special flags needed for the test to work. This change creates the
impl as a library with those flags back.

Bug: 14819262
Change-Id: Ib84fd26a7f4d40a0267d3ed686185b0abc5a3706
2014-05-29 20:00:12 -07:00
Christopher Ferris
8bf50d5b72 Fix wmemmove test.
I accidentally copied over the nul terminator with the test.

Change-Id: I24a9aa05d4fba4f383fa38a3041bb6a6b179130c
2014-05-29 15:44:34 -07:00
Christopher Ferris
9e01ea63a7 Fix dprintf test.
Change-Id: Ied783d545b6a35a70a158249f3957a9d00971627
2014-05-29 13:17:40 -07:00
Christopher Ferris
1a57de713a Merge "Fix overflow testing in sbrk." 2014-05-29 18:03:28 +00:00
Christopher Ferris
738b0cc5e9 Fix overflow testing in sbrk.
Modify the overflow testing for sbrk.

Bug: 15188366

Change-Id: Ia83f85f7c1789454d872279bd41f38f1ce6b8a34
2014-05-29 10:51:22 -07:00
Dan Albert
6b3beb23d6 Fixes stdatomic.h test to match C11 spec
C11 defines the expected value to atomic_compare_exchange_* as being non-atomic
types. Using an atomic type is a syntax error in clang.

http://en.cppreference.com/w/c/atomic/atomic_compare_exchange

Change-Id: I74de1061fa1fc50d835451792d902000f368200e
2014-05-28 16:53:08 -07:00
Christopher Ferris
8a405b027a Merge "Add optimized AArch64 versions of bcopy and wmemmove based on memmove" 2014-05-28 21:35:04 +00:00
Elliott Hughes
e6c57fcb05 Add C11 <stdatomic.h>.
Bug: 14903517
Change-Id: I631dbfdaa698cf7fea8e3b5e18a32586383e62a5
2014-05-23 20:06:03 -07:00
Bernhard Rosenkraenzer
6f2bde3441 Add optimized AArch64 versions of bcopy and wmemmove based on memmove
Add optimized versions of bcopy and wmemmove for AArch64 based on the
memmove implementation

Change-Id: I82fbe8a7221ce224c567ffcfed7a94a53640fca8
Signed-off-by: Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>
2014-05-23 18:49:57 -07:00
Christopher Ferris
fd0ce866ce Revert "Add optimized AArch64 versions of bcopy and wmemmove based on memmove"
This reverts commit 8167dd7cb9.

For some reason I thought the bcopy change was bzero. The bcopy code doesn't pass our tests, so reverting until I can figure out what's wrong.

Change-Id: Id89fe959ea5105cd58dff6bba8d91a30cc4bcb07
2014-05-24 01:02:22 +00:00
Bernhard Rosenkraenzer
8167dd7cb9 Add optimized AArch64 versions of bcopy and wmemmove based on memmove
Add optimized versions of bcopy and wmemmove for AArch64 based on the
memmove implementation

Change-Id: Ie43d0ff4f8ec4edba5b4fb5ccacd941f81ac6557
Signed-off-by: Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>
2014-05-23 17:54:08 -07:00
Calin Juravle
92687e41bc Cleaned up pthread rwlocks implementation.
- used underscore_style_for_vars
- extracted time related functionality into a function
- cleaned up style
- removed unused fields from pthread_rwlock_t on LP64
- changed reservation in pthread_rwlock_t so that the size of the
structure equals glibc version

Bug: 8133149

Change-Id: I84ad3918678dc7f5e6b3db9b7e9b0899d3abe9cd
2014-05-23 00:22:58 +01:00
Dmitriy Ivanov
44adf93b8e Fix dlsym_failure NULL handle test
* RTLD_DEFAULT != (void*)0 only for bionic32

Change-Id: I3b3758835cf4085b0f899e2b62861591411aec13
2014-05-22 10:06:32 -07:00
Calin Juravle
eea59ea21e Merge "Add dprintf test" 2014-05-22 16:03:08 +00:00
Dmitriy Ivanov
3eb9f1f6ba Merge "Removed dlsym handle != NULL check for lp64" 2014-05-22 12:55:15 +00:00
Calin Juravle
6afb2a9a97 Add dprintf test
Change-Id: I0fe1b4d45c1312cf01deed6ce5db032d5513e908
2014-05-22 11:47:47 +01:00
Calin Juravle
172167163a Merge "Mutex-free implementation of pthread_rwlock" 2014-05-22 10:15:03 +00:00
Calin Juravle
76f352eec1 Mutex-free implementation of pthread_rwlock
Bug: 8133149
Change-Id: Id6775010d95f2634b173daa55d87a59a3cf4131b
2014-05-22 11:11:15 +01:00
Dmitriy Ivanov
ca1c80220e Removed dlsym handle != NULL check for lp64
* Removed unnecessary NULL check in dlsym
 * Fixed dlsym_failure test to account for
   correct RTLD_DEFAULT value
 * Added temporary check for legacy RTLD_DEFAULT
   value for non-yet-recompiled binaries

Bug: 15146875
Change-Id: I089fa673762629f5724b6e4fbca019d9cfc39905
2014-05-21 22:42:24 -07:00
Christopher Ferris
72bbd42357 Support for jemalloc to replace dlmalloc.
To use jemalloc, add MALLOC_IMPL = jemalloc in a board config file
and you get the new version automatically.

Update the pthread_create_key tests since jemalloc uses a few keys.
Add a new test to verify memalign works as expected.

Bug: 981363

Change-Id: I16eb152b291a95bd2499e90492fc6b4bd7053836
2014-05-20 14:47:33 -07:00
Christopher Ferris
afb89c2a01 Merge "denver: optimize memmove" 2014-05-20 19:56:13 +00:00
Shu Zhang
6c80ccdeed denver: optimize memmove
Optimize 32-bit denver memmove with reversal memcpy.

Change-Id: Iaad0a9475248cdd7e4f50d58bea9db1b767abc88
2014-05-20 12:31:38 -07:00
Dmitriy Ivanov
b648a8a57e Add RTLD_NOLOAD support and some related changes.
* Aligned RTLD_ values with glibc for lp64
 * dlopen supports RTLD_NOLOAD flag
 * soinfo_unload calls find_library(.., RTLD_NOLOAD)
   instead of naive find_loaded_library_by_name()
 * dlopen changed to add child to caller soinfo instead
   of somain.

Bug: https://code.google.com/p/android/issues/detail?id=64069
Change-Id: I1a65f2c34f3e0edc6d2c41a2e408b58195feb640
2014-05-20 12:02:24 -07:00
Elliott Hughes
de9ac71053 Use -fvisibility=hidden to build libm.
Bug: 11156955
Change-Id: I77b7772a44313a1eb3970f5d2c8e2af63690efa4
2014-05-19 16:58:52 -07:00
Ben Cheng
77338a2969 Merge "Address additional warnings found by GCC 4.9." 2014-05-19 22:28:10 +00:00
Ben Cheng
caff5f2e1a Address additional warnings found by GCC 4.9.
Change-Id: If668a6eb98a6ce7b2872f528b8e3527638814f68
2014-05-19 14:27:31 -07:00
Jingwei Zhang
568d64dc62 Accuracy tests for libm
This patch adds tests for 14 math functions to address coverage
issue of math functions discussed in:
https://android-review.googlesource.com/#/c/49653/

Change-Id: Ia7200b93d4f5c7928a3fb827ca6932226384a116
Signed-off-by: Jingwei Zhang <jingwei.zhang@intel.com>
Signed-off-by: Yong Yao <yong.yao@intel.com>
2014-05-16 15:31:55 -07:00
Dmitriy Ivanov
86bc436e20 Merge "Improve detection of already loaded libraries" 2014-05-15 21:55:24 +00:00
Calin Juravle
9b95ea936a Document a known test issue in stdio_test.cpp.
Bug: 13077905
Change-Id: Iab7fc7be0737c732e26cc07ecd7884b3087b51bb
2014-05-15 10:34:06 +01:00
Dmitriy Ivanov
d59e50063a Improve detection of already loaded libraries
Linker is now able to resolve symlinked libraries correctly.

soinfo is extended to save the graph of dependencies during
load/unload. Dependencies are used only in CallConstructor.

Bug: 9741592
Change-Id: Id9c48a74c46aa89bcdf3d54ec2f8ba3d398130b1
2014-05-14 15:16:35 -07:00
Elliott Hughes
c9244bdac1 Add tests for fprintf behavior when the underlying fd is bad.
Bug: 7229520
Change-Id: Ie878e0c13fdcda7b9131fa56208b84ed88125be7
2014-05-14 13:31:35 -07:00
Elliott Hughes
e77f38f14a Add a unit test for already-fixed printf -0.0 formatting.
This was fixed by the upgrade to upstream head.

Bug: 5084292
Change-Id: Ia3bda1c0bbe38f428e22213b8bdbdf1a16caccf2
2014-05-14 12:39:12 -07:00
Elliott Hughes
3694ec6c4b Add a regression test for a long-fixed pthread_once bug.
Bug: 1934122
Change-Id: Iae09baedc2c6ed4036521e51718fe9d015bc56b9
2014-05-14 11:46:08 -07:00
Elliott Hughes
1728b23965 Switch to g_ for globals.
That's what the Google style guide recommends, and we're starting
to get a mix.

Change-Id: Ib0c53a890bb5deed5c679e887541a715faea91fc
2014-05-14 10:02:03 -07:00
Elliott Hughes
5c8c88dd8d Use the NetBSD inet_ntop until the OpenBSD bug is fixed.
Stupidly I found this bug by accident when writing the existing
tests, but I didn't think any real code would hit it. It turns
out that libcore always uses an INET6_ADDRSTRLEN-sized buffer
even when working with AF_INET addresses.

Change-Id: Ieffc8e4bbe9b66b49b033e3e7101c896e097e6f8
2014-05-13 19:17:46 -07:00
Elliott Hughes
6a41b0fb0e Flesh out <arpa/inet.h>.
Use the upstream OpenBSD implementations of these functions.

Also ensure we have symbols for htonl, htons, ntohl, and ntohs.
gtest doesn't like us using the macro versions in ASSERT_EQ.

Bug: 14840760
Change-Id: I68720e9aca14838df457d2bb27b999d5818ac2b5
2014-05-13 18:08:29 -07:00
Elliott Hughes
063525c61d Consistently use #if defined(__BIONIC__) in tests.
I've also switched some tests to be positive rather than negative,
because !defined is slightly harder to reason about and there are
only two cases: bionic and glibc.

Change-Id: I8d3ac40420ca5aead3e88c69cf293f267273c8ef
2014-05-13 11:19:57 -07:00
Elliott Hughes
eb664e24c0 Add getmntent_r to our collection of <mntent.h> compatibility stubs.
This helps build 'external/flo' out of the box.

Bug: 14841211
Change-Id: I30dde77239cceaf1f5743163744eb3604d27a266
2014-05-13 10:44:07 -07:00
Calin Juravle
03e4ebee8d Add fpos_t tests.
Bug: 13077905

Change-Id: I86bb0ee95660f69f9971231c6f828a3a067d1ac8
2014-05-13 00:39:08 +01:00
Calin Juravle
15a6310e4b Support mb sequences across calls to mb*to*wcs* functions
Bug: 13077905
Change-Id: I5abdc7cc3c27c109b7900c94b112f18a95c35763
2014-05-13 00:24:25 +01:00
Elliott Hughes
20f8aec897 Fix use-after-free errors in stdio_test.
fclose(3) frees the passed-in FILE*. We should close(2) the underlying fd,
not fclose(3) the stream, if we want to test what happens with a stream
we can't read from.

Bug: 14466691
Change-Id: I99fed5904b0266b9c6ae05d0b9cf2e926446c064
2014-05-12 15:15:37 -07:00
Calin Juravle
4d695bf560 Merge "Align struct passwd definition with other variations of libc" 2014-05-12 09:53:41 +00:00
Calin Juravle
c768874c66 Align struct passwd definition with other variations of libc
Add pg_gecos ("real name") field to struct passwd.

Bug: 14679430
Bug: 12875898
Change-Id: I833ec2c46f6a6259b7232a8e3f7942968ef0b50d
2014-05-09 22:29:23 +01:00
Elliott Hughes
55b4c8a4a1 Merge "Hide the __bionic_clone and __bionic_clone_entry implementation details." 2014-05-09 16:13:52 +00:00
Elliott Hughes
954cf0d4e2 Hide the __bionic_clone and __bionic_clone_entry implementation details.
clone(2) is the public symbol.

Also switch a test from __bionic_clone to clone; testing public API
means the test now works on glibc too.

Change-Id: If59def26a00c3afadb8a6cf9442094c35a59ffde
2014-05-08 19:00:23 -07:00
Dmitriy Ivanov
29d10e3de8 Merge "Test dlopen with symlinked .so files" 2014-05-09 00:52:08 +00:00
Elliott Hughes
170daa042c Merge "wchar_test.cpp: fix error between comparison signed and unsigned integer" 2014-05-08 23:52:59 +00:00
Dmitriy Ivanov
7db180919c Test dlopen with symlinked .so files
Bug: 9741592
Change-Id: I68c59d6f4e690136395c3dc3de13f99ce38de528
2014-05-08 14:28:34 -07:00
Yongqin Liu
a5c6b2ecb5 wchar_test.cpp: fix error between comparison signed and unsigned integer
when compile the cts package with aarch64 gcc4.9, will get following error:
bionic/tests/wchar_test.cpp:253:3: required from here
external/gtest/include/gtest/gtest.h:1448:16:
    error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]

this change fix it by using static_cast<wchar_t> as suggested by Calin Juravle

Change-Id: I7fb9506e7b84b8a12b9d003458d4f0e78554c3cd
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
2014-05-09 00:57:47 +08:00
Elliott Hughes
3b96803284 Merge "Add basic tests for fsync/fdatasync." 2014-05-07 23:40:11 +00:00
Elliott Hughes
a62a28d1d9 Add basic tests for fsync/fdatasync.
Bug: 14613980
Change-Id: Ie8002c2a1abae07295b7bdb33772764767c03d37
2014-05-07 14:30:33 -07:00
Dmitriy Ivanov
f837cbdc27 Merge "Add missing test for atexit test suite." 2014-05-07 20:49:00 +00:00
Dmitriy Ivanov
6396da98cb Add missing test for atexit test suite.
Change-Id: I3d14d7df1da53ccef534c106633593551ab6a7cb
2014-05-07 12:29:54 -07:00
Calin Juravle
837abf0466 Merge "Fix bionic-unit-tests-glibc-run target" 2014-05-07 18:31:11 +00:00
Calin Juravle
0e9d7fccb9 Fix bionic-unit-tests-glibc-run target
Configure multilib for bionic-unit-tests-glibc-run target (the path to
the host executable was already patched to support multilib build but
the multilib itself wasn't configured).

Change-Id: If533fbdb19bc737e543cf85a0787505458f24579
2014-05-07 19:06:30 +01:00
Torne (Richard Coles)
35cff760df Merge "Test that relro sharing actually saves memory." 2014-05-07 15:25:44 +00:00
Elliott Hughes
100168abff Merge "Fix <math.h> to quieten most of our warnings." 2014-05-06 17:18:16 +00:00
Torne (Richard Coles)
2605261691 Test that relro sharing actually saves memory.
Spawn 20 child processes, have them all load the library, and compare
the total PSS used in the case where we use dlopen() and the case where
we use android_dlopen_ext() with relro sharing. We assume we will save
at least 10% of the memory; in practise this example saves 40% or more
so this should be a reasonable threshold.

Bug: 14299541
Change-Id: Idccf6b8b0eb137abae2200f1ce68fb76b3cbdd75
2014-05-06 11:38:53 +01:00
Torne (Richard Coles)
9b5ee4aa85 Merge "Handle empty relro segment or incorrectly sized file." 2014-05-06 10:16:18 +00:00
Elliott Hughes
9a5a3e8e74 Fix <math.h> to quieten most of our warnings.
I've reported the wcsftime bug upstream, but we really just want to use -D
to ensure the buggy code isn't built. (I've also brought our strftime a bit
closer to upstream now we have the right define.)

I don't think upstream is likely to fix all their sign-compare and
uninitialized warnings, so let's just silence them.

As for libm, again upstream isn't likely to fix all their warnings, and
silencing those made the ones that were our fault stand out. I've fixed
our <math.h> to fix the warnings caused by our lack of definitions for
the non-imprecise long-double functions. I checked the C99 standard, and
all these functions are there.

Change-Id: Iee8e1182c1db375058fb2c451eceb212bab47a37
2014-05-05 21:19:47 -07:00
Philip Hatcher
9ded07cff6 bionic: make epoll_event structure packed
Description: In the kernel the epoll_event structure is packed
in 64 bit kernel builds to allow the structure to be more easily
compatible with 32 bit user space.  As a result, when user space
is 64-bit the structure must be packed as well.

Add unit test to show the ptr alignment issue.

Change-Id: I2c4848d5e38a357219091f350f9b6e3da05090da
Signed-off-by: Philip Hatcher <philip.hatcher@intel.com>
Signed-off-by: Fengwei Yin <fengwei.yin@intel.com>
Reviewed-by: Hazarika, Prodyut <prodyut.hazarika@intel.com>
Tested-by: Hazarika, Prodyut <prodyut.hazarika@intel.com>
2014-05-05 19:48:55 -07:00
Elliott Hughes
ad534985ec Merge "Disable %n in printf and vfwprintf." 2014-05-05 21:49:22 +00:00
Elliott Hughes
e2341d08fa Disable %n in printf and vfwprintf.
Bug: 14492135
Change-Id: If190bede29e5f68a65043ddbe8e878c660933d03
2014-05-05 14:43:17 -07:00
Elliott Hughes
8ec21d9ded Merge "Switch to current upstream OpenBSD wsetup.c." 2014-05-05 21:33:22 +00:00
Elliott Hughes
53b24382f5 Switch to current upstream OpenBSD wsetup.c.
Change-Id: I2c1123f3e1d3c4af7fd7bf354e763934a39b78c0
2014-05-05 14:31:20 -07:00
Dmitriy Ivanov
580b246917 Merge "Fixes for __cxa_finalize" 2014-05-05 21:04:33 +00:00
Dmitriy Ivanov
6b56691a67 Fixes for __cxa_finalize
* Ability to register atexit handler from atexit handler
  * Correct way to handle both forms of atexit handler

Bug: https://code.google.com/p/android/issues/detail?id=66595
Bug: 4998315
Change-Id: I39529afaef97b6e1469c21389d54c0d7d175da28
2014-05-05 11:36:57 -07:00
Elliott Hughes
efaa461bd6 Use the OpenBSD wcsftime.
Change-Id: I81929355d245ba1e58b4a464ca6cf45915e0238e
2014-05-02 15:57:50 -07:00
Torne (Richard Coles)
26ec9679ff Handle empty relro segment or incorrectly sized file.
If the file has no relro segment, the generated relro file will have
length 0, which caused mmap to fail. If the relro file has nonzero size,
but is too short (e.g. because it's for the wrong version of the
library), the linker would segfault while comparing the data. Fix both
these issues: don't try to map a zero length file, and don't try to
compare data that would be beyond the end of the file.

Improve test to explicitly generate two versions of the library: one
with -z relro, and one with -z norelro, so we can test both cases; also
explicitly test the case where the relro file has length 0.

Bug: 14299541
Change-Id: Id8b95585edda90e8bb5de452a35b70ed2d224934
2014-05-02 14:25:45 +01:00
Elliott Hughes
f83e644e2c Fix wchar.cpp MIPS narrowing conversion build failure.
Change-Id: Id9103c78958d60337dbdb807b11256c1b31c632a
2014-05-01 17:14:59 -07:00
Elliott Hughes
5a0aa3dee2 Switch to a working UTF-8 mb/wc implementation.
Although glibc gets by with an 8-byte mbstate_t, OpenBSD uses 12 bytes (of
the 128 bytes it reserves!).

We can actually implement UTF-8 encoding/decoding with a 0-byte mbstate_t
which means we can make things work on LP32 too, as long as we accept the
limitation that the caller needs to present us with a complete sequence
before we'll process it.

Our behavior is fine when going from characters to bytes; we just
update the source wchar_t** to say how far through the input we got.

I'll come back and use the 4 bytes we do have to cope with byte sequences
split across multiple input buffers. The fact that we don't support
UTF-8 sequences longer than 4 bytes plus the fact that the first byte of
a UTF-8 sequence encodes the length means we shouldn't need the other
fields OpenBSD used (at the cost of some recomputation in cases where a
sequence is split across buffers).

This patch also makes the minimal changes necessary to setlocale(3) to
make us behave like glibc when an app requests UTF-8. (The difference
being that our "C" locale is the same as our "C.UTF-8" locale.)

Change-Id: Ied327a8c4643744b3611bf6bb005a9b389ba4c2f
2014-05-01 14:46:54 -07:00
Elliott Hughes
9fb53dd4db Merge "Make SIGRTMIN hide the real-time signals we use internally." 2014-04-30 18:30:15 +00:00
Elliott Hughes
2d36750c3a Fix the CPU_*_S tests.
Change-Id: Id67c48b9c12a20b01309490670438bfcd9163465
2014-04-30 10:45:35 -07:00
Elliott Hughes
0990d4fda8 Make SIGRTMIN hide the real-time signals we use internally.
__SIGRTMIN will continue to tell the truth. This matches glibc's
behavior (as evidenced by the fact that we don't need a special case
in the strsignal test now).

Change-Id: I1abe1681d516577afa8cd39c837ef12467f68dd2
2014-04-30 10:06:09 -07:00
Calin Juravle
77473e4085 Merge "Fix cpu_set_t" 2014-04-30 16:09:08 +00:00
Calin Juravle
b743790cca Fix cpu_set_t
- extend CPU_SETSIZE for LP64
- fix CPU_(AND|OR|XOR) macros
- fix CPU_OP_S macro
- fix __sched_cpucount
- tidy up the code

Change-Id: I741afff4d0c473e8a1ee6b4141981dc24467e0d4
2014-04-30 14:30:15 +01:00
Dan Albert
b8425c549a Adds quick_exit(3) and at_quick_exit(3) from freebsd
Change-Id: I4fe88abd8f7b8aa45e58aeb2529d59a8d555d338
2014-04-29 19:17:00 -07:00
Elliott Hughes
01ae00f317 Switch to the OpenBSD implementations of the wide scanf functions.
This also gets us the C99 wcstoimax and wcstoumax, and a working fgetwc and
ungetwc, all of which are needed in the implementation.

This also brings several other files closer to upstream.

Change-Id: I23b025a8237a6dbb9aa50d2a96765ea729a85579
2014-04-29 16:28:56 -07:00
Elliott Hughes
55cd82762f Merge "Switch to the OpenBSD wcsto* functions." 2014-04-29 22:33:15 +00:00
Elliott Hughes
3d7a0d9b08 Switch to the OpenBSD wcsto* functions.
This replaces a partial set of non-functional functions with a complete
set of functions, all of which actually work.

This requires us to implement mbsnrtowcs and wcsnrtombs which completes
the set of what we need for libc++.

The mbsnrtowcs is basically a copy & paste of wcsnrtombs, but I'm going
to go straight to looking at using the OpenBSD UTF-8 implementation rather
than keep polishing our home-grown turd.

(This patch also opportunistically switches us over to upstream btowc,
mbrlen, and wctob, since they're all trivially expressed in terms of
other functions.)

Change-Id: I0f81443840de0f1aa73b96f0b51988976793a323
2014-04-29 14:53:11 -07:00
Christopher Ferris
7fdab460a9 Merge "Fix potential makefile bug." 2014-04-29 15:56:06 +00:00
Christopher Ferris
5090964da0 Fix potential makefile bug.
Since multilib is not set every time, it needs to be per module or
there is a change that another target will use the multilib value set
previously.

Change-Id: I5c30e18d5111705cb3f6e3d4cd9ef8a28c9b746c
2014-04-28 21:10:37 -07:00
Elliott Hughes
0a5e26da1e Add mbtowc and fix mbrtowc.
Change-Id: I48786cd82587e61188d40f6fd6e11ac05e857ae9
2014-04-28 17:51:13 -07:00
Elliott Hughes
d299bcfdad Replace our broken wcswcs with the working upstream one.
Change-Id: I2952684df5674d10f0564d92c2cd42597725c0e3
2014-04-28 16:46:24 -07:00
Elliott Hughes
329103d3e2 Don't use so much stack in tzcode.
Bug: 14313703
Bug: https://code.google.com/p/android/issues/detail?id=61130
Change-Id: Id9b240fce20d4a6f2660792070e02b2b5f287655
2014-04-25 21:51:26 -07:00
Elliott Hughes
533dde4dbf Fix brk/sbrk error checking.
Note that the kernel returns the current break on error or if the requested
break is smaller than the minimum break, or the new break. I don't know where
we got the idea that the kernel could return -1.

Also optimizes the query case.

Also hides an accidentally-exported symbol for LP64.

Change-Id: I0fd6b8b14ddf1ae82935c0c3fc610da5cc74932e
2014-04-25 19:38:33 -07:00
Calin Juravle
ae77f74bcf Merge "Clean-up _fpmath and fake_long_doubles" 2014-04-24 10:12:58 +00:00
Elliott Hughes
409588cdae Fix fallout from host GCC upgrade.
I'll raise a bug for the FD_ISSET fortification; we should do better too.

Change-Id: Id2bf277890ad06b010dc952e270d746714c2bea7
2014-04-23 23:02:43 -07:00
Calin Juravle
1abc9ff6a5 Clean-up _fpmath and fake_long_doubles
- promoted IEEEld2bits to fpmath since most of the where the same for
diffrent archs
- removed _fpmath
- reinstated weak_references
- moved isfinite and isnormal to libc
- clean up fake_long_doubles
- clean up some useless ifdefs
- added missing nexttoward* tests

Bug: 14134235
Change-Id: I95639c4885653fe47fd7dc0570ee5bb3389bbc6b
2014-04-23 19:03:06 +01:00
Elliott Hughes
0c567f1e6c Fix the glibc tests again.
The glibc tests are just a regular host binary; they don't require
that you're targeting x86 or x86_64. They do seem to pick up the
suffix of the target though, even though they're always 32-bit.

Change-Id: I689ca2a4f8d7b397afa4df722b95b0d7ec904bf6
2014-04-22 19:21:32 -07:00
Grigoriy Kraynov
cbf6df0459 Tests for environment variables utility functions
This is the first patch from the new set of tests for Bionic standard functions.

Change-Id: Ie568788a24832394e597ad33f44a5c71cb33b51f
Signed-off-by: Grigoriy Kraynov <grigoriy.kraynov@intel.com>
2014-04-22 19:09:45 -07:00
Dmitriy Ivanov
53c884e281 Get ANDROID_DATA dir from enviroment
Change-Id: Ie3675bd27bbc779fc2140f95b930eadd14838753
2014-04-22 18:44:55 -07:00
Dmitriy Ivanov
156c3afcf1 Follow up on building tests for both platforms
this makes run-on-host work properly

Change-Id: Iaed93ca9d96359b64bbeff995280ecd70fc9cc60
2014-04-22 15:22:25 -07:00
Christopher Ferris
345b49a7c0 Build 32/64 bit versions of tests/benchmarks.
Change-Id: I4d146377aac6573a214dfaa5cab5cce8b10538b4
2014-04-22 10:42:12 -07:00
Elliott Hughes
c5eea6d386 Merge "Fix WCHAR_MAX, WCHAR_MIN, WINT_MAX, and WINT_MIN." 2014-04-22 17:00:33 +00:00
Torne (Richard Coles)
b1bfa7956c Merge "Allow sharing the RELRO section via a file." 2014-04-22 10:39:49 +00:00
Torne (Richard Coles)
c363e5dd0a Merge "Support loading libraries to a reserved address." 2014-04-22 10:33:34 +00:00
Elliott Hughes
83c07b5e50 Fix WCHAR_MAX, WCHAR_MIN, WINT_MAX, and WINT_MIN.
GCC tells us everything we need to know. clang does its usual half-assed job.

Change-Id: Id4d664529b10345274602768cd564d3df717e931
2014-04-21 18:09:46 -07:00
Elliott Hughes
1b836ee6f8 Fix a wchar.wcstombs_wcrtombs test failure.
Looks like I screwed up a last-minute refactor and didn't re-run the tests.

Change-Id: I90a710ae66a313a9812859650aa0b4e8c6bc57f9
2014-04-18 13:32:33 -07:00
Elliott Hughes
b88da06580 Merge "Upgrade to current vfprintf." 2014-04-18 18:19:23 +00:00
Elliott Hughes
f3c73901cb Upgrade our <ctype.h> implementation to OpenBSD head.
Adding the perfunctory <ctype.h> tests showed that we'd accidentally
dropped several symbols. This puts everything back in its proper place
and switches us to upstream head at the same time.

Change-Id: Ib527ad280c9baded81e667fa598698526d93e66f
2014-04-18 10:29:16 -07:00
Elliott Hughes
0549371bd7 Upgrade to current vfprintf.
This gets us various bug fixes and missing C99 functionality.

Bug: https://code.google.com/p/android/issues/detail?id=64886
Change-Id: Ie9f8ac569e9b5eec1e4a1faacfe2c21662eaf895
2014-04-17 17:30:03 -07:00
Torne (Richard Coles)
183ad9df53 Allow sharing the RELRO section via a file.
Add flags and a file descriptor to android_dlopen_ext() to allow writing
the RELRO section of the loaded library to a file after relocation
processing, and to allow mapping identical pages from the file over the
top of relocated memory in another process. Explicitly comparing the
pages is required in case a page contains a reference to a symbol
defined in another library loaded at a random base address.

Bug: 13005501
Change-Id: Ibb5b2d384edfaa5acf3e97a5f8b6115c10497a1e
2014-04-17 14:30:46 +01:00
Torne (Richard Coles)
12bbb91645 Support loading libraries to a reserved address.
Add flags and parameters to android_dlopen_ext() to allow loading a
library at an already-reserved fixed address. If the library to be
loaded will not fit within the space reserved, then the linker will
either fail, or allocate its own address space as usual, according to
which flag has been specified. This behaviour only applies to the
specific library requested; any other libraries loaded as dependencies
will be loaded in the normal fashion.

There is a new gtest included to cover the functionality added.

Bug: 13005501
Change-Id: I5d1810375b20fc51ba6a9b3191a25f9792c687f1
2014-04-17 14:22:17 +01:00
Elliott Hughes
4bd97cee28 Switch to gdtoa.
This gives us a real strtold for LP64 and fixes various LP64
bugs.

Bug: 13563801
Change-Id: I277858d718ee746e136b6b6308a495ba50dfa488
2014-04-16 15:15:52 -07:00
Ben Cheng
26c2bb84dd Merge "Fix signed vs unsigned comparison." 2014-04-15 22:37:29 +00:00
Ben Cheng
b760164dd6 Fix signed vs unsigned comparison.
Otherwise GCC 4.9 complains.

Change-Id: I7cd3c5e8c78fda709130ca88a85fa1512e6fc024
2014-04-15 15:29:32 -07:00
Elliott Hughes
02c78a3867 Reimplement isinf/isnan/fpclassify.
Also move isinf and isnan into libc like everyone else.

Also move fpclassify to libc like the BSDs (but unlike glibc). We need
this to be able to upgrade our float/double/long double parsing to gdtoa.

Also add some missing aliases. We now have all of:

  isnan, __isnan, isnanf, __isnanf, isnanl, __isnanl,
  isinf, __isinf, isinff, __isinff, isinfl, __isinfl,
  __fpclassify, __fpclassifyd, __fpclassifyf, __fpclassifyl.

Bug: 13469877
Change-Id: I407ffbac06c765a6c5fffda8106c37d7db04f27d
2014-04-14 14:35:47 -07:00
Elliott Hughes
7823f320b1 Extra tests for printf of NaN and Inf.
Change-Id: I61fc655d9777a03aabf38f6ebd047fe275386f05
2014-04-14 12:11:28 -07:00
Elliott Hughes
6455ac73da Improve the <sstream> test.
It looks like libcxx's testing is crap too, and this turned up
another bug in stlport.

Change-Id: I98c93dceaa8225c3cc280166d4bb74adaf94a324
2014-04-10 20:44:27 -07:00
Elliott Hughes
8c42606ae1 Add a test for external/stlport a6df82320fcb8f26af0d067c7768fedbaeb9ad88.
Change-Id: If4df9f5df41ae5453a3dff6bb032b419819f8703
2014-04-10 11:34:14 -07:00
Elliott Hughes
b52a4ab4e2 Merge "Flesh out <locale.h>." 2014-04-09 04:13:43 +00:00
Elliott Hughes
764a993611 Fix build: include what you use.
Change-Id: I12b2d5e434ad3ed38d4451bd470673781e6ca8fe
2014-04-08 19:44:36 -07:00
Elliott Hughes
c4936e20a3 Flesh out <locale.h>.
This is a trivial implementation that only supports the C/POSIX locale.

Change-Id: Ib11cea4249e1862aca96a8b94d58ea9a418cbe75
2014-04-08 19:37:38 -07:00
Elliott Hughes
9f525644df Implement _Exit(3).
Change-Id: Ida6ac844cc87d38c9645b197dd8188bb73e27dbe
2014-04-08 17:16:13 -07:00
Elliott Hughes
5363a45f2b Clean up localeconv(3).
The OpenBSD doesn't support C99, and the extent to which we support
locales is trivial, so just do it ourselves.

Change-Id: If0a06e627ecc593f7b8ea3e9389365782e49b00e
2014-04-08 14:34:12 -07:00
Serban Constantinescu
48501af98f AArch64: Fix flock64 for LP64.
On LP64 systems F_GETLK64, F_SETLK64 and F_SETLKW64 definitions should
map onto the F_GETLK, F_SETLK and F_SETLKW definitions, respectively.
LP64 also doesn't have a struct flock64.

Change-Id: Ibdfed9645d9e946999acd6efa8b96ea6238ed5bf
Signed-off-by: Marcus Oakland <marcus.oakland@arm.com>
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
2014-04-08 12:19:23 -07:00
Christopher Ferris
41059d764f Merge "Add stpcpy/stpncpy." 2014-04-08 01:21:07 +00:00
Elliott Hughes
b9bb48bf28 Merge "Fix the printf issue for 64 bits. The following case:" 2014-04-07 23:44:50 +00:00
Christopher Ferris
950a58e24d Add stpcpy/stpncpy.
Add tests for the above.

Add the fortify implementations of __stpcpy_chk and __stpncpy_chk.

Modify the strncpy test to cover more cases and use this template for
stpncpy.

Add all of the fortify test cases.

Bug: 13746695
Change-Id: I8c0f0d4991a878b8e8734fff12c8b73b07fdd344
2014-04-07 16:41:53 -07:00
Elliott Hughes
efbdb53f84 Remove a non-standard turd: strtotimeval.
Change-Id: I1b1e40746cb573e3fb73a5276969b40c5da36d15
2014-04-07 15:17:19 -07:00
Elliott Hughes
77e944fd46 Implement wctomb(3) for ltrace.
This is an implementation in the style of the rest: char == byte.

We might want to come back and implement UTF-8, but this is enough for ltrace.

Bug: 13747066
Change-Id: Ib2b63609c9014fdef9a8491e067467c4fc5ae3cc
2014-04-07 14:29:28 -07:00
Calin Juravle
eb554998d7 Merge "Fix modf* tests" 2014-04-03 09:00:34 +00:00
Calin Juravle
d8d6feed3a Fix modf* tests
Use a value that can be exactly represented.

Change-Id: Idf3b1db5e6042fb49c1f591f25f9eee656659ece
2014-04-02 21:54:39 +01:00
Alexander Ivchenko
edd7c2ec25 Fix the printf issue for 64 bits. The following case:
printf("%1$s %1$s\n", "test");

would print garbage instead of the second "test". The problem is __find_arguments
and the patch is a backport of two patches from OpenBSD that fix the issue:

Author: tedu <tedu@cvs.openbsd.org>
Date:   Sat Apr 29 23:00:24 2006 +0000

    check mmap for failure.  the helper functions using it return -1, but
    callers do not yet check since printf() for example is not documented
    to return an error.
    some formatting cleanups.
    mostly ok deraadt millert

Author: millert <millert@cvs.openbsd.org>
Date:   Fri May 16 14:28:54 2008 +0000

    C99 says that for each va_copy() there must be a matching va_end().
    Replace the non-portable hackery in __find_arguments() with a union.
    From FreeBSD.

Change-Id: I6ea392ce6fcf4a319ae6a67ec58cc52fe7cbe534
Signed-off-by: Alexander Ivchenko <alexander.ivchenko@intel.com>
2014-04-02 18:30:55 +04:00
Calin Juravle
9c9ef0db91 Merge "Changed long double literal suffix from 'l' to 'L'." 2014-04-02 10:17:11 +00:00
Brian Carlstrom
1021c05f1b Include sys/types.h and sys/wait.h for waitpid
(cherry picked from commit 8b2c6d44cac206b61dffd965863336e6f803fc66)

Change-Id: Ice1f6d956c11aaefd3d846c12121f08613a94446
2014-04-01 17:42:31 -07:00
Christopher Ferris
e3bb025b3d Fix transient failure in select_smoke test.
Make sure there is a delay before the file descriptor is written so that
the select/pselect calls do not return immediately.

Change-Id: If9e481b0e2cfae7ef7abd9cba8fff84078e203d3
2014-04-01 14:46:09 -07:00
Calin Juravle
b7afa9df25 Changed long double literal suffix from 'l' to 'L'.
Change-Id: Id569f2d335b0930704d12ad7f388cb98b65f3ab7
2014-04-01 16:49:14 +01:00
Christopher Ferris
108f6dc316 Move accept4 tests into sys_socket_test.cpp.
In addition, create basic recvmmsg, sendmmsg tests.

Change-Id: Ie9f4954446d98b5eb5e553d3c616c1ee67c3cb66
2014-03-31 22:43:38 -07:00
Christopher Ferris
9cea377505 Small accept4 fixes.
Put the accept4 test in the sorted order, and put the accept4 define in
sorted order.

Also add the missing SYS_RECVMMSG and SYS_SENDMMSG defines.

Change-Id: Iba55354975e0d5027dbee53f6de752c2df719493
2014-03-31 11:23:39 -07:00
Calin Juravle
557942ac58 Merge "Fix math tests." 2014-03-31 10:54:15 +00:00
Pavel Chupin
50282f72bb Add lconv declaration and localeconv(3)
lconv is taken from ndk/sources/android/support/include/locale.h and
matches
bsd/glibc upstream.
Keep old declaration for 32-bits for compatibility.
localeconv.c and deps are taken from openbsd upstream.
Changed strtod.c accordingly.

Change-Id: I9fcc4d15f5674d192950d80edf26f36006cd31b4
Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>
2014-03-28 11:15:03 +00:00
Calin Juravle
c8564f2df2 Fix math tests.
Bug: 13657654
Change-Id: I39b2f13b5b3d3e6897618ac3aed49a0a08458dd0
2014-03-28 11:10:01 +00:00
Christopher Ferris
a58b3f78e1 Merge "Add accept4 unit test to bionic." 2014-03-27 18:15:15 +00:00
Andrei Emeltchenko
2f3ba8844a Add accept4 unit test to bionic.
Change-Id: I1cce5fb8dab16f03164fdd288f35a814d7c49c6a
2014-03-27 11:08:49 -07:00
Calin Juravle
4bfaf462f0 Added strtotimeval tests.
Change-Id: I3dfd3647a8494490a2d549bdb915968063a7fb99
2014-03-26 17:57:48 +00:00
Brian Carlstrom
133bd09334 Add include of float.h for LDBL_MIN_EXP and LDBL_MANT_DIG
(cherry picked from commit 1711c6ea3a0d891da665325c75738a68bd7d501f)

Change-Id: Ia64676b2b904f042fec678003e3f2cd5bd82b510
2014-03-24 16:53:22 -07:00
Calin Juravle
989a80b750 Merge "Fix LP64 libm for 128-bit long doubles" 2014-03-24 12:13:24 +00:00
Calin Juravle
4d77c1151c Fix LP64 libm for 128-bit long doubles
* reworked amd64/_fpmath.h and arm64/_fpmath.h to support 128-bit long
doubles.
* improved tests to cover long double cases
* made modfl an alias for LP32

Tests pass on x86, x86_64, arm, arm64 and mips.

Bug: 12921273

Change-Id: Ibe39acde57972447a8950fa45b1e702acc68ebeb
2014-03-24 11:48:42 +00:00
Christopher Ferris
753ad778bc Fix deadlock in timer_delete.
If the callback function for a timer did a timer_delete, the function
would never return. The problem was that the timer_delete function would try
to wait until the timer thread has finished. Waiting for yourself to finish
doesn't work very well.

Bug: 13397340
Change-Id: Ica123a5bafbc8660c8a4a909e5c2dead55ca429d
2014-03-20 20:47:45 -07:00
Calin Juravle
7227066726 Added a test flag to bionic run-test targets.
It makes it much easier to pass arguments to the tests.

Change-Id: Ia91eba4868627a3cea3f8d2c26ba01af4e860b12
2014-03-19 18:23:36 +00:00
Christopher Ferris
f171b34cf0 Use the float/double assert macros.
The normal ASSERT_EQ macros don't work quite right for float/double values,
and result in false failures. Use the correct macros instead.

Bug: 13511379
Change-Id: Ic2feee7f3d3569f57b6453b8fa95222846c625cd
2014-03-17 16:40:26 -07:00
Elliott Hughes
603332fc4c Upgrade to current upstream scanf implementation.
Also add a basic test.

Change-Id: Icc0e68a5716b9579244f6eb8bac1ab5a24eda85a
2014-03-12 17:10:41 -07:00
Elliott Hughes
5a8173860d Ensure we always have symbols for atof, strtof, strtold.
We'll need a better implementation of strtold for LP64, but all our
long double functions are currently broken for LP64 anyway so this
isn't a regression.

Change-Id: I2bdebac11245d31521d5fa09a16331c03dc4339c
2014-03-12 16:12:57 -07:00
Elliott Hughes
40488560c1 Include what you use.
Don't rely on transitive includes. (Even though that works fine in AOSP.)

Change-Id: Ifc06575e4aea383cfff24d6c5c14fc0a7aabdf2b
2014-03-12 13:50:38 -07:00
Elliott Hughes
3cdf5739cd Add a basic unit test for system(3).
Change-Id: Ibc5ac21f3663685d89ce261b58d6ea386fc1ff88
2014-03-11 12:54:44 -07:00
Elliott Hughes
3e3409af0f Add system/extras strftime and strptime tests.
Change-Id: I889c58f6e2e27b99cf6328a8671858d2e5feaa4e
2014-03-10 18:19:03 -07:00
Brian Carlstrom
be1d91dedc Add includes for waitpid
(cherry picked from commit f07c5dd9ab63f2e8ba736107bd4b69bbd8829c9f)

Change-Id: I7a765fd7a3a5f8f29a703f6a591c4fd8df4ebf1c
2014-03-08 15:09:43 -08:00
Elliott Hughes
04620a3cd7 Fix pthread_detach for already-exited threads.
Change-Id: I2bf7f41234d93b226132a4c51705f4186f4961c3
Reported-by: Paresh Nakhe <pnakhe@codeaurora.org>
2014-03-07 17:59:05 -08: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
Elliott Hughes
0e714a5b41 Implement POSIX pthread_mutex_timedlock.
This replaces the non-standard pthread_mutex_lock_timeout_np, which we have
to keep around on LP32 for binary compatibility.

Change-Id: I098dc7cd38369f0c1bec1fac35687fbd27392e00
2014-03-04 10:27:58 -08:00
Narayan Kamath
51e6cb33e3 Implement pthread_condattr_{get,set}clock.
We only support CLOCK_REALTIME and CLOCK_MONOTONIC for now,
so we us a single bit from pthread_cond_t->value to denote
the clock type. Note that this reduces the width of the counter
to 30 bits, but this should be large enough for all practical
purposes.

bug: 13232338

Change-Id: I857e7da64b3ecbb23eeac7c9f3fbd460f60231bd
2014-03-04 11:17:13 +00:00
Elliott Hughes
aedb00d04e Switch to upstream alarm(3).
The only way the setitimer call can fail is if the unsigned number of seconds is
too large to fit in the kernel's signed number of seconds. If you schedule a
68-year alarm, glibc will fail by returning 0 and BSD will fail by returning -1.

Change-Id: Ic3721b01428f5402d99f31fd7f2ba2cc58805607
2014-03-04 00:58:31 +00: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
Calin Juravle
a92b57c7f8 Merge "Added ftw64, nftw64" 2014-02-25 10:44:26 +00:00
Calin Juravle
7c1efffc24 Merge "Added mkstemp64" 2014-02-25 10:43:31 +00:00
Elliott Hughes
0e44bc3bae Remove <asm/page.h>.
If we have PAGE_SIZE/PAGESIZE, POSIX says they should be in <limits.h>.

Change-Id: I3c2d574ea2aea81f524874a156361411a4ffa18e
2014-02-24 15:55:31 -08:00
Calin Juravle
d4934a70e6 Added ftw64, nftw64
Bug: 13076637
Change-Id: I5b926526f935b00bba14c2807b61d85f95089c33
2014-02-24 20:22:11 +00:00
Calin Juravle
fe317a3775 Added mkstemp64
Bug: 13076637
Change-Id: I41bf28ab3e6c7325470781e9323eeec023483df5
2014-02-24 20:19:19 +00:00
Calin Juravle
90b0157679 Merge "Fixed int fast types for LP64" 2014-02-21 17:09:13 +00:00
Calin Juravle
da030de702 Fixed int fast types for LP64
Bug: 13110474
Change-Id: Id5591603ad4ba7e149c0852f4abb25e4e5a5d065
2014-02-21 16:27:21 +00:00
Narayan Kamath
5f6f4a956c Fix signbit / infinite / isinf / isnan unit tests.
Turns out stlport isn't broken. <cmath> (included
transitively via gtest in our case) is not required
to make C99 math macros (like signbit) available, nor is
it required to preserve them if they're already defined.
It is only required to make the equivalent functions in
namespace std available.

I couldn't find any documentation of required behaviour for
programs that include both <math.h> and <cmath>.

I've verified experimentally that llvm's libc++ and gnu
stl behave the same as stlport.

bug: 12935307

Change-Id: I9dc5cc0fd9f4f259abc8eefb280177cdd092a94b
2014-02-19 18:50:30 +00:00
Elliott Hughes
1d18e9cc0a Add missing file from previous change.
Change-Id: Id25000162a9ed76ce756842bdc09fe9afff9528f
2014-02-18 15:48:56 -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
Elliott Hughes
915fefb62e Fix x86 build.
Change-Id: Iee6e5884288f7da6c955694cfe32fecfd9c9e263
2014-02-18 12:34:51 -08:00
Colin Cross
3d19a8319b bionic: fix __set_errno for arm64 syscalls that return a 64-bit value
bionic/libc/arch-arm64/syscalls/read.S ends with:
    b.hi __set_errno
    ret
END(read)

If __set_errno returns int, it will set w0 to 0xFFFFFFFF, which means
x0 is 0x00000000FFFFFFFF.  When interpreted as a ssize_t that is
INT_MAX, not -1.

Change __set_errno to return long, which will cause x0 to be set instead
of w0.

Change-Id: I9f9ea0f2995928d2ea240eb2ff7758ecdf0ff412
2014-02-18 12:11:38 -08:00
Elliott Hughes
671e236d5f Restore sys_signame for LP64.
mksh is using this, and we probably build as much BSD source as glibc source.

Change-Id: I400d255a67f9614ca9e57090e3a2e49d2b10cba4
2014-02-12 19:04:27 -08:00
Elliott Hughes
aa0ebdafc7 Clean up sys_signame and sys_siglist a little.
We don't need quite so much duplication because we already have a way
to get the signal number from its name, and that already copes with the
fact that the mips/mips64 numbers are different from everyone else's.

Also remove sys_signame from LP64. glibc doesn't have this BSD-ism.

Change-Id: I6dc411a3d73589383c85d3b07d9d648311492a10
2014-02-12 17:09:25 -08:00
Christopher Ferris
f04935c85e Make sure that the same tests are on all platforms.
In order to be able to generate a list of tests for cts, the same set of
tests must exist across all platforms. This CL adds empty tests where a
test was conditionally compiled out.

This CL creates a single library libBionicTests that includes all of
the tests found in bionic-unit-tests-static.

Also fix a few missing include files in some test files.

Tested by running and compiling the tests for every platform and
verifying the same number of tests are on each platform.

Change-Id: I9989d4bfebb0f9c409a0ce7e87169299eac605a2
2014-02-06 20:12:21 -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
Elliott Hughes
718a5b5495 Fix pthread_test to work with gtest 1.7.0.
Now we're building it correctly configured, gtest takes a couple of
TLS slots for itself.

Change-Id: I1c2c4e9e5f9c6e2e2e6ecd1214cfc16a5af5afed
2014-01-28 17:02:03 -08:00
Elliott Hughes
431166d995 Fix 32-bit mmap/mmap64 handling of negative offsets.
We don't actually need to worry about sign extension if we reject
negative values ourselves. Previously it was possible to come up
with negative but aligned values that we would pass to the kernel;
in the case of mmap (as opposed to mmap64) we'd incorrectly turn
those into large positive offsets.

Change-Id: I2aa583e0f892d59bb77429aea8730b72db32dcb0
2014-01-27 16:36:56 -08:00
Elliott Hughes
e2a292d278 Remove __STDC_FORMAT_MACROS and __STDC_LIMIT_MACROS guards (and fix SIZE_MAX for LP64).
The various committees decided that everyone should get all these macros,
all the time.

Bug: 12708004
Change-Id: Ib56010dcba9b0656e5701546fefb7f78dc0bf916
2014-01-24 16:38:07 -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
5f1322cecf Merge "Pass a valid stack pointer to __bionic_clone in pthread.__bionic_clone" 2014-01-06 23:37:21 +00:00
Chris Dearman
dd00364807 Pass a valid stack pointer to __bionic_clone in pthread.__bionic_clone
__bionic_clone modifies the child stack before cloning so the stack
pointer should be valid. The test is expecting an EINVAL error to be
generated from the incorrect flags: CLONE_THREAD set without
CLONE_SIGHAND.

Change-Id: Ic02192081f6f52df6f03d9810efa82d923247a11
2014-01-04 13:14:35 +00:00
Elliott Hughes
894f8cb139 Fix dev_t (for LP64).
32-bit Android's dev_t was wrong too. We can't fix that without ABI breakage,
but we can at least fix 64-bit Android. And add tests.

Bug: https://code.google.com/p/android/issues/detail?id=54966
Change-Id: Ie2e42cc042b78b669a1a44e55f959dbd9c52c5c9
2014-01-03 14:49:37 -08:00
Elliott Hughes
6ad8f76f1f Don't abort in stdio.getdelim_invalid and stdio.getline_invalid.
Change-Id: Ie1aefed732f4bea77887bddd1be9a0578e247aa3
2013-12-19 14:56:17 -08:00
Elliott Hughes
e7c59f9e20 Fix compilation of crtbegin.c and pthread_debug.cpp.
Because there was no default := for the aarch64 libc_crt_target_cflags,
the += was causing libc_crt_target_cflags to be recursively-defined
variable, which meant that when we were compiling crtbegin.c LOCAL_PATH
would be bionic/tests/ and we'd have -Ibionic/tests/include/ and find
none of our include files.

Also fix linking of pthread_debug.cpp, at least in the disabled mode.
The enabled mode was already broken for all architectures, and continues
to be broken after this change. It's been broken for long enough that
we might want to just remove it...

(aarch64 is using the FSF linker where arm uses the gold linker.)

Change-Id: I7db2e386694f6933db043138e6e97e5ae54d4174
2013-12-18 09:47:44 -08:00
Marcus Oakland
e365f9d654 AArch64: Linker64 support for AArch64
Addition of support for AArch64 in the linker64 target.

Change-Id: I8dfd9711278f6706063e91f626b6007ea7a3dd6e
Signed-off-by: Marcus Oakland <marcus.oakland@arm.com>
2013-12-17 15:02:43 -08:00
Serban Constantinescu
282e232e2a AArch64: Add fixes to bionic/tests
This patch adds minor fixes to the bionic unit tests.

Change-Id: Ie10f33c631ed6c10987923d678711d22931ddb05
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
2013-12-16 17:40:30 -08:00
Elliott Hughes
1887621de8 PTHREAD_KEYS_MAX cleanup.
I fixed this bug a while back, but didn't remove it from the list,
could have added a better test, and could have written clearer code
that didn't require a comment.

Change-Id: Iebdf0f9a54537a7d5cbca254a5967b1543061f3d
2013-12-12 12:51:08 -08:00
Colin Cross
a84f88f098 Merge "bionic: move benchmarks out of tests directory" 2013-12-11 19:05:25 +00:00
Colin Cross
bd3efbc9b5 bionic: move benchmarks out of tests directory
Change-Id: I4d054965198af22c9a9c821d1bc53f4e9ea01248
2013-12-10 18:24:30 -08:00
Christopher Ferris
e5bbb6b6ab Add strcmp/memcmp testing.
Bug: 9797008
Change-Id: I11b1da060d29f7dacbb53f20a3e2082395b5bd8a
2013-12-03 18:42:41 -08:00
The Android Open Source Project
f00c938c7f Merge commit '811b0cdb2d6e4a697dbc63a678712759dd0db242' into HEAD
Change-Id: I786944f80fb1a2d502fed51dc2c391ed5db66761
2013-11-22 13:38:33 -08:00
Narayan Kamath
9d70ddc466 Merge "Add test case for 1^NaN" 2013-11-19 09:56:53 +00:00
Elliott Hughes
303fe0cb38 Merge "Fix pthread_join." 2013-11-19 03:49:00 +00: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
Narayan Kamath
af64dad479 Add test case for 1^NaN
Should be 1.

Change-Id: I6cf723a419f51d3bda58286a538774b71276c7b5
2013-11-18 19:00:59 +00:00
Christopher Ferris
cbd85b9cc1 Modify tests for another glibc difference.
It turns out that when passing a closed file to getdelim or getline, the
functions in glibc will properly return a failure, but errno might not be
set. Skip the errno check except on bionic.

Change-Id: I8d625f15303d4c2d42e8d28491ea8a368aea4d32
2013-11-15 16:09:44 -08:00
Christopher Ferris
e39e3a77d6 Merge "Add new tests for memory/string routines." 2013-11-15 22:47:07 +00:00
Elliott Hughes
70b24b1cc2 Switch pthread_create over to __bionic_clone.
Bug: 8206355
Bug: 11693195
Change-Id: I04aadbc36c87e1b7e33324b9a930a1e441fbfed6
2013-11-15 14:41:19 -08:00
Christopher Ferris
b687ad3c34 Add new tests for memory/string routines.
Create a few generic testing functions to allow any memory/string tests
to be created.

Add alignment tests for memcpy/memset/strcat/strcpy/strlen.

Add an overread test for memcpy/strcat/strcpy/strlen. This test attempts
to verify that the functions do not read past the end of their buffers
(src buffer in the case of src/dst functions).

Bug: 9797008

Change-Id: Ib3223ca1b99e729ae8229adc2d03f4dc3103d97c
2013-11-15 10:36:21 -08:00
Elliott Hughes
6a8f00d49c Add unit tests for pow's behavior with NaNs.
Bug: 11669804
Change-Id: Idfa6527640c8d0c2cf3e5343bf7afe013e237545
2013-11-13 13:29:23 -08:00
Elliott Hughes
e61dc71efc Add a unit test for syscall(2).
Change-Id: Ic7d9735d46711af93c3a1747de7b2eb8cebea094
2013-11-13 13:14:31 -08:00
Elliott Hughes
2ed710976c Add extra regression tests for an already-fixed dynamic linker bug.
Bug: https://code.google.com/p/android/issues/detail?id=61799
Change-Id: I84af68f8430a06e999297c2e57e06ecb45adf81e
2013-11-11 15:48:06 -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
Sergey Melnikov
ebd506c69e Fix linker crashes during unknown symbol lookup
Integration of kernel VDSO into internal bionic data structures using
common functions.
Fix for dl_iterate_phdr function: the function provides incorrect
address of object in case of nonzero virtual and base addresses.
Location in address space of a particular program header should be
calculated using the formula:  addr = base_addr + virtual_addr.

Signed-off-by: Sergey Melnikov <sergey.melnikov@intel.com>
Change-Id: Ie2ab4257fd456242aab8afed0bd5bd6b29e81d6d
2013-10-31 15:06:20 -07:00
Elliott Hughes
c3f114037d <pthread.h> fixes and pthread cleanup.
<pthread.h> was missing nonnull attributes, noreturn on pthread_exit,
and had incorrect cv qualifiers for several standard functions.

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

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

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

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

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

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

Change-Id: Idc0ae7f5d8aa65989598acd4c01a874fe21582c7
2013-10-31 12:31:16 -07:00
Christopher Ferris
13613137bc Fix up failing glibc tests.
There is a known bug running clone with the CLONE_VM flag, so for host
create an empty test.

Change the expected output of the stdio test for a glibc difference.

Change the pause test to use ScopedSignalHandler to setup/restore the SIGALRM
handler.

After this, running bionic-unit-tests-glibc passes for all tests.

Bug: 11389824

Change-Id: Ib304eae4164115835a54991dfdca5821ecc3db5e
2013-10-29 14:55:11 -07:00
Elliott Hughes
27586ebe1a Fix utime/utimes when passed a NULL pointer.
Bug: 11383777
Change-Id: If944a42f3adfa8a6ce91c167c249e009ed63300a
2013-10-28 13:21:06 -07:00
Christopher Ferris
b38e4d536f Update running bionic unit tests on host.
Add a bionic-unit-tests-glibc-run target to run the glibc bionic unit tests.

Modify the bionic-unit-tests-run-on-host to make sure that the /system/bin
directory is created properly.

Also remove the EXTERNAL_STORAGE variable which isn't used any more.

Bug: 11234772
Change-Id: I9aea501d05700b29e938f672474d550b1872a78b
2013-10-25 10:23:12 -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
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
594b1a4af2 Make sure we have a mkfifo symbol.
Bug: https://code.google.com/p/android/issues/detail?id=58888
Change-Id: Ic0a883a5f30beb82cb7be3c4e81b6d693d5fbb4d
2013-10-22 12:03:19 -07:00
Elliott Hughes
3d305f1d62 Fix statvfs tests for the host.
Using /proc seems like a better idea because it's more similar across devices.
I've switched to ensuring we check the initial and final elements in the struct
too, so we have more reason to believe the whole struct is converted correctly.

Change-Id: Ia23403369485747c1452292f6c9df2bb233c04fb
2013-10-21 19:27:19 -07:00
Elliott Hughes
e4375196d6 Fix the system property tests to use $ANDROID_DATA.
This lets them work on the host.

Change-Id: I771ccc67652ae37451b45859c7831116cd830086
2013-10-21 17:40:15 -07:00
Elliott Hughes
53bfdae4ff Fix the x86_64 clone implementation.
Change-Id: Ia75f46dcb4d3222049e9a6a6fabc2b17223b47f7
2013-10-18 19:39:09 -07:00
Elliott Hughes
0c40152767 Fix the time unit tests for systems with 64-bit time_t.
Change-Id: I29df50b25d022c1c00906e71b612defa58e46e81
2013-10-18 16:21:54 -07:00
Pavel Chupin
17558dec7f x86_64: Fix bionic tests build-and-run
Change-Id: Iab48362893a212afbcbc362fdfaff5bfa5b55259
Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>
2013-10-18 15:04:19 -07:00
Elliott Hughes
925753aa11 Fix some test assumptions that are wrong for __LP64__.
Change-Id: Ic79cd5858ceb611640a76bd03f3da4925d3150d9
2013-10-18 13:17:18 -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
6b9321b858 am d6e117b6: am 1f29c2f5: Merge "Switch sigpending over to rt_sigpending."
* commit 'd6e117b64bdfbf8d793eb59ea9604b806608ec75':
  Switch sigpending over to rt_sigpending.
2013-10-16 16:09:42 -07:00
Elliott Hughes
40d105ccb3 Switch sigpending over to rt_sigpending.
Change-Id: I7b28984796b5fb343cfbcc47e0afc3a84293d417
2013-10-16 14:07:01 -07:00
Elliott Hughes
afaebc3fef am 87fc78de: am 608c65f6: Merge "Fix sigsuspend to use rt_sigsuspend on all platforms."
* commit '87fc78de6c869d0403ccdd2e756ec1f5d456f3d3':
  Fix sigsuspend to use rt_sigsuspend on all platforms.
2013-10-15 18:20:32 -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
4681f8244e am 5b3f1d8b: am 22b83da4: Merge "Clean up the sigprocmask/pthread_sigmask implementation."
* commit '5b3f1d8b3a6a1caf059dc376e4967a27ddd57dac':
  Clean up the sigprocmask/pthread_sigmask implementation.
2013-10-15 14:16:02 -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
Stephen Hines
8161b23689 am 4691325d: am abeafbd6: Merge "Wrap sprintf()/snprintf() macros to prevent expansion errors."
* commit '4691325d48406033632fe84a944ac9c3bd2e5097':
  Wrap sprintf()/snprintf() macros to prevent expansion errors.
2013-10-11 16:33:07 -07:00
Stephen Hines
78f6db64fe am 36959302: am 8704ada3: Merge "Fix clang warnings in bionic."
* commit '36959302a334499c7d2ddf4a090e2ab7e3a8ae1d':
  Fix clang warnings in bionic.
2013-10-11 16:33:03 -07:00
Stephen Hines
abeafbd6d5 Merge "Wrap sprintf()/snprintf() macros to prevent expansion errors." 2013-10-11 23:28:32 +00:00
Stephen Hines
6c7b3cb056 Fix clang warnings in bionic.
This fixes a few diverse issues that clang warns on in bionic. First,
it specifies the appropriate converted types for format specifiers.
The "h" and "hh" modifiers specify that the user is passing a short or
char respectively. We were passing int deliberately in both cases and
relying on the compiler to implicitly downcast to the smaller type.
We also remove the non-standard "d" suffix from our double-precision
floating point constant. This is an extension for gcc that clang does
not implement. The third fix is to mark the c1 variable as unused,
since it truly is neither read nor written.

Change-Id: I4793352b9d3e58f1f4cac9e7581ef4b2a70b43c7
2013-10-11 16:20:08 -07:00
Stephen Hines
6e38072add Wrap sprintf()/snprintf() macros to prevent expansion errors.
Previously, FORTIFY_SOURCE used single macros to define these standard
functions for use with clang. This can cause conflicts with other macros used
to call these functions, particularly when those macros expand the number of
arguments to the function. This change wraps our macro definitions, so that
expansion properly takes place for programmer arguments first.

Change-Id: I55929b1fd2a643b9d14a17631c4bcab3b0b712cf
2013-10-11 12:14:49 -07:00
Nick Kralevich
49bb53c8e2 am 95de0df8: am eda2679e: Merge "FORTIFY_SOURCE: fortify read()"
* commit '95de0df8c2daeefca358010f2d15c3346a5284f1':
  FORTIFY_SOURCE: fortify read()
2013-10-09 21:28:52 -07:00
Nick Kralevich
b036b5ca36 FORTIFY_SOURCE: fortify read()
Change-Id: Ic7de163fe121db13e00560adb257331bc709814d
2013-10-09 20:17:03 -07:00
Nick Kralevich
b8771d9fd8 am b35ebe3d: am 848efa9d: Merge "Revert "FORTIFY_SOURCE: fortify read()""
* commit 'b35ebe3d7097899fd4498ebb2b93e48fd836ebcf':
  Revert "FORTIFY_SOURCE: fortify read()"
2013-10-09 16:53:05 -07:00