summaryrefslogtreecommitdiff
path: root/src/linux
AgeCommit message (Collapse)AuthorLines
2014-06-14fix missing argument to syscall in fanotify_markClément Vasseur-1/+1
2014-05-30fix breakage from recent syscall commits due to missing errno macrosRich Felker-0/+3
2014-05-30fix for broken kernel side RLIM_INFINITY on mipsSzabolcs Nagy-1/+16
On 32 bit mips the kernel uses -1UL/2 to mark RLIM_INFINITY (and this is the definition in the userspace api), but since it is in the middle of the valid range of limits and limits are often compared with relational operators, various kernel side logic is broken if larger than -1UL/2 limits are used. So we truncate the limits to -1UL/2 in get/setrlimit and prlimit. Even if the kernel side logic consistently treated -1UL/2 as greater than any other limit value, there wouldn't be any clean workaround that allowed using large limits: * using -1UL/2 as RLIM_INFINITY in userspace would mean different infinity value for get/setrlimt and prlimit (where infinity is always -1ULL) and userspace logic could break easily (just like the kernel is broken now) and more special case code would be needed for mips. * translating -1UL/2 kernel side value to -1ULL in userspace would mean that -1UL/2 limit cannot be set (eg. -1UL/2+1 had to be passed to the kernel instead).
2014-05-29support linux kernel apis (new archs) with old syscalls removedRich Felker-8/+29
such archs are expected to omit definitions of the SYS_* macros for syscalls their kernels lack from arch/$ARCH/bits/syscall.h. the preprocessor is then able to select the an appropriate implementation for affected functions. two basic strategies are used on a case-by-case basis: where the old syscalls correspond to deprecated library-level functions, the deprecated functions have been converted to wrappers for the modern function, and the modern function has fallback code (omitted at the preprocessor level on new archs) to make use of the old syscalls if the new syscall fails with ENOSYS. this also improves functionality on older kernels and eliminates the incentive to program with deprecated library-level functions for the sake of compatibility with older kernels. in other situations where the old syscalls correspond to library-level functions which are not deprecated but merely lack some new features, such as the *at functions, the old syscalls are still used on archs which support them. this may change at some point in the future if or when fallback code is added to the new functions to make them usable (possibly with reduced functionality) on old kernels.
2014-04-15add namespace-protected name for sysinfo functionRich Felker-6/+5
it will be needed to implement some things in sysconf, and the syscall can't easily be used directly because the x32 syscall uses the wrong structure layout. the l (uncreative, for "linux") prefix is used since the symbol name __sysinfo is already taken for AT_SYSINFO from the aux vector. the way the x32 override of this function works is also changed to be simpler and avoid the useless jump instruction.
2014-03-06x32: fix sysinfo()rofl0r-0/+5
the kernel uses long longs in the struct, but the documentation says they're long. so we need to fixup the mismatch between the userspace and kernelspace structs. since the struct offers a mem_unit member, we can avoid truncation by adjusting that value.
2014-02-09clone: make clone a wrapper around __cloneBobby Bingham-0/+19
The architecture-specific assembly versions of clone did not set errno on failure, which is inconsistent with glibc. __clone still returns the error via its return value, and clone is now a wrapper that sets errno as needed. The public clone has also been moved to src/linux, as it's not directly related to the pthreads API. __clone is called by pthread_create, which does not report errors via errno. Though not strictly necessary, it's nice to avoid clobbering errno here.
2014-01-07fix const-correctness of argument to stimeRich Felker-1/+1
it's unclear what the historical signature for this function was, but semantically, the argument should be a pointer to const, and this is what glibc uses. correct programs should not be using this function anyway, so it's unlikely to matter.
2014-01-07fix signedness of pgoff argument to remap_file_pagesRich Felker-1/+1
both the kernel and glibc agree that this argument is unsigned; the incorrect type ssize_t came from erroneous man pages.
2014-01-07fix incorrect type for wd argument of inotify_rm_watchRich Felker-1/+1
this was wrong since the original commit adding inotify, and I don't see any explanation for it. not even the man pages have it wrong. it was most likely a copy-and-paste error.
2014-01-06add some missing LFS64 aliases for fadvise/fallocate functionsRich Felker-0/+4
2014-01-03fanotify.c: fix typo in header inclusionrofl0r-1/+1
the header is included only as a guard to check that the declaration and definition match, so the typo didn't cause any breakage aside from omitting this check.
2014-01-02disable the brk functionRich Felker-1/+2
the reasons are the same as for sbrk. unlike sbrk, there is no safe usage because brk does not return any useful information, so it should just fail unconditionally.
2014-01-02disable sbrk for all values of increment except 0Rich Felker-3/+3
use of sbrk is never safe; it conflicts with malloc, and malloc may be used internally by the implementation basically anywhere. prior to this change, applications attempting to use sbrk to do their own heap management simply caused untrackable memory corruption; now, they will fail with ENOMEM allowing the errors to be fixed. sbrk(0) is still permitted as a way to get the current brk; some misguided applications use this as a measurement of their memory usage or for other related purposes, and such usage is harmless. eventually sbrk may be re-added if/when malloc is changed to avoid using the brk by using mmap for all allocations.
2014-01-02add fanotify syscall wrapper and headerrofl0r-0/+14
2013-12-20add sys/quota.h and quotactl syscall wrapperRich Felker-0/+7
based on patch by Timo Teräs.
2013-12-12include cleanups: remove unused headers and add feature test macrosSzabolcs Nagy-10/+12
2013-05-26fix the prototype of settimeofday to follow the original BSD declarationSzabolcs Nagy-1/+2
2013-04-07fix signalfd not to ignore flagsRich Felker-1/+12
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-03-26remove __SYSCALL_SSLEN arch macro in favor of using public _NSIGRich Felker-3/+6
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.
2012-12-07remove __arch_prctl alias for arch_prctlRich Felker-3/+1
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-07move new linux syscall wrapper functions to proper source dirRich Felker-0/+16
2012-11-18add port io functions to sys/io.hRich Felker-2/+4
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-04mips cache flush/ctl syscall support and headerRich Felker-0/+18
2012-09-29move accept4, dup3, and pipe2 to non-linux-specific locationsRich Felker-27/+0
these interfaces have been adopted by the Austin Group for inclusion in the next version of POSIX.
2012-09-29fix some indention-with-spaces that crept inRich Felker-4/+4
2012-09-21LFS64 alias for prlimitRich Felker-0/+3
issue reported/requested by Justin Cormack
2012-09-16add clock_adjtime, remap_file_pages, and syncfs syscall wrappersRich Felker-0/+25
patch by Justin Cormack, with slight modification
2012-09-10fix another ppoll issue (missing sigset_t size argument)Rich Felker-1/+1
2012-09-10fix ppoll with null timeout argumentRich Felker-2/+2
2012-09-09add linux ppoll syscall wrapperRich Felker-0/+9
2012-09-09reenable sync_file_range; should no longer break on mipsRich Felker-2/+2
2012-09-08disable sync_file_range for nowRich Felker-2/+3
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-08add acct, accept4, setns, and dup3 syscalls (linux extensions)Rich Felker-0/+28
based on patch by Justin Cormack
2012-09-08add linux tee syscallRich Felker-0/+8
2012-09-08add linux sync_file_range syscallRich Felker-0/+16
2012-09-08move fallocate syscall wrapper to linux-specific syscalls dirRich Felker-0/+9
2012-09-08add linux readahead syscallRich Felker-0/+8
2012-09-08add timerfd interfaces (untested)Rich Felker-0/+17
2012-09-07cleanup src/linux and src/misc trees, etc.Rich Felker-404/+107
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-06further use of _Noreturn, for non-plain-C functionsRich Felker-4/+4
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-08-15handle null arguments to legacy bsd err.h functionsRich Felker-2/+2
2012-08-15add missing xattr functionsRich Felker-0/+15
not sure why these were originally omitted..
2012-08-09fix (hopefully) all hard-coded 8's for kernel sigset_t sizeRich Felker-2/+2
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-07-23add ioperm/iopl syscallsRich Felker-0/+18
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-23add splice and vmsplice syscallsRich Felker-0/+16
based on patches by orc and Isaac Dunham.
2012-07-23add extended attributes syscallsRich Felker-0/+47
based on patch by orc and Isaac Dunham, with some fixes.
2012-07-23add pipe2 syscallRich Felker-0/+8
based on patch by orc and Isaac Dunham, with some details fixed.
2012-06-23add process_vm_readv and process_vm_writev syscall wrappersRich Felker-0/+13
based on a patch submitted by Kristian L. <email@thexception.net>
2012-06-19add vhangup syscall wrapperRich Felker-0/+8
request/patch by william haddonthethird, slightly modifed to add _GNU_SOURCE feature test macro so that the compiler can verify the prototype matches.