| Commit message (Expand) | Author | Age | Files | Lines |
| * | support kernels with no SYS_open syscall, only SYS_openat•••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.
| Rich Felker | 2014-05-24 | 1 | -1/+1 |
| * | in fcntl, use unsigned long instead of long for variadic argument type•••neither is correct; different commands take different argument types,
and some take no arguments at all. I have a much larger overhaul of
fcntl prepared to address this, but it's not appropriate to commit
during freeze.
the immediate problem being addressed affects forward-compatibility on
x32: if new commands are added and they take pointers, but the
libc-level fcntl function is not aware of them, using long would
sign-extend the pointer to 64 bits and give the kernel an invalid
pointer. on the kernel side, the argument to fcntl is always treated
as unsigned long, so no harm is done by treating possibly-signed
integer arguments as unsigned. for every command that takes an integer
argument except for F_SETOWN, large integer arguments and negative
arguments are handled identically anyway. in the case of F_SETOWN, the
kernel is responsible for converting the argument which it received as
unsigned long to int, so the sign of negative arguments is recovered.
the other problem that will be addressed later is that the type passed
to va_arg does not match the type in the caller of fcntl. an advanced
compiler doing cross-translation-unit analysis could potentially see
this mismatch and issue warnings or otherwise make trouble.
on i386, this patch was confirmed not to alter the code generated by
gcc 4.7.3. in principle the generated code should not be affected on
any arch except x32.
| Rich Felker | 2014-03-07 | 1 | -2/+2 |
| * | in fcntl, avoid passing pointer arguments to syscalls as longs•••really, fcntl should be changed to use the correct type corresponding
to cmd when calling va_arg, and to carry the correct type through
until making the syscall. however, this greatly increases binary size
and does not seem to offer any benefits except formal correctness, so
I'm holding off on that change for now.
the minimal changes made in this patch are in preparation for addition
of the x32 port, where the syscall macros need to know whether their
arguments are pointers or integers in order to properly pass them to
the 64-bit kernel.
| Rich Felker | 2014-01-08 | 1 | -3/+12 |
| * | add some missing LFS64 aliases for fadvise/fallocate functions | Rich Felker | 2014-01-06 | 2 | -0/+6 |
| * | include cleanups: remove unused headers and add feature test macros | Szabolcs Nagy | 2013-12-12 | 3 | -3/+0 |
| * | provide emulation of fcntl F_DUPFD_CLOEXEC on old kernels•••I'm not entirely happy with the amount of ugliness here, but since
F_DUPFD_CLOEXEC is used elsewhere in code that's expected to work on
old kernels (popen), it seems necessary. reportedly even some modern
kernels went back and broke F_DUPFD_CLOEXEC (making it behave like
plain F_DUPFD), so it might be necessary to add some additional fixup
code later to deal with that issue too.
| Rich Felker | 2013-03-26 | 1 | -0/+16 |
| * | move fallocate syscall wrapper to linux-specific syscalls dir | Rich Felker | 2012-09-08 | 1 | -9/+0 |
| * | add fallocate (nonstandardized) function•••this is equivalent to posix_fallocate except that it has an extra
mode/flags argument to control its behavior, and stores the error in
errno rather than returning an error code.
| Rich Felker | 2012-09-08 | 1 | -0/+9 |
| * | fix broken fallocate syscall in posix_fallocate•••the syscall takes an extra flag argument which should be zero to meet
the POSIX requirements.
| Rich Felker | 2012-09-08 | 1 | -1/+1 |
| * | 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.
| Rich Felker | 2012-06-20 | 1 | -1/+9 |
| * | enable LARGEFILE64 aliases•••these will NOT be used when compiling with -D_LARGEFILE64_SOURCE on
musl; instead, they exist in the hopes of eventually being able to run
some glibc-linked apps with musl sitting in place of glibc.
also remove the (apparently incorrect) fcntl alias.
| Rich Felker | 2012-05-31 | 1 | -2/+0 |
| * | fix F_GETOWN return value handling•••the fcntl syscall can return a negative value when the command is
F_GETOWN, and this is not an error code but an actual value. thus we
must special-case it and avoid calling __syscall_ret to set errno.
this fix is better than the glibc fix (using F_GETOWN_EX) which only
works on newer kernels and is more complex.
| Rich Felker | 2011-10-09 | 1 | -0/+1 |
| * | update syscalls with off_t arguments to handle argument alignment, if needed•••the arm syscall abi requires 64-bit arguments to be aligned on an even
register boundary. these new macros facilitate meeting the abi
requirement without imposing significant ugliness on the code.
| Rich Felker | 2011-09-21 | 2 | -4/+4 |
| * | add syscall wrappers for posix_fadvise, posix_fallocate | Rich Felker | 2011-04-20 | 2 | -0/+16 |
| * | overhaul pthread cancellation•••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.
| Rich Felker | 2011-04-17 | 3 | -15/+4 |
| * | global cleanup to use the new syscall interface | Rich Felker | 2011-03-20 | 3 | -3/+3 |
| * | initial check-in, version 0.5.0 | Rich Felker | 2011-02-12 | 4 | -0/+73 |