summaryrefslogtreecommitdiff
path: root/libgcompat
AgeCommit message (Collapse)AuthorFilesLines
2019-04-29Use <utmpx.h> for struct utmp definitonA. Wilcox1-1/+1
2019-04-08malloc: Add mtrace and muntrace stubsA. Wilcox1-0/+12
2019-02-18pthread: Fix pthread_getname_npSamuel Holland1-4/+6
Remove the trailing newline, and ensure the string returned is always null-terminated. Signed-off-by: Samuel Holland <samuel@sholland.org>
2019-01-05pthread: Implement pthread_getname_npSamuel Holland1-1/+24
Signed-off-by: Samuel Holland <samuel@sholland.org>
2019-01-05run clang-format on the source codeSamuel Holland1-1/+1
Signed-off-by: Samuel Holland <samuel@sholland.org>
2019-01-05Makefile: depend on internal.h; format headersSamuel Holland2-9/+8
Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-11-12wchar: Implement __wcstol_internalA. Wilcox1-0/+12
2018-09-11libgcompat: Fix formatting inconsistencies (clang-format)Samuel Holland6-24/+21
Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-09-11unistd: Add __open_2 and its __open64_2 aliasSamuel Holland1-0/+9
Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-09-11stdlib: Add secure_getenv alias to __secure_getenvSamuel Holland1-0/+3
Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-09-11readlink: Report EIO on /proc read failureSamuel Holland1-0/+1
Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-09-11realpath: Intercept realpath(/proc/self/exe)Samuel Holland1-0/+51
Reuse the machinery from readlink Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-09-11readlink: Report ENOSYS on dlsym failureSamuel Holland1-0/+2
Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-09-11ctype: Add __ctype_bSamuel Holland1-0/+1
Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-09-11cxx_thread: Add __cxa_thread_atexit_implSamuel Holland1-0/+56
Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-06-21string: add memfrob and strfryJason A. Donenfeld1-0/+34
2018-06-13string: add __strcspn_c2A. Wilcox1-0/+17
2018-06-13resolv: add __res_search aliasA. Wilcox1-0/+6
2018-04-03malloc: add malloc_trim functionElizabeth Myers1-0/+6
2018-04-03socket: fix buildElizabeth Myers1-0/+1
2018-04-03socket: __poll_chkElizabeth Myers1-0/+13
2018-04-03math: implement most of glibc's __*_finite functionsElizabeth Myers1-2/+1090
These are supposed to be specialisations for speed, but these are just faked. Some warnings were added too, if they return infinite values. As a side effect of this change, scalbl is also now implemented. As noted, not all functions are implemented; the big two blockers are an implementation of j0l and y0l; I imagine Bessel functions aren't too widely used, so I doubt that many things will want them. Someone (not it) can implement them later.
2018-04-03GCOMPAT__assert_with_reason: omit format parameterElizabeth Myers1-2/+2
__VA_ARGS__ expects one or more arguments; this is a cheesy hack to allow passing only a format string (which is often all you need for small asserts).
2018-03-16build: allow building with libucontext supportWilliam Pitcock1-0/+4
2018-02-23gnulib: use GCOMPAT__assert_with_reason() instead of bare assert()William Pitcock1-2/+10
2018-02-23libgcompat: add internal api for GCOMPAT__panic().William Pitcock2-0/+31
2018-02-07misc: implement __libc_stack_endWilliam Pitcock1-0/+2
2018-02-01socket: add __cmsg_nxthdrA. Wilcox1-0/+10
2018-02-01malloc: add __sbrkA. Wilcox1-0/+6
2018-01-15stdlib: add __strtol_internalWilliam Pitcock1-0/+10
Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-15readlink: Intercept readlink("/proc/self/exe")Samuel Holland1-0/+85
This allows programs run through gcompat to fork and re-exec themselves. It fixes readlink("/proc/self/exe") to return the executable's absolute path, instead of musl's path. Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-15utmp: Implement the reentrant utmp function from LSBSamuel Holland1-0/+14
This takes advantage of the (lack of a) musl implementation for simplicity. Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-15unistd: Implement LSB functions plus moreSamuel Holland1-0/+172
On musl pread and pread64 are the same thing. Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-15syslog: Implement checked syslog functions from LSBSamuel Holland1-0/+32
Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-15socket: Implement checked socket functions from LSBSamuel Holland1-0/+31
Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-15signal: Add a signal function from LSBSamuel Holland1-0/+11
The other unimplemented signal function in LSB is sigreturn, with is not really implementable. Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-15netdb: Add protocol and service functions from LSBSamuel Holland1-0/+79
These take advantage of the musl implementation for simplicity. Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-15misc: Implement some miscellaneous functionsSamuel Holland1-0/+33
Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-15error: Implement the error functionSamuel Holland1-0/+27
This follows the exceptionally-detailed functional description in the manual page. Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-15version: Minor improvementsSamuel Holland1-5/+17
* Document functions and sort by name. * Explicitly include stddef.h. Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-15string: Clean up, fix bugs, implement LSB plus moreSamuel Holland1-38/+199
* Add all checked string functions from LSB, plus those found in use in other applications. Document those functions from LSB as such. * Use a consistent structure and paramater names for all functions. * Fix multiple off-by-one errors. * Use a less hacky and more optimized rawmemchr. * Sort functions by name. Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-15stdlib: Implement most LSB functions plus moreSamuel Holland2-18/+107
* Fix prototype of __realpath_chk. * Add all strto* functions from LSB, plus the ones thata were previously incorrectly in string.c The main missing LSB functions are the reentrant random functions, which should not be used anyway. Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-15stdio: Clean up, add all of LSB stdio plus moreSamuel Holland2-81/+232
* Add all (non-wchar) stdio functions from LSB, plus those found in use in other applications. Document those functions from LSB as such. * Use a consistent structure and paramater names for all functions. * flag == 0 means FORTIFY_SOURCE=1, so the implemented checks should be unconditional. * Add all possible checks without parsing the format string. * Move functions from wchar.h to their own appropriately-named file. Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-15resource: Minor improvementsSamuel Holland1-4/+5
* Make function pointer static. * Only initialize function pointer once. Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-15resolv: Clean up, avoid NULL derefSamuel Holland1-8/+16
* Make comment style consistent with the rest of the project, and remove outdated header name. * Remove "static inline" from functions (this is no longer a header). * Check statp for NULL in res_ninit like in res_nclose. Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-15grp: Implement fgetgrent_r/getgrent_rSamuel Holland1-0/+98
Like fgetpwent_r/getpwent_r, these require a deep copy of the structure into the caller-provided buffer. This is nontrivial for the array of strings member. getgrent_r is required by LSB. [NOTE: I'm not too happy with the macro, but it works. Any suggestions?] Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-15pwd: Fully implement fgetpwent_r/getpwent_rSamuel Holland1-45/+74
These functions require a deep copy of the structure into the caller-provided buffer. Also make sure to store NULL in result on error. Use the stream to differentiate the two functions and avoid duplication. Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-14pthread: Clean up, fix prototypeSamuel Holland1-6/+17
* Add the missing parameter to __register_atfork. * Sort and document functions. __pthread_register_cancel and __pthread_unregister_cancel should be implemented at some point, or else pthread_cleanup_pop(true) will not work properly and could cause deadlocks in programs that use it. Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-14math: Clean up, add additional functionsSamuel Holland1-11/+80
* Add finite() variants, needed by some applications. * Add remaining long double variants of existing functions. * Sort and document existing functions, including where referenced in the LSB standard. Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-14malloc: Sort functions by nameSamuel Holland1-16/+18
Signed-off-by: Samuel Holland <samuel@sholland.org>