Commit graph

984 commits

Author SHA1 Message Date
Qiming Shi
0069f31066 Add <linux/tty.h> to libc/include/sys/ioctl.h
This is the change to export the tty ldisc definitions (like N_TTY)
from Linux uapi kernel header. So bionic is compatbile with glibc
which has its own tty ldisc definition exported through ioctl.h

Change-Id: I44e4c7cc2eba31549e9c9c75f74961a949d4a696
Signed-off-by: Qiming Shi <qiming.shi@intel.com>
Signed-off-by: Yin, Fengwei <fengwei.yin@intel.com>
2014-06-13 16:39:39 +08:00
Elliott Hughes
e61919ad11 Fix x86-64 libvpx build.
This is now fixed upstream, but we need to wait for it to come back down
via chromium...

Bug: 15598056
Change-Id: I08f1be4296c391cfc1616a5ff0815be14071594a
2014-06-12 20:07:47 -07:00
Dan Albert
72dc1c22dc Merge "Revert "Backing this one out since the counterpart needs to be sent upstream."" 2014-06-12 05:34:11 +00:00
Dan Albert
e5fdaa4f9d Revert "Backing this one out since the counterpart needs to be sent upstream."
This reverts commit a04d2bc28e.

Change-Id: I1b49165ca5d4bafdba7948818256a6167a363aca
2014-06-14 01:04:31 +00:00
Dan Albert
a04d2bc28e Backing this one out since the counterpart needs to be sent upstream.
This reverts commit 5ee320dd35.

Change-Id: I1a9c6b06c3aca595f01c629f7649be743dc48e77
2014-06-14 00:51:14 +00:00
Dan Albert
5ee320dd35 Hides valloc(3)/pvalloc(3) on LP64.
These were removed from POSIX 2004. Hides the header declarations for all
targets, and hides the symbols for LP64.

Bug: 13935372
Change-Id: Id592f67e9b7051517a05f536e1373b30162e669c
2014-06-13 15:35:05 -07:00
Dan Albert
b84783ecaa Merge "Backing this one out since the counterpart needs to be sent upstream." 2014-06-12 05:34:11 +00:00
Dan Albert
65b1c90a32 Merge "Hides valloc(3)/pvalloc(3) on LP64." 2014-06-12 03:32:07 +00:00
Dan Albert
8229ae46f4 Removes wait3(2) from LP64.
wait3(2) was removed from POSIX 2004. Keep the symbol around in LP32 for binary
compatibility, but remove the declaration in sys/wait.h.

Bug: 13935372
Change-Id: Ic715fce6781aae43b4ac6d745dc6d1e6b9914e71
2014-06-13 16:04:41 -07:00
Elliott Hughes
ff17671bc6 Merge "Add a hack to <stdlib.h> until we can fix libvpx." 2014-06-12 03:32:07 +00:00
Elliott Hughes
3fb5097a7e Add a hack to <stdlib.h> until we can fix libvpx.
libvpx should probably change its assembler to refer to lrand48 directly,
because that will work on old and new versions of Android. This keeps things
building until that happens.

Bug: 15598056
Change-Id: I4a1f59e710a083b9f9a707ceeb9ca0a28141a954
2014-06-12 17:50:52 -07:00
Elliott Hughes
564222e338 Merge "Use default hidden visibility to build libc_dns." 2014-06-12 05:34:11 +00:00
Elliott Hughes
8563802b04 Use default hidden visibility to build libc_dns.
Bug: 11156955
Change-Id: Ia443705f5fbee0681039d4480abc89850968f475
2014-06-12 13:35:41 -07:00
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
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
Elliott Hughes
2c02d0057c Merge "Add __pure2 to a few more functions, most notably gettid and pthread_self." 2014-06-10 22:15:14 +00:00
Elliott Hughes
b27a840f4b Add __pure2 to a few more functions, most notably gettid and pthread_self.
Change-Id: I7eee9f26f45130038af09d8285782b07f70a996f
2014-06-11 16:32:10 -07:00
Dan Albert
cd32219c5b Remove declarations related to cuserid(3).
cuserid(3) was removed from POSIX 2004, and we don't have an
implementation anyway.

Bug: 13935372
Change-Id: I7ac7cde931ba802d0d5b917c22f5116618b21d2f
2014-06-11 13:20:18 -07:00
Elliott Hughes
a382a792a4 Hide non-standard syslog API.
The definitions are still available on LP32 for binary compatibility, but
they're gone on LP64, and the declarations are gone everywhere.

We should probably just make syslog(3) log to the regular Android log,
but that's a job for another day.

Bug: 11156955
Change-Id: I74a98c92f7922ea733549ec6d37c6fa8b7014860
2014-06-09 17:42:14 -07:00
Elliott Hughes
47ba295b06 Rewrite and hide longjmperror.
This shouldn't be public API, isn't supported on x86/x86_64, and it's
unlikely anyone would have actually seen the message before anyway.
Using __libc_fatal makes it much more likely to be seen.

