about summary refs log tree commit diff
path: root/src/internal/syscall.h
Commit message (Collapse)AuthorAgeFilesLines
* fix inconsistent visibility for internal syscall symbolsRich Felker2015-04-141-1/+1
|
* remove cruft from x86_64 syscall.hSzabolcs Nagy2015-02-071-0/+3
| | | | | | | x86_64 syscall.h defined some musl internal syscall names and made them public. These defines were already moved to src/internal/syscall.h (except for SYS_fadvise which is added now) so the cruft in x86_64 syscall.h is not needed.
* unify non-inline version of syscall code across archsRich Felker2014-11-221-0/+10
| | | | | | | | | | | | | | except powerpc, which still lacks inline syscalls simply because nobody has written the code, these are all fallbacks used to work around a clang bug that probably does not exist in versions of clang that can compile musl. however, it's useful to have the generic non-inline code anyway, as it eases the task of porting to new archs: writing inline syscall code is now optional. this approach could also help support compilers which don't understand inline asm or lack support for the needed register constraints. mips could not be unified because it has special fixup code for broken layout of the kernel's struct stat.
* add framework for mmap2 syscall unit to vary by archRich Felker2014-07-301-0/+4
|
* fix for broken kernel side RLIM_INFINITY on mipsSzabolcs Nagy2014-05-301-0/+4
| | | | | | | | | | | | | | | | | | | | 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).
* break down coarse-grained 64-bit-off_t syscall remappingsRich Felker2014-05-301-4/+16
| | | | | | | | | | using the existence of SYS_stat64 as the condition for remapping other related syscalls is no longer valid, since new archs that omit the old syscalls will not have SYS_stat or SYS_stat64, but still potentially need SYS_fstat and others remapped. it would probably be possible to get by with just one or two extra conditionals, but just breaking them all down into separate conditions is robust and not significantly heavier for the preprocessor.
* fix sendfile syscall to use 64-bit off_tRich Felker2014-05-301-0/+5
| | | | | | | | | | somehow the remapping of this syscall to the 64-bit version was overlooked. the issue was found, and patch provided, by Stefan Kristiansson. presumably the reason this bug was not caught earlier is that the syscall takes a pointer to off_t rather than a value, so on little-endian systems, everything appears to work as long as the offset value fits in the low 31 bits. on big-endian systems, though, sendfile was presumably completely non-functional.
* fix sys_open macro for archs without the plain open syscallRich Felker2014-05-271-4/+4
|
* fix placement of multiple inclusion guard endif in internal syscall.hRich Felker2014-05-271-2/+2
| | | | | | this was messed up during a recent commit when the socketcall macros were moved to the common internal/syscall.h, and the following commit expanded the problem by adding more new content outside the guard.
* support kernels with no SYS_open syscall, only SYS_openatRich Felker2014-05-241-0/+18
| | | | | | | | | | open is handled specially because it is used from so many places, in so many variants (2 or 3 arguments, setting errno or not, and cancellable or not). trying to do it as a function would not only increase bloat, but would also risk subtle breakage. this is the first step towards supporting "new" archs where linux lacks "old" syscalls.
* make socketcall types common as they are same for all architecturesTimo Teräs2014-04-171-0/+23
|
* use hidden visibility rather than protected for syscall internalsRich Felker2014-04-121-1/+1
| | | | | | | | | | | | | | | the use of visibility at all is purely an optimization to avoid the need for the caller to load the GOT register or similar to prepare for a call via the PLT. there is no reason for these symbols to be externally visible, so hidden works just as well as protected, and using protected visibility is undesirable due to toolchain bugs and the lack of testing it receives. in particular, GCC's microblaze target is known to generate symbolic relocations in the GOT for functions with protected visibility. this in turn results in a dynamic linker which crashes under any nontrivial usage that requires making a syscall before symbolic relocations are processed.
* mostly-cosmetic fixups to x32 port mergeRich Felker2014-02-231-5/+2
|
* internal/syscall.h: add syscall_arg_t macrorofl0r2014-02-221-6/+11
| | | | | | | some 32-on-64 archs require that the actual syscall args be long long. in that case syscall_arch.h can define syscall_arg_t to whatever it needs and syscall.h picks it up. all other archs just use long as usual.
* internal/syscall.h: use a macro for the syscall args castsrofl0r2014-02-221-13/+17
| | | | | | | this allows syscall_arch.h to define the macro __scc if special casting is needed, as is the case for x32, where the actual syscall arguments are 64bit, but, in case of pointers, would get sign-extended and thus become invalid.
* fix missing argument in variadic syscall macrosRich Felker2013-07-171-1/+1
| | | | | | for 0-argument syscalls (1 argument to the macro, the syscall number), the __SYSCALL_NARGS_X macro's ... argument was not satisfied. newer compilers seem to care about this.
* use explicit visibility to optimize a few hot-path function callsRich Felker2012-10-251-3/+5
| | | | | | | | | | | | | | | | | | | | | | on x86 and some other archs, functions which make function calls which might go through a PLT incur a significant overhead cost loading the GOT register prior to making the call. this load is utterly useless in musl, since all calls are bound at library-creation time using -Bsymbolic-functions, but the compiler has no way of knowing this, and attempts to set the default visibility to protected have failed due to bugs in GCC and binutils. this commit simply manually assigns hidden/protected visibility, as appropriate, to a few internal-use-only functions which have many callers, or which have callers that are hot paths like getc/putc. it shaves about 5k off the i386 libc.so with -Os. many of the improvements are in syscall wrappers, where the benefit is just size and performance improvement is unmeasurable noise amid the syscall overhead. however, stdio may be measurably faster. if in the future there are toolchains that can do the same thing globally without introducing linking bugs, it might be worth considering removing these workarounds.
* add 7-arg syscall support for mipsRich Felker2012-09-091-2/+3
| | | | | | | no syscalls actually use that many arguments; the issue is that some syscalls with 64-bit arguments have them ordered badly so that breaking them into aligned 32-bit half-arguments wastes slots with padding, and a 7th slot is needed for the last argument.
* syscall organization overhaulRich Felker2012-09-081-5/+138
| | | | | | | | | | | | now public syscall.h only exposes __NR_* and SYS_* constants and the variadic syscall function. no macros or inline functions, no __syscall_ret or other internal details, no 16-/32-bit legacy syscall renaming, etc. this logic has all been moved to src/internal/syscall.h with the arch-specific parts in arch/$(ARCH)/syscall_arch.h, and the amount of arch-specific stuff has been reduced to a minimum. changes still need to be reviewed/double-checked. minimal testing on i386 and mips has already been performed.
* workaround for preprocessor bug in pccRich Felker2011-05-011-7/+7
| | | | | | | with this patch, musl compiles and mostly works with pcc 1.0.0. a few tests are still failing and i'm uncertain whether they are due to portability problems in musl, or bugs in pcc, but i suspect the latter.
* overhaul pthread cancellationRich Felker2011-04-171-0/+14
| | | | | | | | | | | | | | | | | | | | | | this patch improves the correctness, simplicity, and size of cancellation-related code. modulo any small errors, it should now be completely conformant, safe, and resource-leak free. the notion of entering and exiting cancellation-point context has been completely eliminated and replaced with alternative syscall assembly code for cancellable syscalls. the assembly is responsible for setting up execution context information (stack pointer and address of the syscall instruction) which the cancellation signal handler can use to determine whether the interrupted code was in a cancellable state. these changes eliminate race conditions in the previous generation of cancellation handling code (whereby a cancellation request received just prior to the syscall would not be processed, leaving the syscall to block, potentially indefinitely), and remedy an issue where non-cancellable syscalls made from signal handlers became cancellable if the signal handler interrupted a cancellation point. x86_64 asm is untested and may need a second try to get it right.
* global cleanup to use the new syscall interfaceRich Felker2011-03-201-22/+0
|
* syscall overhaul part two - unify public and internal syscall interfaceRich Felker2011-03-191-0/+32
| | | | | | | | | | | | | | | | with this patch, the syscallN() functions are no longer needed; a variadic syscall() macro allows syscalls with anywhere from 0 to 6 arguments to be made with a single macro name. also, manually casting each non-integer argument with (long) is no longer necessary; the casts are hidden in the macros. some source files which depended on being able to define the old macro SYSCALL_RETURNS_ERRNO have been modified to directly use __syscall() instead of syscall(). references to SYSCALL_SIGSET_SIZE and SYSCALL_LL have also been changed. x86_64 has not been tested, and may need a follow-up commit to fix any minor bugs/oversights.
* move arch-specific internal headers into placeRich Felker2011-02-151-500/+0
|
* cleaning up syscalls in preparation for x86_64 portRich Felker2011-02-131-9/+40
| | | | | | | | | - hide all the legacy xxxxxx32 name cruft in syscall.h so the actual source files can be clean and uniform across all archs. - cleanup llseek/lseek and mmap2/mmap handling for 32/64 bit systems - alternate implementation for nice if the target lacks nice syscall
* initial check-in, version 0.5.0 v0.5.0Rich Felker2011-02-121-0/+469