Commit Graph

298 Commits

Author SHA1 Message Date
Rich Felker d426b04533 add ioperm/iopl syscalls
based on patches by orc and Isaac Dunham, with some fixes. sys/io.h
exists and contains prototypes for these functions regardless of
whether the target arch has them; this is a bit unorthodox but I don't
think it will break anything. the function definitions do not exist
unless the appropriate SYS_* syscall number macro is defined, which
should make sure configure scripts looking for these functions don't
find them on other systems.

presently, sys/io.h does not have the inb/outb/etc. port io
macros/functions. I'd be surprised if ioperm/iopl are useful without
them, so they probably need to be added at some point in appropriate
bits/io.h files...
2012-07-23 16:54:53 -04:00
Rich Felker 53147f902b add splice and vmsplice syscalls
based on patches by orc and Isaac Dunham.
2012-07-23 16:50:56 -04:00
Rich Felker 207460d097 add extended attributes syscalls
based on patch by orc and Isaac Dunham, with some fixes.
2012-07-23 16:39:44 -04:00
Rich Felker 42f0e965c4 add pipe2 syscall
based on patch by orc and Isaac Dunham, with some details fixed.
2012-07-23 16:32:49 -04:00
Rich Felker b4f632bb27 fix namespace issue in prototypes in math.h 2012-07-22 19:02:02 -04:00
Rich Felker d646249124 fix wrong size for sigjmp_buf signal set array
128 is the size in bytes, not longs.
2012-07-22 18:58:35 -04:00
Rich Felker f07222739b fix typo in aio.h 2012-07-19 00:37:43 -04:00
Rich Felker 96107564e2 workaround another sendmsg kernel bug on 64-bit machines
the kernel wrongly expects the cmsg length field to be size_t instead
of socklen_t. in order to work around the issue, we have to impose a
length limit and copy to a local buffer. the length limit should be
more than sufficient for any real-world use; these headers are only
used for passing file descriptors and permissions between processes
over unix sockets.
2012-07-12 21:37:54 -04:00
Rich Felker 90e123f4a8 fix redef of sigprocmask constants on mips
this fix is easier than trying to reorder the header stuff
2012-07-12 16:54:43 -04:00
Rich Felker ba8a96b068 more mips bits-header fixes
signal handling was very broken because of this
2012-07-12 14:21:41 -04:00
Rich Felker 25b88f0810 add prototypes for getw/putw 2012-07-04 12:18:04 -04:00
Rich Felker d6c0efe106 jmp_buf overhaul fixing several issues
on arm, the location of the saved-signal-mask flag and mask were off
by one between sigsetjmp and siglongjmp, causing incorrect behavior
restoring the signal mask. this is because the siglongjmp code assumed
an extra slot was in the non-sig jmp_buf for the flag, but arm did not
have this. now, the extra slot is removed for all archs since it was
useless.

also, arm eabi requires jmp_buf to have 8-byte alignment. we achieve
that using long long as the type rather than with non-portable gcc
attribute tags.
2012-07-03 20:07:33 -04:00
Rich Felker cdf51506ce replace old and ugly crypt implementation
the new version is largely the work of Solar Designer, with minor
changes for integration with musl. compared to the old code, text size
is reduced by about 7k, stack space usage by about 70k, and
performance is greatly improved by avoiding expensive calculation of
constant tables on each run.

this version also adds support for extended des-based password hashes,
which allow for unlimited key (password) length and configurable
iteration counts.

