summaryrefslogtreecommitdiffstats
path: root/libc/upstream-netbsd
Commit message (Collapse)AuthorAgeFilesLines
* Hide rand48 implementation details.Elliott Hughes2014-06-091-4/+4
| | | | | Bug: 11156955 Change-Id: I130272286989487dc22e246fb4ffbee5230225c4
* Rewrite and hide longjmperror.Elliott Hughes2014-06-061-56/+0
| | | | | | | | | 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
* Switch back to OpenBSD inet_ntop now they're FORTIFY clean.Elliott Hughes2014-05-191-231/+0
| | | | Change-Id: I04798a4966c352a8a12feebdff9646e3bad5933f
* Register _cleanup function with atexitDmitriy Ivanov2014-05-151-63/+0
| | | | | | | | | | | | | | | | * Register cleanup function with atexit instead of calling it explicitly on exit() * abort() no longer calls _cleanup: Flushing stdio buffers on abort is no longer required by POSIX. * dlmalloc no longer need to reset cleanup (see above) * Upstream findfp.c makebuf.c setvbuf.cexit.c to openbsd versions. Bug: 14415367 Change-Id: I277058852485a9d3dbb13e5c232db5f9948d78ac
* Use the NetBSD inet_ntop until the OpenBSD bug is fixed.Elliott Hughes2014-05-131-0/+231
| | | | | | | | | 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
* Flesh out <arpa/inet.h>.Elliott Hughes2014-05-134-830/+0
| | | | | | | | | | 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
* Clean up and document our hacks for building BSD source.Elliott Hughes2014-04-2110-4/+0
| | | | Change-Id: Ic591e22fa5b363bb68376b9f25814c0e5bd83fbf
* Add lsearch(3) for ltrace.Elliott Hughes2014-04-011-0/+107
| | | | | Bug: 13746936 Change-Id: I833c6ba70a1752c04dab7de389f5bebb741662b3
* Clean up reentrancy cruft.Elliott Hughes2014-03-131-0/+2
| | | | | | | | | | | | | | | | 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
* More stdio cleanup.Elliott Hughes2014-03-111-0/+1
| | | | Change-Id: Idc909cd3dc7b072f1edd2ae4980932d6550e8568
* Switch to NetBSD utmp.c.Elliott Hughes2014-03-101-0/+106
| | | | Change-Id: Ibe94888aa48b5b28fea97fd5719a1ed7a23ddeb3
* Moved nameser.h and namser_compat.h to public include dirCalin Juravle2014-03-041-1/+1
| | | | | | | This is part of the upstream sync (Net/Open/Free BSDs expose the nameser.h in their public headers). Change-Id: Ib063d4e50586748cc70201a8296cd90d2e48bbcf
* Clean up our OpenBSD usage.Elliott Hughes2014-02-212-199/+0
| | | | | | | | | 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
* Move the upstream-netbsd libc files into the correct directory.Elliott Hughes2014-02-2053-0/+0
| | | | | | | | I screwed up when I originally imported these files; they're in lib/libc/ in the upstream tree; there is no top-level libc/ (though there is a top-level common/, so those files stay where they are). Change-Id: I7c5e2224a4441ab0e33616a855a8c6aacfeac46f
* Implement some of the missing LFS64 support.Elliott Hughes2014-02-181-52/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Clean up various warnings in bionic.Elliott Hughes2014-02-181-0/+1
| | | | Change-Id: Ic57541d0a567fd4ae79f0ad59b2ffde1130eb7d2
* bionic: call stdio cleanup on exitPawit Pornkitprasan2013-11-192-0/+100
| | | | | | | | | | | | | | | As of 61e699a133a4807fe878a6cb0d7190d7c96e21f8, stdio clean up functions are no longer registered in atexit and must be called manually via __cleanup. The issue this fixes is some static binaries linked against bionic cannot output properly when piped or redirected because the buffer is not flushed before closing. This is done by pulling in exit.c (and other dependencies) from netbsd. Change-Id: I193e54a6d08900f291550029fe75ce76394d9e22
* Fix a TODO; we've had SOCK_CLOEXEC for a while now.Elliott Hughes2013-11-061-3/+0
| | | | Change-Id: I4bc39b57f3c33441ead74127f576bf5a4e311566
* Fix the *rand48 functions on LP64.Elliott Hughes2013-10-284-14/+12
| | | | | | | I reported the mrand48 bug upstream, and 'matt' fixed the whole family of functions! Change-Id: I07fbc034e86499ce89599c3026a741738fd0cfc0
* Fix x86_64 build, clean up intermediate libraries.Elliott Hughes2013-10-092-1/+35
| | | | | | | | | | | | | | | | | | | | | | The x86_64 build was failing because clone.S had a call to __thread_entry which was being added to a different intermediate .a on the way to making libc.so, and the linker couldn't guarantee statically that such a relocation would be possible. ld: error: out/target/product/generic_x86_64/obj/STATIC_LIBRARIES/libc_common_intermediates/libc_common.a(clone.o): requires dynamic R_X86_64_PC32 reloc against '__thread_entry' which may overflow at runtime; recompile with -fPIC This patch addresses that by ensuring that the caller and callee end up in the same intermediate .a. While I'm here, I've tried to clean up some of the mess that led to this situation too. In particular, this removes libc/private/ from the default include path (except for the DNS code), and splits out the DNS code into its own library (since it's a weird special case of upstream NetBSD code that's diverged so heavily it's unlikely ever to get back in sync). There's more cleanup of the DNS situation possible, but this is definitely a step in the right direction, and it's more than enough to get x86_64 building cleanly. Change-Id: I00425a7245b7a2573df16cc38798187d0729e7c4
* Add more __restricts, clean up __format__ attributes.Elliott Hughes2013-05-141-1/+1
| | | | Change-Id: I7e2d270cc722d339d221eaea92747eaff3b51403
* Upgrade to current NetBSD popen/pclose.Elliott Hughes2013-03-064-1/+272
| | | | | | | | This gets us back to using vfork now our ARM vfork assembler stub is fixed, and adds the missing thread safety for the 'pidlist'. Bug: 5335385 Change-Id: Ib08bfa65b2cb9fa695717aae629ea14816bf988d
* Our strcoll(3) is no different from NetBSD's, so take exactly theirs.Elliott Hughes2013-01-221-0/+59
| | | | Change-Id: I45251047202a229f9175735ecc23c0ebcda71e8d
* Avoid overflow in memccpy.Elliott Hughes2013-01-221-0/+61
| | | | | | | Just take the upstream NetBSD code. Bug: http://code.google.com/p/android/issues/detail?id=43078 Change-Id: Ibbbde9d00e8bc6a09c9503aab2b04b4e3d1f98b0
* libc: Fix alphasort() signature (and implementation).David 'Digit' Turner2012-10-291-59/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The declaration for alphasort() in <dirent.h> used the deprecated: int alphasort(const void*, const void*); while both Posix and GLibc use instead: int alphasort(const struct dirent** a, const struct dirent** b); See: http://pubs.opengroup.org/onlinepubs/9699919799/functions/alphasort.html This patch does the following: - Update the declaration to match Posix/GLibc - Get rid of the upstream BSD code which isn't compatible with the new signature. - Implement a new trivial alphasort() with the right signature, and ensure that it uses strcoll() instead of strcmp(). - Remove Bionic-specific #ifdef .. #else .. #endif block in dirent_test.cpp which uses alphasort(). Even through strcoll() currently uses strcmp(), this does the right thing in the case where we decide to update strcoll() to properly implement locale-specific ordered comparison. Change-Id: I4fd45604d8a940aaf2eb0ecd7d73e2f11c9bca96
* Clean up the implementation of the <dirent.h> functions.Elliott Hughes2012-10-261-0/+59
| | | | Change-Id: I3c647cc9588525afc41fee90ee468d58cd13503a
* More upstream NetBSD upgrades.Elliott Hughes2012-10-2317-0/+2259
| | | | Change-Id: Idb781d37de3b05585271d7d258ecffd5ba87d0b8
* Upgrade more functions to the current upstream NetBSD copy.Elliott Hughes2012-10-239-0/+1297
| | | | Change-Id: Ie0b3f8b3fccef28609eb210434413ebd51d6ef45
* Upgrade seed48 too.Elliott Hughes2012-10-011-0/+49
| | | | | | Missed this in 774c7f54ff375d71106283d42779b0cc5f238f87. Change-Id: Ic24fd67f003d0e2d192cfb08f96f63024ca817eb
* Upgrade to the current NetBSD rand implementation.Elliott Hughes2012-10-018-0/+314
| | | | | | Also add basic unit tests. Change-Id: I7fc7ef61d47c1e8fdf8b8eff67a635220c3afd56
* Add getdelim(3) and getline(3) to bionicIrina Tirdea2012-09-273-0/+224
| | | | | | | | | | | | | | Some userspace programs (e.g. perf) need getline. Changes: () add getdelim.c, getline.c from NetBSD (http://netbsd.org/) under the NetBSD Foundation's (TNF) license ("2 clause" Berkeley-style license). () add stub for reentrant.h header that is needed by getdelim.c () add tests for getdelim(3) and getline(3). () update NOTICE file. Change-Id: I22ed82dd5904b9d7a3695535c04f502be3c27c5d Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
* Fix several compiler warnings.Elliott Hughes2012-09-261-1/+7
| | | | Change-Id: I55caa50a5937442734f4fcbdb4edf1c70f335bf8
* libc: add ftw / nftw functionsNick Kralevich2012-09-132-0/+212
| | | | | | | | | Please see "man 3 ftw" for a description of the ftw / nftw functions. This code is taken directly from netbsd unmodified. Change-Id: Ia4879ac57212b424adf5281b5e92858e216d0f14
* Make strerror(3) and strsignal(3) thread-safe, and add psignal(3) and ↵Irina Tirdea2012-09-132-0/+107
| | | | | | psiginfo(3). Change-Id: I426109db25e907980d6cb3a7a695796e45783b78
* Switch to the current NetBSD regex implementation.Elliott Hughes2012-08-1511-0/+4352
| | | | Change-Id: If32b28dd85d6a7ab8957ab81d19fa4c0de9499d5
* Switch to upstream NetBSD tdelete/tfind/tsearch.Elliott Hughes2012-08-133-0/+170
| | | | | | tdestroy is a GNU extension, so that stays. Change-Id: Iedebaff25ea7e92b1ab1dd4440da12b67b99aa40
* Fix nice...Elliott Hughes2012-08-132-0/+95
| | | | | | ...by switching to the NetBSD implementation. Change-Id: I562b27b237a24ded95804035cc322c7bff12ff59
* Revert "Revert "Switch to NetBSD's strxfrm(3).""Elliott Hughes2012-08-103-0/+103
| | | | | | | | This reverts commit 8793e7c7d21a0434d1b5e63364c88b2b125a3d29, and fixes the build by building upstream NetBSD source as a separate library that's then swallowed whole into libc_common. Change-Id: I6c9317d8c48b5ccaf85a7b185bc07fb31176ff97
* Revert "Switch to NetBSD's strxfrm(3)."Elliott Hughes2012-08-103-103/+0
| | | | | | This reverts commit be1d78b0dc899a732c0e9d7515d3023e8004e368 Change-Id: I11a95db474796f3da004f27652b081d5ba4ec9b4
* Switch to NetBSD's strxfrm(3).Elliott Hughes2012-08-103-0/+103
There were two bugs in our implementation. Intel found one, but another remainined, and tracking upstream is the way forward for functions where we add no value. Change-Id: Ida9bac0293fb2c4cbc942b1e0515ee0477c6538b