Bug: 11156955
Change-Id: Icf7f654b22a7dacd89668b60c11e5705c7215c08
2014-06-06 16:49:39 -07:00
Elliott Hughes
3d5cb30d23 Remove getdents from bionic.
Bug: 11156955
Change-Id: I6c306989801be552d85fba8a50dcdc79282fb9d2
2014-06-06 15:05:58 -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
Dan Albert
40fca0f08b Removes index() from bionic.
This function has been removed from POSIX.

Unfortunately, we can't leave #define index(a, b) strchr((a), (b)) in its place
because defining a preprocessor macro for index() breaks a whole lot of code.

Bug: 13935372
Change-Id: Ifda348acde06da61c12e7ee2f8fe6950a3174dd1
2014-06-05 11:05:10 -07:00
Dan Albert
205dd7d9b3 Remove bsd_signal and sysv_signal from bionic LP64.
bsd_signal was removed in POSIX 2008, sysv_signal was never POSIX.

Bug: 13935372
Change-Id: I7688e5cc317247ff075dcf99b598f515fb4f15c4
2014-06-05 08:21:17 -07:00
Dan Albert
0921204660 Revert "Remove ftime from bionic LP64"
Breaking some build... will look in to it later.

This reverts commit 26d6799bbe.

Change-Id: I35fa770221be3a181bd37c6c3dce1bf37a69a4a1
2014-06-05 00:50:43 +00:00
Dan Albert
26d6799bbe Remove ftime from bionic LP64
Bug: 13935372
Change-Id: I5dd31147143b23a090a3b75b846dc5354e599121
2014-06-04 16:25:24 -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
Dan Albert
ce9ce28e5d Removes bcopy and bzero from bionic.
These symbols are still defined for LP32 for binary compatibility, but
the declarations have been replaced with the POSIX recommended #defines.

Bug: 13935372
Change-Id: Ief7e6ca012db374588ba5839f11e8f3a13a20467
2014-06-03 17:22:07 -07:00
Elliott Hughes
b4e099c6f7 Remove issetugid.
Bug: 14569474
Change-Id: I752c77ed53c724f144f0b618443eb95e87f2929a
2014-05-29 16:43:01 -07:00
Calin Juravle
bdca3802c9 Remove unnecessary padding in ucontext_t
- removed extra padding from ucontex_t on x86, x86_64 and mips
- force ucontext_t struct to use 64 bits for the sigmask on all arches
(previsouly wrong since sigset_t on arm and x86 is only 32 bits)
- arm and arm64 continue to use padding to match glibc sigset_t

This brings Bionic on par with the kernel w.r.t ucontext padding.

Bug: 12828904
Change-Id: Ia8915ace694ecb4695603a334e697985f4c3e7aa
2014-05-28 17:24:28 +01:00
Dan Albert
a7821b7121 Use __typeof__() instead of typeof()
typeof() is a gcc builtin and is not always available (such as clang when
-std=c*). Both gcc and clang always expose __typeof__(), so just use that.

Change-Id: I75e2a990acc35f6f39b2c353f6548100ec03c67f
2014-05-27 12:47:54 -07:00
Elliott Hughes
e6c57fcb05 Add C11 <stdatomic.h>.
Bug: 14903517
Change-Id: I631dbfdaa698cf7fea8e3b5e18a32586383e62a5
2014-05-23 20:06:03 -07:00
Elliott Hughes
c3f909630b Remove <sys/atomics.h>.
Bug: 14903517
Change-Id: I6de1d9d3624922517fdc37922097abbc3b41f661
2014-05-23 14:36:30 -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
Calin Juravle
254fa8857f Merge "Switch to POSIX dprintf/vdprintf." 2014-05-22 13:28:52 +00:00
Elliott Hughes
fcac8ff97f Switch to POSIX dprintf/vdprintf.
Bug: 11156955
Change-Id: I734bd02db514367ab119a48304aae9767958e367
2014-05-22 11:27:06 +01:00
Calin Juravle
d1dc009c56 Merge "Add padding to mips ucontext_t." 2014-05-22 10:16:41 +00:00
Calin Juravle
156c7d3d0a Merge "Clean up ucontext.h TODOs." 2014-05-22 10:16:12 +00: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
Elliott Hughes
d5ed63a6a8 Hide most of the private futex functions.
Also hide part of the system properties compatibility code, since
we needed to touch that to keep it building.

I'll remove __futex_syscall4 and futex in a later patch.

Bug: 11156955
Change-Id: Ibbf42414c5bb07fb9f1c4a169922844778e4eeae
2014-05-21 18:30:00 -07:00
Calin Juravle
ae0f8f1e48 Add padding to mips ucontext_t.
Bug: 12828904
Change-Id: I49e7adcebf769a9c30dc43def36501260369b1ac
2014-05-21 18:16:17 +01:00
Calin Juravle
eb454522da Clean up ucontext.h TODOs.
There's no need to expose gregset_t and fpregset_t when they
are not used in ucontext_t.