i've also published the interface for crypt_r in a new crypt.h header.
especially since this is not a standard interface, i did not feel
compelled to match the glibc abi for the crypt_data structure. the
glibc structure is way too big to allocate on the stack; in fact it's
so big that the first usage may cause the main thread to exceed its
pre-committed stack size of 128k and thus could cause the program to
crash even on systems with overcommit disabled. the only legitimate
use of crypt_data for crypt_r is to store the hash string to return,
so i've reserved 256 bytes, which should be more than sufficient
(longest known password hashes are ~60 characters, and beyond that is
possibly even exceeding some implementations' passwd file field size
limit).
2012-06-29 00:56:37 -04:00
Rich Felker 9cf9c39e48 add process_vm_readv and process_vm_writev syscall wrappers
based on a patch submitted by Kristian L. <email@thexception.net>
2012-06-23 21:38:47 -04:00
Rich Felker 4e8b0938d9 proper error handling for fcntl F_GETOWN on modern kernels
on old kernels, there's no way to detect errors; we must assume
negative syscall return values are pgrp ids. but if the F_GETOWN_EX
fcntl works, we can get a reliable answer.
2012-06-20 22:16:47 -04:00
Rich Felker 5bc8e845bb include declarations for new stdio_ext functions (gnulib support) 2012-06-19 15:18:22 -04:00
Rich Felker 57d5fff5f7 header file fixes: multiple include guard consistency and correctness
one file was reusing another file's macro name, and many had
inconsistent underscores and application of SYS prefix, etc.

patch by Szabolcs Nagy (nsz)
2012-06-15 21:52:53 -04:00
Rich Felker de05a2ac22 revert one change in time.h; no evidence BSD_SOURCE should expose these.. 2012-06-13 14:46:11 -04:00
Rich Felker cf254c32ec fix feature test macros in time.h
stime is not _XOPEN_SOURCE, and some functions were missing with
_BSD_SOURCE..
2012-06-13 14:43:16 -04:00
Rich Felker 23be72ae45 add timegm function (inverse of gmtime), nonstandard 2012-06-13 14:41:52 -04:00
Rich Felker fbffcee63d add (currently stubbed due to stubbed strverscmp) versionsort function
based on patch by Emil Renner Berthing, with minor changes to dirent.h
for LFS64 and organization of declarations

