Commit Graph

70 Commits

Author SHA1 Message Date
Rich Felker
bcd9302508 fix signalfd not to ignore flags
also include fallback code for broken kernels that don't support the
flags. as usual, the fallback has a race condition that can leak file
descriptors.
2013-04-07 23:19:00 -04:00
Rich Felker
ccc7b4c3a1 remove __SYSCALL_SSLEN arch macro in favor of using public _NSIG
the issue at hand is that many syscalls require as an argument the
kernel-ABI size of sigset_t, intended to allow the kernel to switch to
a larger sigset_t in the future. previously, each arch was defining
this size in syscall_arch.h, which was redundant with the definition
of _NSIG in bits/signal.h. as it's used in some not-quite-portable
application code as well, _NSIG is much more likely to be recognized
and understood immediately by someone reading the code, and it's also
shorter and less cluttered.

note that _NSIG is actually 65/129, not 64/128, but the division takes
care of throwing away the off-by-one part.
2013-03-26 23:07:31 -04:00
Rich Felker
3ee67505fe remove __arch_prctl alias for arch_prctl
if there's evidence of any use for it, we can add it back later. as
far as I can tell, glibc has it only for internal use (and musl uses a
direct syscall in that case rather than a function call), not for
exposing it to applications.
2012-12-07 16:22:13 -05:00
Rich Felker
55aef73f47 move new linux syscall wrapper functions to proper source dir 2012-12-07 16:17:16 -05:00
Rich Felker
61aa6324af add port io functions to sys/io.h
based on proposal by Isaac Dunham. nonexistance of bits/io.h will
cause inclusion of sys/io.h to produce an error on archs that are not
supposed to have it. this is probably the desired behavior, but the
error message may be a bit unusual.
2012-11-18 19:31:58 -05:00
Rich Felker
fc5f16d182 mips cache flush/ctl syscall support and header 2012-11-04 17:06:31 -05:00
Rich Felker
dc62790dee move accept4, dup3, and pipe2 to non-linux-specific locations
these interfaces have been adopted by the Austin Group for inclusion
in the next version of POSIX.
2012-09-29 17:40:42 -04:00
Rich Felker
c983e6415a fix some indention-with-spaces that crept in 2012-09-29 01:14:07 -04:00
Rich Felker
f600105eef LFS64 alias for prlimit
issue reported/requested by Justin Cormack
2012-09-21 04:05:01 -04:00
Rich Felker
662da62eb7 add clock_adjtime, remap_file_pages, and syncfs syscall wrappers
patch by Justin Cormack, with slight modification
2012-09-16 22:26:23 -04:00
Rich Felker
a9555a995c fix another ppoll issue (missing sigset_t size argument) 2012-09-10 18:37:27 -04:00
Rich Felker
3b5e69052a fix ppoll with null timeout argument 2012-09-10 18:05:02 -04:00
Rich Felker
141138c41b add linux ppoll syscall wrapper 2012-09-09 16:09:29 -04:00
Rich Felker
3d939be2e3 reenable sync_file_range; should no longer break on mips 2012-09-09 14:58:55 -04:00
Rich Felker
41c5ee50ee disable sync_file_range for now
something is wrong with the logic for the argument layout, resulting
in compile errors on mips due to too many args to syscall... further
information on how it's supposed to work will be needed before it can
be reactivated.
2012-09-08 22:48:22 -04:00
Rich Felker
6cf8bfdb64 add acct, accept4, setns, and dup3 syscalls (linux extensions)
based on patch by Justin Cormack
2012-09-08 20:22:08 -04:00
Rich Felker
997ba92a0f add linux tee syscall 2012-09-08 01:03:01 -04:00
Rich Felker
00e6bbcc05 add linux sync_file_range syscall 2012-09-08 00:58:25 -04:00
Rich Felker
b72db3d1ed move fallocate syscall wrapper to linux-specific syscalls dir 2012-09-08 00:41:11 -04:00
Rich Felker
90f770523f add linux readahead syscall 2012-09-08 00:40:37 -04:00
Rich Felker
231b9d1880 add timerfd interfaces (untested) 2012-09-08 00:21:02 -04:00
Rich Felker
b9bb8f67bb cleanup src/linux and src/misc trees, etc.
previously, it was pretty much random which one of these trees a given
function appeared in. they have now been organized into:

src/linux: non-POSIX linux syscalls (possibly shard with other nixen)
src/legacy: various obsolete/legacy functions, mostly wrappers
src/misc: still mostly uncategorized; some misc POSIX, some nonstd
src/crypt: crypt hash functions

further cleanup will be done later.
2012-09-07 00:48:25 -04:00
Rich Felker
0c05bd3a9c further use of _Noreturn, for non-plain-C functions
note that POSIX does not specify these functions as _Noreturn, because
POSIX is aligned with C99, not the new C11 standard. when POSIX is
eventually updated to C11, it will almost surely give these functions
the _Noreturn attribute. for now, the actual _Noreturn keyword is not
used anyway when compiling with a c99 compiler, which is what POSIX
requires; the GCC __attribute__ is used instead if it's available,
however.