Bug: 12828904
Change-Id: Ieda1edf0ab18015f444c4d385fe9c41c4544017f
2014-05-21 18:15:35 +01: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
Calin Juravle
0e85fb6121 Add uc_regspace to arm's ucontext_t
Bug: 12828904
Bug: 12875898
Change-Id: Ic5d532bd0ef58cad9e36a99fc2995c4b069121b2
2014-05-19 19:14:03 +01:00
Calin Juravle
a6ab968ca0 Fill in missing bits in x86(_64) ucontext_t
Bug: 12828904
Bug: 12875898
Change-Id: I0ec0dfe16af80bfb3153f3c3b1b3d180eff30f39
2014-05-15 10:34:06 +01:00
Andrew Hsieh
9b5b40b4df Rename user_i387_struct -> user_fpregs_struct in sys/ucontext.h
See 93e1907ae1

Change-Id: Icb207f4e17cfffdd6d37500656434adf1cc34427
2014-05-15 09:11:11 +08:00
Christopher Ferris
ea5248ee1b Increase minimum thread size for 64 bit.
Bug: 14468519
Change-Id: I642a5515acf5fbed46e77e176f6b5dd3b7c7bd45
2014-05-14 18:02:11 -07:00
Ross McIlroy
bac795586b Merge "Fix x86_64 user_fpregs_struct to use the same name for the tag word as glibc." 2014-05-14 14:27:41 +00:00
Ross McIlroy
0c8a5f82e6 Fix x86_64 user_fpregs_struct to use the same name for the tag word as glibc.
Glibc calls the tag pointer in user_fpregs_struct ftw instead of twd.

Change-Id: I4a8dab777fa889de0b9927035cd18557ae6f3263
2014-05-14 13:29:19 +01:00
Calin Juravle
a731877406 Merge "Change wctype_t from int to long." 2014-05-14 10:33:46 +00:00
Calin Juravle
fd3171b465 Merge "Change wctype_t from enum to int" 2014-05-14 10:33:35 +00:00
Elliott Hughes
135b103fd9 Fix <sys/endian.h> uint32_t build failures.
Change-Id: I833b51318f0bf7749073859b7ffacc668c27558e
2014-05-13 18:42:12 -07:00
Elliott Hughes
17f8ef87b5 Merge "Flesh out <arpa/inet.h>." 2014-05-14 01:09:01 +00: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
eed3d0d1f3 We don't need two copies of <nsswitch.h>.
Change-Id: I3f874326d96f41249f5c9b1b3c2885f858589029
2014-05-13 18:05:29 -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
f34f0ccb0e Merge "Use __LP64__ instead of __LP32__ in sched.h" 2014-05-13 17:16:30 +00:00
Calin Juravle
dd09699fae Use __LP64__ instead of __LP32__ in sched.h
Gcc defines only __LP64__ so testing __LP32__ will always be false.

Bug: 14881256
Change-Id: Ic63c1d562be09c3eb4b9e17c9e5ef2d9e404db80
2014-05-13 16:07:28 +01:00
Calin Juravle
b55f2631dc Change wctype_t from int to long.
On LP64 this brings us on par with the other libcs where wctype_t is 8
bytes.

Bug: 12875898
Change-Id: Ice4f538ccf0634ef6667a8d90d0f7f09cec9e1b0
2014-05-13 13:11:27 +01:00
Calin Juravle
0c472479a2 Change wctype_t from enum to int
This increases bionic source compatibility with other libcs where
"wctype_t foo = 0;" is valid without -fpermissive.

Bug: 14646243
Change-Id: Ia9bd0785bc42c7b46e2bb6c3d9b9a9d3f769d983
2014-05-13 12:47:27 +01:00
Calin Juravle
f963da22ec Undef private *_BODY defines after use
Bug: 14865741
Change-Id: I1398f7b3f64e3c94f2714cede5b61205dfa78a24
2014-05-13 11:01:11 +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
Calin Juravle
d67c6af2f6 Merge "Reserve space for the future in statvfs(64)" 2014-05-12 09:59:57 +00:00
Calin Juravle
7bec1212c7 Reserve space for the future in statvfs(64)
The kernel struct has some spare space at the end too, and some extra
fields, so having a bit of flexibility in statvfs might be worthwhile.

Bug: 14681331
Bug: 12875898
Change-Id: I5b502c5dd9d2e3bb8f34804f83c02669cefce01e
2014-05-12 10:56:39 +01: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
4aa2e6a32a Give bionic's __ANDROID_API__ a more reasonable value.
This matches what frameworks/base does with Build.VERSION and means that
bionic's version number will always sort >= than any released version.
This should prevent confusion in code that builds both against bionic
and the NDK.