this code should work unmodified once a real strverscmp is added, but
I've been hesitant to add it because the GNU strverscmp behavior is
harmful in a lot of cases (for instance if you have numeric filenames
in hex). at some point I plan on trying to design a variant of the
algorithm that behaves better on a mix of filename styles.
2012-06-13 11:14:38 -04:00
Rich Felker 3d649468c7 fix signedness errors in stdint.h constant macros
the types of these expressions must match the integer promotions.
unsigned 8- and 16-bit values promote to signed int, not unsigned int.
2012-06-08 11:11:44 -04:00
Rich Felker 1429ce9ba2 fix sysinfo, try 2. it seems to work this time. 2012-06-07 23:06:04 -04:00
Rich Felker e86b18a63e sysinfo struct was utter nonsense; no idea where it came from.
this broke the busybox "free" utility (memory reporting) and possibly
other things like uptime.
2012-06-07 22:58:19 -04:00
Rich Felker 3b94daba71 _GNU_SOURCE is supposed to imply _LARGEFILE64_SOURCE
this is ugly and stupid, but now that the *64 symbol names exist, a
lot of broken GNU software detects them in configure, then either
breaks during build due to missing off64_t definition, or attempts to
compile without function declarations/prototypes. "fixing" it here is
easier than telling everyone to add yet another feature test macro to
their builds.
2012-06-04 08:03:56 -04:00
Rich Felker d200bd727b declare environ in unistd.h when _GNU_SOURCE feature test macro is used
lots of broken programs expect this, and it's gotten to the point of
being a troubleshooting FAQ topic. best to just fix it.
2012-06-02 16:51:04 -04:00
Rich Felker a34b0465ba there is no such GNU function fpurge, only __fpurge.
no idea where I got the idea fpurge should exist...
2012-05-28 22:54:27 -04:00
Rich Felker b63cab76ec add prototype for BSD/GNU stdio *_unlocked extension functions
also fix up distinction of what is GNU-only and what's GNU+BSD
2012-05-28 22:53:24 -04:00
Rich Felker 15c7af3e21 remove duplicate lfs64 cruft in stdio.h 2012-05-28 22:46:28 -04:00
nsz b1cf11c090 math: fix nextafter definition in tgmath.h 2012-05-28 22:55:03 +02:00
Rich Felker 25d575edc4 debloat jmp_buf in _GNU_SOURCE mode
i originally made it the same size as the bloated GNU version, which
contains space for saved signal mask, but this makes some structures
containing jmp_buf become much larger for no benefit. we will never
use the signal mask field with plain setjmp; sigsetjmp serves that
purpose.
2012-05-23 00:10:39 -04:00
Rich Felker 0c29adfe42 remove everything related to forkall
i made a best attempt, but the intended semantics of this function are
fundamentally contradictory. there is no consistent way to handle
ownership of locks when forking a multi-threaded process. the code
could have worked by accident for programs that only used normal
mutexes and nothing else (since they don't actually store or care
about their owner), but that's about it. broken-by-design interfaces
that aren't even in glibc (only solaris) don't belong in musl.
2012-05-22 22:43:27 -04:00
Rich Felker af3330d764 some feature test fixes for unistd.h 2012-05-22 22:28:17 -04:00
Rich Felker 96601e3c61 _GNU_SOURCE implies all BSD features except ones GNU rejects 2012-05-22 22:07:42 -04:00
Rich Felker 671ffab776 various header cleanups, some related to _BSD_SOURCE addition
there is no reason to avoid multiple identical macro definitions; this
is perfectly legal C, and even with the maximal warning options
enabled, gcc does not issue any warning for it.
2012-05-22 22:04:55 -04:00
Rich Felker 9f370fa99e bsd_signal is a legacy (removed) XSI function, not needed in _BSD_SOURCE
its only purpose was for use on non-BSD systems that implement sysv
semantics for signal() by default.
2012-05-22 21:54:19 -04:00
Rich Felker 419ae6d5c9 support _BSD_SOURCE feature test macro
patch by Isaac Dunham. matched closely (maybe not exact) to glibc's
idea of what _BSD_SOURCE should make visible.
2012-05-22 21:52:08 -04:00
Rich Felker 3db29f0347 move getpass decl to the right place 2012-05-20 22:56:06 -04:00
Rich Felker b5cbd549fd useless lastlog path just to make some stuff happy 2012-05-14 00:10:28 -04:00
Rich Felker f8ac55516d missing limit LOGIN_NAME_MAX 2012-05-14 00:01:48 -04:00
Rich Felker e68c51ac46 use __h_errno_location for h_errno
we do not bother making h_errno thread-local since the only interfaces
that use it are inherently non-thread-safe. but still use the
potentially-thread-local ABI to access it just to avoid lock-in.
2012-05-12 23:45:07 -04:00
Rich Felker 3777f5b90d susv4 removed gethostbyname, etc. legacy cruft. 2012-05-12 23:38:04 -04:00
Rich Felker 20052b9815 namespace cleanup - NI_* is NOT reserved by netdb.h 2012-05-12 23:34:39 -04:00
Rich Felker 7db6a871ca some gnu junk in netdb.h 2012-05-12 23:31:52 -04:00
Rich Felker c3dbe9b22c fix missing va_list for vsyslog 2012-05-12 22:18:34 -04:00
nsz d197d6421c search: add tdestroy (gnu extension) 2012-05-13 01:34:20 +02:00
Rich Felker b47fdcdef8 add missing IN6_ARE_ADDR_EQUAL
written to avoid multiple conditional jumps and avoid ugly repetitive
lines in the header file.
2012-05-11 11:05:41 -04:00
Rich Felker e700e59a90 add one more bogus legacy header
this one is for program(s|ers) who haven't heard of uint16_t and
uint32_t (which are obviously the correct types for use in such
situations, as they're the argument/return types for ntohs/htons and
ntohl/htonl).
2012-05-10 23:32:28 -04:00
Rich Felker c8b01e73ca move vsyslog out of SYSLOG_NAMES conditional 2012-05-10 22:41:54 -04:00
Rich Felker bfb29b666e fix missing parens in bit op macros (param.h) 2012-05-10 12:10:44 -04:00