in a few places, I've added infinite for loops at the end of _Noreturn
functions to silence compiler warnings. presumably
__buildin_unreachable could achieve the same thing, but it would only
work on newer GCCs and would not be portable. the loops should have
near-zero code size cost anyway.

like the previous _Noreturn commit, this one is based on patches
contributed by philomath.
2012-09-06 23:34:10 -04:00
Rich Felker
dc82ee4e30 handle null arguments to legacy bsd err.h functions 2012-08-15 22:35:02 -04:00
Rich Felker
7650390de8 add missing xattr functions
not sure why these were originally omitted..
2012-08-15 08:31:44 -04:00
Rich Felker
2f437040e7 fix (hopefully) all hard-coded 8's for kernel sigset_t size
some minor changes to how hard-coded sets for thread-related purposes
are handled were also needed, since the old object sizes were not
necessarily sufficient. things have gotten a bit ugly in this area,
and i think a cleanup is in order at some point, but for now the goal
is just to get the code working on all supported archs including mips,
which was badly broken by linux rejecting syscalls with the wrong
sigset_t size.
2012-08-09 22:52:13 -04:00
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
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
25c8444919 add vhangup syscall wrapper
request/patch by william haddonthethird, slightly modifed to add
_GNU_SOURCE feature test macro so that the compiler can verify the
prototype matches.
2012-06-19 15:32:13 -04:00
Rich Felker
2169265ec6 add init_module/delete_module syscall wrappers
these are not exposed publicly in any header, but the few programs
that use them (modutils/kmod, etc.) are declaring the functions
themselves rather than making the syscalls directly, and it doesn't
really hurt to have them (same as the capset junk).
2012-06-13 11:49:22 -04:00
Rich Felker
e361019c24 add deprecated capabilities functions
these were left in glibc for binary compatibility after the public
part of the interface was removed, and libcap kept using them (with
its own copy of the header files) rather than just making the syscalls
directly. might as well add them since they're so small...
2012-06-13 11:04:31 -04:00
Rich Felker
7b5467cbae fix typo in utimes function that made it mess up file times 2012-05-21 23:55:36 -04:00
Rich Felker
50da5c264f add linux-specific unshare syscall wrapper 2012-04-29 19:54:03 -04:00
Rich Felker
ba6a9e7734 legacy junk compatibility grab-bag
- add the rest of the junk traditionally in sys/param.h
- add prototypes for some nonstandard functions
- add _GNU_SOURCE to their source files so the compiler can check proto
2012-04-18 12:22:24 -04:00
Rich Felker
2cbb24bba3 remove junk sincos implementations in preparation to merge nsz's real ones 2012-03-16 20:53:05 -04:00
Rich Felker
5657cc58e5 implement sincosf and sincosl functions; add prototypes
presumably broken gcc may generate calls to these, and it's said that
ffmpeg makes use of sincosf.
2012-03-15 02:38:42 -04:00
Rich Felker
4619901ec4 add linux setfs[ug]id syscall wrappers
patch by Jeremy Huntwork
2012-01-28 21:09:50 -05:00
Rich Felker
c07daf0f2f fix broken reboot wrapper (syscall needs extra silly magic arguments...) 2011-12-23 19:13:48 -05:00
Rich Felker
ede5ae7b0b make getmntent_r discard long lines when it returns error, not seek back
seeking back can be performed by the caller, but if the caller doesn't
expect it, it will result in an infinite loop of failures.
2011-09-28 19:37:14 -04:00
Rich Felker
7e76095180 improve error handling in mntent stuff...
not sure if this is correct/ideal. it needs further attention.
2011-09-27 17:00:38 -04:00
Rich Felker
f135ef3f34 fix missing va_end in prctl syscall wrapper 2011-09-27 16:47:00 -04:00
Rich Felker
fd142e5ec4 cleanup various minor issues reported by nsz
the changes to syscall_ret are mostly no-ops in the generated code,
just cleanup of type issues and removal of some implementation-defined
behavior. the one exception is the change in the comparison value,
which is fixed so that 0xf...f000 (which in principle could be a valid
return value for mmap, although probably never in reality) is not
treated as an error return.
2011-09-26 00:59:28 -04:00
Rich Felker
4f5ba9211e fix stubbed-out reboot call 2011-08-02 21:22:56 -04:00
Rich Felker
19892bf0a7 fix brk/sbrk behavior to match the real legacy functions 2011-05-22 12:34:33 -04:00
Rich Felker
15b77d52c9 eventfd syscall wrapper and read/write wrappers 2011-05-08 00:03:00 -04:00
Rich Felker
29a15ad077 fix initgroups (uninitialized count passed to getgrouplist) 2011-04-20 19:15:27 -04:00
Rich Felker
55b123b5ed add syscall wrapper for flock
it should be noted that flock does not mix well with standard fcntl
locking, but nonetheless some applications will attempt to use flock
instead of fcntl if both exist. options to configure or small patches
may be needed. debian maintainers have plenty of experience with this
unfortunate situation...
2011-04-13 14:55:26 -04:00