(Note that <sys/cdefs.h> drags this in, so it's always in the namespace.)

Bug: 14613709
Change-Id: I91fb745920e848a6b20f2f5797c0a7d6cde6c032
2014-05-07 12:57:51 -07:00
Calin Juravle
e292875cf5 Merge "Reserve some space in sem_t for the future." 2014-05-07 14:04:32 +00:00
Calin Juravle
b6c48b20e4 Merge "Allow for better utmp logging." 2014-05-07 14:04:22 +00:00
Calin Juravle
fc2af0ca47 Merge "Fix ino_t and suseconds_t" 2014-05-07 14:04:12 +00:00
Calin Juravle
6726862e9a Fix ino_t and suseconds_t
Align ino_t and suseconds_t definitions with kernel
and OpenBSD upstream.

Bug: 14583346
Bug: 12875898
Change-Id: I0d97c6b4fc85b261472575290e6f6f2df1c8a36a
2014-05-06 18:41:26 +01:00
Calin Juravle
0686d5e26f Reserve some space in sem_t for the future.
Reserve 12 more bytes in sem_t to give room for future implementation
improvements. This gets us to a 16 bytes sem_t. Glibc uses 32 bytes (16
actual use + 16 reserved), while OpenBSD has 16 bytes (out of which 4
are for padding).

Bug: 14587103
Bug: 12875898
Change-Id: Id835cc5abf874c651e6b5ad5b8f29c9d6ab08d5a
2014-05-06 16:24:27 +01:00
Calin Juravle
7d8f303353 Allow for better utmp logging.
Increase (UT_NAMESIZE,UT_LINESIZE,UT_HOSTSIZE) to (32,32,256).

Nobody writes utmp on Android but it would be nice to be aligned
with others who use 32,32,256 (like glibc). If ever used it will produce
nicer logging. There is no consensus in BSDs for these values.

Bug: 14584341
Bug: 12875898

Change-Id: I94af10b982b8f9fcaea897c4cf968563f38403f9
2014-05-06 15:44:14 +01:00
Calin Juravle
7c435f2415 Leave more space for extensions in pthread_rwlockattr_t
Change pthread_rwlockattr_t from int to long. On LP64 this gives us more
room for extensibility since longs are 8 bytes. glibc also reserves 8
bytes for this.

Bug: 14582681
Bug: 12875898
Change-Id: I55d599be0fdbbf0cb55957ec0ea62ab042bdee94
2014-05-06 13:40:24 +01: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
52defb7c70 Remove the non-standard time64 stuff for LP64.
We need a workaround in strftime as long as we still need to support
64-bit times on LP32.

Change-Id: I8ffb616f6312d4063fb9ea3c36b52653e8f4c5f8
2014-05-05 17:14:02 -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
Dan Albert
4566731772 Merge "Adds quick_exit(3) and at_quick_exit(3) from freebsd" 2014-04-30 15:39:14 +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
Calin Juravle
d4ae59dcf2 Merge "Reserve space in mbstate to allow for proper wchar support" 2014-04-30 10:34:09 +00: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
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
Calin Juravle
eab395e4a8 Reserve space in mbstate to allow for proper wchar support
Bug: 14382788
Change-Id: If023ac9bb65f95135cae7ebe89147e3985a69a96
2014-04-29 20:28:29 +01:00
Calin Juravle
b1cacd4245 Reserve space in pthread structures for future extensibility.
Make our structures equal in size with glibc structures. This should
give us plenty of space to implement any missing feature.

Bug: 13278744
Bug: 12875898
(cherry picked from commit cf83fd77ca)

Change-Id: I76968d31024eb51bc73887687e5ac492eb02a27f
2014-04-24 22:07:52 +00:00
Greg Hackmann
ab290718e3 Merge "Revert "Reserve space in pthread structures for future extensibility."" 2014-04-24 18:12:28 +00:00
Greg Hackmann
6b64000ef0 Revert "Reserve space in pthread structures for future extensibility."
This reverts commit cf83fd77ca.

Change-Id: I4f69e86ffe1c267a9018eb489d909237534c6cf9
2014-04-24 18:11:23 +00:00
Calin Juravle
477d14b092 Merge "Reserve space in pthread structures for future extensibility." 2014-04-24 11:35:37 +00:00
Calin Juravle
cf83fd77ca Reserve space in pthread structures for future extensibility.
Make our structures equal in size with glibc structures. This should
give us plenty of space to implement any missing feature.

Bug: 13278744
Bug: 12875898
Change-Id: I980017fd5942411ebc5ac32b2673a10a20db68c8
2014-04-23 18:46:50 +01:00
Elliott Hughes
532ad903d2 Merge "Switch to the upstream OpenBSD getenv/putenv/setenv implementation." 2014-04-23 01:52:06 +00:00
Elliott Hughes
eae5902e73 Remove strntoimax and strntoumax from the future.
Where do these turds come from?

Change-Id: Id9ad2cc85c6128aa63b5d56ff2aa455bde39a5eb
2014-04-22 17:56:42 -07:00
Elliott Hughes
58d9e280d4 Switch to the upstream OpenBSD getenv/putenv/setenv implementation.
This fixes all the bugs found by the new tests.

Change-Id: Id5a5f9f39a0620208bafa053f871a044725b4795
2014-04-22 17:41:00 -07:00
Elliott Hughes
8d77bce185 LP64 shouldn't include the non-standard <time64.h> cruft.
This patch includes just enough to keep external/chromium_org building
until they switch 64-bit Android over to using the regular non-Android code.

Change-Id: Iecaf274efa46ae18a42d5e3439c5aa4f909177c1
2014-04-22 13:55:58 -07:00
Elliott Hughes
cce36c1878 Use -fvisibility=hidden to build libc_gdtoa.
Bug: 12177745
Change-Id: Ia4ac71e1a3a237e764c809cc591622f8952ed642
2014-04-22 12:32:49 -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
Torne (Richard Coles)
16f6429c38 Merge "Add android_dlopen_ext() interface to linker." 2014-04-22 10:33:07 +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
Dan Albert
db68e56997 Brings LC_* defs into line with POSIX
POSIX requires that LC_* constants be defined as macros, and libc++ is testing
for this. Source: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/locale.h.html

Change-Id: Id0653e54d74f12179ef88cadf7b5d6ba1bae3cdb
2014-04-18 21:48:57 +00:00
Dan Albert
0e351e4011 Merge "Changes our ctype identifiers to match the BSDs" 2014-04-18 15:52:59 +00:00
Dan Albert
779585fb26 Changes our ctype identifiers to match the BSDs
This is to make it possible to adopt the BSDs' implementations for a few locale
APIs in libc++ rather than writing our own, nearly identical, code.

Change-Id: I482acd4ece83aa4ec9eb0c7acf48f3686794bcc3
2014-04-18 08:48:34 -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
Torne (Richard Coles)
012cb4583a Add android_dlopen_ext() interface to linker.
Add a function "android_dlopen_ext()", defined in <android/dlext.h>.
This is an extended version of dlopen() which takes a struct for passing
additional parameters for Android-specific functionality. This will be
used to support RELRO section sharing between separate processes.

Bug: 13005501
Change-Id: I9c99b2f2a02ee329dedaeba09ef3a1113b17b2d6
2014-04-17 13:50:55 +01:00
Elliott Hughes
cb65cc3fb4 Clean up <machine/ieee.h>.
The upstream intention was for this to be architecture-dependent, but it's a
lot clearer if we just have one copy.

Change-Id: I4e8310496145f9f411cd2e847c8cd023b1d758e9
2014-04-16 16:31:17 -07:00
Elliott Hughes
40b0579127 Add iswblank for libcxx.
We have similar degenerate implementations for all the other isw* functions,
so it's weird to exclude just one.

Change-Id: I659b97930e68598826c4882bb59f4146870fb6a0
2014-04-15 12:04:05 -07:00
Elliott Hughes
93e1907ae1 Use the glibc name user_fpregs_struct.
Instead of the kernel name user_i387_struct.

Bug: 13889008
Change-Id: Ideec2e1ce36c1faa4b5b2db1999ad2b23757ca4d
2014-04-09 16:35:36 -07:00
Elliott Hughes
c5992a036b Fix mcontext_t for x86-64.
Change-Id: I1ac0e7f44bcdd06a07862993e92c3048a7474a8b
2014-04-09 13:27:48 -07:00
Calin Juravle
a5d83312bd Merge "Use glibc structure for __cmsg_nxthdr." 2014-04-09 06:06:48 +00:00
Elliott Hughes
b52a4ab4e2 Merge "Flesh out <locale.h>." 2014-04-09 04:13:43 +00: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
Calin Juravle
ff64831b09 Use glibc structure for __cmsg_nxthdr.
Bug: 13418328
Change-Id: I7e656b373e53e80d708325321e48dcedacf5086d
2014-04-09 00:55:24 +03: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
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
5f149f1bde Merge "Implement wctomb(3) for ltrace." 2014-04-07 21:39:38 +00:00
Elliott Hughes
50249bca00 Fix build: __unused isn't unused!
Change-Id: I57f2b755d1b2509f9c5504b12a5ff6c50b78b375
2014-04-07 14:36:59 -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
Elliott Hughes
5c7bda5c61 Fix aarch64 struct ucontext.
Change-Id: I6f0959723a753e8c788275709e7245c103ff88d1
2014-04-07 12:12:00 -07:00
Elliott Hughes
caa15bfe2d Define __WORDSIZE like glibc.
Requested by Google Breakpad, but seems to be assumed to be defined
in various places in the AOSP tree already; iputils, wpa_supplicant,
et cetera.

Change-Id: I1f7833c98e0af4c77e49744c08b8239061c9a571
2014-04-03 13:59:14 -07:00
Robert Greenwalt
804b95e535 Merge "bionic: Replace iface with opaque netid in resolver." 2014-04-03 17:05:32 +00:00
Elliott Hughes
1b0dc40980 Remove <machine/limits.h>.
Change-Id: I7f9e9538517f726d4f08bf1f4b8d57c54d3f1676
2014-04-01 17:16:59 -07:00
Szymon Jakubczak
ea9bf67881 bionic: Replace iface with opaque netid in resolver.
Replace iface cache key with netid.

Replace _mark with netid.

Mark sockets used to test IPv4/IPv6 support as well as sockets
used to determine source address for rfc6724 sort.

Remove pid/uid mappings (functionality moved to system/netd).

Do not create resolv_cache when it does not exist, but rather only
when DNS configuration is supplied.

Clean up unused functions.

Change-Id: I9ccfda2902cc0943e87c9bc346ad9a2578accdab
2014-04-01 16:25:49 -04:00
Elliott Hughes
7f3a272ae3 Add lsearch(3) for ltrace.
Bug: 13746936
Change-Id: I833c6ba70a1752c04dab7de389f5bebb741662b3
2014-04-01 12:40:00 -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
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
Christopher Ferris
bc475bc8d1 Merge "Add accept4() syscall" 2014-03-26 19:40:59 +00:00
Calin Juravle
ecbf00bda2 Merge "Clean up CMSG_*HDR in <sys/socket.h>" 2014-03-26 14:24:01 +00: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
Calin Juravle
f1de90b3a2 Clean up CMSG_*HDR in <sys/socket.h>
Removed __CMSG_NXTHDR, __CMSG_FIRSTHDR and cmsg_nxthdr.

Bug: 13418328
Change-Id: I6b1ed58b41b3f37d41e070c4f222b5bfa512bc48
2014-03-25 17:07:37 +00:00
Calin Juravle
9e8a8dc18c Merge "Remove ALIGNBYTES and ALIGN from <sys/param.h>" 2014-03-24 12:11:30 +00:00
Calin Juravle
c20de90287 Remove ALIGNBYTES and ALIGN from <sys/param.h>
There are only three users of bionic definition of ALIGN and keeping it
in sys/param.h polutes the namespace.

I inline the definition in the the three places that's used.

Bug: 13400663
Change-Id: I565008e8426c38ffb07422f42cd8e547d53044e9
2014-03-21 09:59:34 +00:00
Nick Kralevich
7eb28b59c7 FORTIFY_SOURCE: don't define s?printf macros if already defined
Clang specific: Don't #define sprintf and snprintf macros if they
are already defined.

Change-Id: I30fc507d898377e1b8a57a65a147926229e0f9e2
2014-03-18 17:03:38 -07:00
Elliott Hughes
205c7887ad Clean up reentrancy cruft.
The DNS copy of reentrant.h was unused, so remove it.

The strtod implementation can use the upstream-netbsd reentrant.h and
get a little closer to what was then upstream. (It's since been replaced
by gdtoa, and we'll have to follow at some point, but for now this doesn't
make anything any worse.)

ANDROID_CHANGES is (now) only used in the DNS code, so push the -D
down.

The <locale.h> change prevents an LP32 hack from leaking into LP64.

Change-Id: Idf30b98a59d7ca8f7c6cd6d07020b512057911ef
2014-03-13 16:17:43 -07:00
Elliott Hughes
f2cea021ab Clean up <stdio.h> macros.
Also neuter __isthreaded.

We should come back to try to hide struct FILE's internals for LP64.

Bug: 3453512
Bug: 3453550
Change-Id: I7e115329fb4579246a72fea367b9fc8cb6055d18
2014-03-13 14:54:53 -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
2282e16d76 Merge "Use [u]int32_t instead of __[u]int32_t in sys/types.h" 2014-03-12 20:48:39 +00:00
Pavel Chupin
2725ca95b2 Use [u]int32_t instead of __[u]int32_t in sys/types.h
Avoid this error in -ffreestanding mode:
sys/types.h:45:1: error: unknown type name '__uint32_t'

Change-Id: I826b36873862d1d70b47401f31f4369a77666b8e
Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>
2014-03-13 00:23:43 +04:00
Elliott Hughes
8d4b5849f2 Clean up our termios implementation.
It's safe to fix our constant definitions because we know we never
had symbols before, so can't be passing the bad old constants to the new
functions, or the correct new constants to the old inlines.

Change-Id: I858fc680df39bdd3ba471e867833bdfa71f6224e
2014-03-11 19:13:25 -07:00
Elliott Hughes
cccfe1e17c Reimplement clock(3) and switch to OpenBSD time(3).
The new implementation is a better approximation to the processor time used
by the process because it's actually based on resource usage rather than just
elapsed wall clock time.

Change-Id: I9e13b69c1d3048cadf0eb9dec1e3ebc78225596a
2014-03-11 13:37:11 -07:00
Calin Juravle
a4eafa6dbc Removed pthread_attr_getstackaddr/pthread_attr_setstackaddr
Moved existing definitions to ndk_cruft to preserve NDK compatibility.

Bug: 13281069
Change-Id: I6f260de69afa55a6274f0d13145c19ac6517b9d5
2014-03-11 10:44:36 +00:00
Elliott Hughes
247dc91889 Take ownership of various simple syscall wrappers.
None of these trivial functions is something we're going to get from BSD.

Change-Id: Iee1d1281b73db67da5ec303da7a49748121464bf
2014-03-10 17:17:01 -07:00
Elliott Hughes
152b9de19a Remove non-standard memswap.
Change-Id: I06548dda339987b755ef7139c590ca3e1f9fe0a9
2014-03-10 15:54:40 -07:00
Elliott Hughes
333e2ae87d Merge "Add si_timerid to <signal.h>." 2014-03-08 00:52:02 +00:00
Elliott Hughes
4d46c94031 Merge "Rewrite the POSIX timer functions." 2014-03-08 00:50:56 +00: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
a0cd9bc339 Add si_timerid to <signal.h>.
The kernel uses the very misleading name "si_tid", but glibc uses the more
intention-revealing "si_timerid". We should let people use that.

(Added because I wanted to improve SI_TIMER siginfo_t dumping in strace.)

Change-Id: Ib626cdd3b57a6afb276a15753a237b4e81ec45e3
2014-03-07 15:41:25 -08:00
Calin Juravle
d9ba757ef4 Merge "Sync up nameser with upstream(2014.03.05)" 2014-03-07 11:45:58 +00:00
Calin Juravle
fcb502e3ec Sync up nameser with upstream(2014.03.05)
Bug: 13219633

Change-Id: I8ee4ddf270710e9eea415fa3db984af7719a8dd4
2014-03-06 18:36:43 +00:00
Narayan Kamath
252ee1e112 Stop defining HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC.
No code is using this definition.

Change-Id: I188db63f38d62baf1cb57d0a36fcda540ad98492
2014-03-05 13:19:10 +00: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
Calin Juravle
569fb9887d Moved nameser.h and namser_compat.h to public include dir
This is part of the upstream sync (Net/Open/Free BSDs expose the
nameser.h in their public headers).

Change-Id: Ib063d4e50586748cc70201a8296cd90d2e48bbcf
2014-03-04 15:07:07 +00: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
e4ab19c67d Remove deprecated and unused constants from <sys/klog.h>.
Change-Id: I23d54b5eaf918859480f927534a3f9e3af602311
2014-03-03 10:57:28 -08:00
Elliott Hughes
a8b1eb3fcf Fix build.
Change-Id: I71cde79263d5f5a8382865b8151f65c5c05ea17b
2014-02-28 17:59:29 -08:00
Elliott Hughes
2ec592c338 Merge "Add recvmmsg and sendmmsg syscalls." 2014-03-01 01:14:23 +00:00
Elliott Hughes
692207eb45 Add getprogname/setprogname for BSD compatibility.
This is one less change we have to make when porting BSD code.

Bug: https://code.google.com/p/android/issues/detail?id=34898
Change-Id: If9b1a8d16996c7a19abcce8d3a456afc3e105a41
2014-02-28 16:23:27 -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
3434727b3e Ensure that <fcntl.h> has the SYNC_FILE_RANGE_* constants.
Needed to build strace at their tip of tree.

Change-Id: I64db00a332088e08e25bc30357293a9308b8a226
2014-02-26 15:51:01 -08:00
Elliott Hughes
5c7816f425 Merge "More OpenBSD cleanup (primarily string)." 2014-02-25 21:41:48 +00: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
53e43292aa More OpenBSD cleanup (primarily string).
This patch removes the string/ and wchar/ directories.

Change-Id: Ia489904bc67047e4bc79acb1f3eec21aa3fe5f0d
2014-02-24 18:02:05 -08: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
Narayan Kamath
c9ae21a5c3 Move system_properties over to C++.
This change constitutes the minimum amount of
work required to move the code over to C++, address
compiler warnings, and to make it const correct and
idiomatic (within the constraints of being called
from C code).

bug: 13058886

Change-Id: Ic78cf91b7c8e8f07b4ab0781333a9e243763298c
2014-02-24 10:45:35 +00:00
Elliott Hughes
9150dfb1c6 Merge "Clean up our OpenBSD usage." 2014-02-21 23:46:52 +00:00
Elliott Hughes
0133944b09 Clean up our OpenBSD usage.
Also undo some of the mess where we have OpenBSD <stdio.h> but a mix of
different BSD's implementations.

In this first pass, I've only moved easy OpenBSD stuff.

Change-Id: Iae67b02cde6dba9d8d06fedeb53efbfdac0a8cf6
2014-02-21 14:30:18 -08:00
Calin Juravle
da030de702 Fixed int fast types for LP64
Bug: 13110474
Change-Id: Id5591603ad4ba7e149c0852f4abb25e4e5a5d065
2014-02-21 16:27:21 +00:00
Elliott Hughes
6b5559315d Use uid_t and gid_t for st_uid and st_gid in struct stat.
Change-Id: Ide62dc714d76d881e3aa79e7a59ee6533a23dd00
2014-02-18 16:43:31 -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
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
Elliott Hughes
199346a2ab Fix NSIG.
Our sigset_t definition hasn't been tied to our NSIG definition since we
switched to uapi headers, so we can now fix it without breaking the LP32 ABI.
The kernel uapi headers define and use _NSIG, so we need to have our scripts
rename the kernel's definitions out of the way, then we can define _NSIG
and NSIG in terms of the kernel's off-by-one value.

Bug: 12938442
Change-Id: Ic7c86fd5be5ad1d822f7b2b1d88c8a0d70a1ac0f
2014-02-11 22:16:04 -08:00
Elliott Hughes
a6ecba4d23 Clean up cacheflush.
No cacheflush for LP64; use the GCC builtin instead. Clean up the
32-bit MIPS implementation now we no longer need to worry about
old versions of GCC.

Bug: 12924756
Change-Id: Ie23955b3ec194e226c4b2bce35b11d5e061f4753
2014-02-11 10:24:40 -08:00
Elliott Hughes
0266ae5f88 Switch <elf.h> over to linux uapi under the covers.
Remove the linker's reliance on BSD cruft and use the glibc-style
ElfW macro. (Other code too, but the linker contains the majority
of the code that needs to work for Elf32 and Elf64.)

All platforms need dl_iterate_phdr_static, so it doesn't make sense
to have that part of the per-architecture configuration.

Bug: 12476126
Change-Id: I1d7f918f1303a392794a6cd8b3512ff56bd6e487
2014-02-10 18:22:24 -08:00
Elliott Hughes
3a9c5d66dc Fix <link.h>.
Also move some of the stuff that should be in <link.h> out of the
private "linker.h", to make it clearer that these are public API
known to gdb that we can't change.

Bug: 12554197
Change-Id: I830e1260d3d8b833ed99bc1518f1c6b6102be8af
2014-02-10 13:31:13 -08:00
Elliott Hughes
ebd90b9ba9 Fix socklen_t (on LP64 only).
Too late to fix LP32 :-(

Bug: 12935461
Change-Id: Ib056ca1eaf9ae8712f88ae21ff94e91b08cf588b
2014-02-07 16:50:55 -08:00
Elliott Hughes
c16a453291 Merge "Remove <sys/_types.h>." 2014-02-08 00:23:50 +00:00
Elliott Hughes
9f87a0b285 Remove <sys/_types.h>.
Bug: 12213562
Change-Id: I0d10664f9da60739bdbad0408be0dd61eea3c1fe
2014-02-07 14:55:58 -08:00
Chris Dearman
645d0312c2 [MIPS64] libc/libm support
libc/libm support for MIPS64 targets

Change-Id: I8271941d418612a286be55495f0e95822f90004f
Signed-off-by: Chris Dearman <chris.dearman@imgtec.com>
Signed-off-by: Raghu Gandham <raghu.gandham@imgtec.com>
2014-02-06 16:22:20 -08:00
Elliott Hughes
9afe2884c7 Kill <machine/_types.h>.
Most of <machine/_types.h> was either unused, wrong, or identical across
all 32-/64-bit architectures.

I'm not a huge fan of <sys/_types.h> either, but moving the bits we need
up into there is a step forward.

Bug: 12213562
Change-Id: Id13551c78966e324beee2dd90c5575e37d2a71e6
2014-02-04 19:26:31 -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
8d60cc6316 Use __inline__ for fortify.
libunwind has #define inline /* empty */ which breaks our fortified headers.
glibc uses __inline but our BSD-derived headers often override that. __inline__
is the third alternative understood by GCC that -- as far as I know -- neither
the C library itself nor third-party code tries to mess with.

Bug: 12871594
Change-Id: I6677e70ea531bb7d4c46021b43af760d4ad8ecf7
2014-02-03 15:41:57 -08:00
Ross McIlroy
7b95807fa0 Add missing ucontext_t definition to bionic for arch-arm64.
Change-Id: I1ee15230c63e00f01d2063cfffcffe7f1a1eeb6a
2014-01-31 04:45:53 +00:00
Elliott Hughes
3614424e10 Make ARM <user.h> more glibc-compatible.
Change-Id: I681930ad7f80a5e7bc40eb0f36872e415445f0f9
2014-01-30 10:39:02 -08:00
Elliott Hughes
02c661b883 Add mips <sys/ucontext.h>.
Change-Id: I2821f523f0c3bb4400b2ad5d36e21e5a3d6d777c
2014-01-29 18:37:15 -08:00
Elliott Hughes
4e72fcc3c2 Add arm <sys/ucontext.h>.
Change-Id: I14d435f9e3e82f77d8a7e886ff88c18f5d09d14a
2014-01-29 17:53:59 -08:00