- 13 9月, 2018 1 次提交
-
-
由 Rich Felker 提交于
libc.h was intended to be a header for access to global libc state and related interfaces, but ended up included all over the place because it was the way to get the weak_alias macro. most of the inclusions removed here are places where weak_alias was needed. a few were recently introduced for hidden. some go all the way back to when libc.h defined CANCELPT_BEGIN and _END, and all (wrongly implemented) cancellation points had to include it. remaining spurious users are mostly callers of the LOCK/UNLOCK macros and files that use the LFS64 macro to define the awful *64 aliases. in a few places, new inclusion of libc.h is added because several internal headers no longer implicitly include libc.h. declarations for __lockfile and __unlockfile are moved from libc.h to stdio_impl.h so that the latter does not need libc.h. putting them in libc.h made no sense at all, since the macros in stdio_impl.h are needed to use them correctly anyway.
-
- 02 7月, 2016 1 次提交
-
-
由 Rich Felker 提交于
commit 6d38c9cf provided an arm-specific version of posix_fadvise to address the alternate argument order the kernel expects on arm, but neglected to address that powerpc (32-bit) has the same issue. instead of having arch variant files in duplicate, simply put the alternate version in the top-level file under the control of a macro defined in syscall_arch.h.
-
- 30 6月, 2016 2 次提交
-
-
由 Rich Felker 提交于
the arm version of the syscall has a custom argument ordering to avoid needing a 7-argument syscall due to 64-bit argument alignment.
-
由 Rich Felker 提交于
when commit 0b6eb2df added the parentheses around __syscall to invoke the function directly, there was no __syscall7 in the syscall macro infrastructure, so this hack was needed. commit 9a3bbce4 fixed that but failed to remove the hack.
-
- 22 4月, 2015 1 次提交
-
-
由 Rich Felker 提交于
the first switch already returns in the F_SETLKW code path so it need not be handled in the second switch. moreover the code in the second switch is wrong for the F_SETLKW command: it's not cancellable.
-
- 01 11月, 2014 1 次提交
-
-
由 Rich Felker 提交于
this was introduced in commit 2da3ab13 as an oversight while making the variadic argument access conditional.
-
- 31 10月, 2014 2 次提交
-
-
由 Rich Felker 提交于
the mode argument is only required to be present when the O_CREAT or O_TMPFILE flag is used.
-
由 Rich Felker 提交于
-
- 07 6月, 2014 2 次提交
-
-
由 Rich Felker 提交于
reading the variadic mode argument is only valid when the O_CREAT flag is present. this probably does not matter, but is needed for formal correctness, and could affect LTO or other full-program analysis.
-
由 Rich Felker 提交于
since there is no easy way to detect whether open honored or ignored the O_CLOEXEC flag, the optimal solution to providing a fallback is simply to make the fcntl syscall to set the close-on-exec flag immediately after open returns.
-
- 25 5月, 2014 1 次提交
-
-
由 Rich Felker 提交于
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.
-
- 08 3月, 2014 1 次提交
-
-
由 Rich Felker 提交于
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.
-
- 08 1月, 2014 1 次提交
-
-
由 Rich Felker 提交于
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.
-
- 07 1月, 2014 1 次提交
-
-
由 Rich Felker 提交于
-
- 12 12月, 2013 1 次提交
-
-
由 Szabolcs Nagy 提交于
-
- 27 3月, 2013 1 次提交
-
-
由 Rich Felker 提交于
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.
-
- 08 9月, 2012 3 次提交
-
-
由 Rich Felker 提交于
-
由 Rich Felker 提交于
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 提交于
the syscall takes an extra flag argument which should be zero to meet the POSIX requirements.
-
- 21 6月, 2012 1 次提交
-
-
由 Rich Felker 提交于
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.
-
- 01 6月, 2012 1 次提交
-
-
由 Rich Felker 提交于
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.
-
- 10 10月, 2011 1 次提交
-
-
由 Rich Felker 提交于
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.
-
- 22 9月, 2011 1 次提交
-
-
由 Rich Felker 提交于
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.
-
- 21 4月, 2011 1 次提交
-
-
由 Rich Felker 提交于
-
- 17 4月, 2011 1 次提交
-
-
由 Rich Felker 提交于
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.
-
- 20 3月, 2011 1 次提交
-
-
由 Rich Felker 提交于
-
- 12 2月, 2011 1 次提交
-
-
由 Rich Felker 提交于
-