musl/src/fcntl/open.c, branch master musl - an implementation of the standard library for Linux-based systems remove LFS64 symbol aliases; replace with dynamic linker remapping 2022年10月19日T18:01:31+00:00 Rich Felker dalias@aerifal.cx 2022年09月26日T21:14:18+00:00 246f1c811448f37a44b41cd8df8d0ef9736d95f4 originally the namespace-infringing "large file support" interfaces were included as part of glibc-ABI-compat, with the intent that they not be used for linking, since our off_t is and always has been unconditionally 64-bit and since we usually do not aim to support nonstandard interfaces when there is an equivalent standard interface. unfortunately, having the symbols present and available for linking caused configure scripts to detect them and attempt to use them without declarations, producing all the expected ill effects that entails. as a result, commit 2dd8d5e1b8ba1118ff1782e96545cb8a2318592c was made to prevent this, using macros to redirect the LFS64 names to the standard names, conditional on _GNU_SOURCE or _LARGEFILE64_SOURCE. however, this has turned out to be a source of further problems, especially since g++ defines _GNU_SOURCE by default. in particular, the presence of these names as macros breaks a lot of valid code. this commit removes all the LFS64 symbols and replaces them with a mechanism in the dynamic linker symbol lookup failure path to retry with the spurious "64" removed from the symbol name. in the future, if/when the rest of glibc-ABI-compat is moved out of libc, this can be removed.
originally the namespace-infringing "large file support" interfaces
were included as part of glibc-ABI-compat, with the intent that they
not be used for linking, since our off_t is and always has been
unconditionally 64-bit and since we usually do not aim to support
nonstandard interfaces when there is an equivalent standard interface.
unfortunately, having the symbols present and available for linking
caused configure scripts to detect them and attempt to use them
without declarations, producing all the expected ill effects that
entails.
as a result, commit 2dd8d5e1b8ba1118ff1782e96545cb8a2318592c was made
to prevent this, using macros to redirect the LFS64 names to the
standard names, conditional on _GNU_SOURCE or _LARGEFILE64_SOURCE.
however, this has turned out to be a source of further problems,
especially since g++ defines _GNU_SOURCE by default. in particular,
the presence of these names as macros breaks a lot of valid code.
this commit removes all the LFS64 symbols and replaces them with a
mechanism in the dynamic linker symbol lookup failure path to retry
with the spurious "64" removed from the symbol name. in the future,
if/when the rest of glibc-ABI-compat is moved out of libc, this can be
removed.
remove spurious inclusion of libc.h for LFS64 ABI aliases 2018年09月12日T18:34:38+00:00 Rich Felker dalias@aerifal.cx 2018年09月12日T04:28:34+00:00 63a4c9adf227a6f6a5f7f70f6dc3f8863f846927 the LFS64 macro was not self-documenting and barely saved any characters. simply use weak_alias directly so that it's clear what's being done, and doesn't depend on a header to provide a strange macro.
the LFS64 macro was not self-documenting and barely saved any
characters. simply use weak_alias directly so that it's clear what's
being done, and doesn't depend on a header to provide a strange macro.
fix failure of open to read variadic mode argument for O_TMPFILE 2014年10月31日T00:03:56+00:00 Rich Felker dalias@aerifal.cx 2014年10月31日T00:03:56+00:00 9d836ea7a69a6441fcdca815328d274e4ed6b707
avoid invalid use of va_arg in open 2014年06月06日T19:43:16+00:00 Rich Felker dalias@aerifal.cx 2014年06月06日T19:43:16+00:00 9c2d437cb343a9a9e1c2d5dea4e0ae6a7d4fa0be 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.
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.
add O_CLOEXEC fallback for open and related functions 2014年06月06日T19:42:42+00:00 Rich Felker dalias@aerifal.cx 2014年06月06日T19:42:42+00:00 7765706c0584ed4a30e0b7a3ada742e490ef02b0 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.
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.
support kernels with no SYS_open syscall, only SYS_openat 2014年05月25日T02:54:05+00:00 Rich Felker dalias@aerifal.cx 2014年05月25日T02:54:05+00:00 594c827a22124ae550b9a877b8188e0898dff8db 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.
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.
include cleanups: remove unused headers and add feature test macros 2013年12月12日T05:09:18+00:00 Szabolcs Nagy nsz@port70.net 2013年12月12日T05:09:18+00:00 571744447c23f91feb6439948f3a619aca850dfb
overhaul pthread cancellation 2011年04月17日T15:43:03+00:00 Rich Felker dalias@aerifal.cx 2011年04月17日T15:43:03+00:00 feee98903cd8119d9a3db62589246a940f44a9f5 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.
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 interface 2011年03月20日T04:16:43+00:00 Rich Felker dalias@aerifal.cx 2011年03月20日T04:16:43+00:00 aa398f56fa398f2202b04e82c67f822f3233786f
initial check-in, version 0.5.0 2011年02月12日T05:22:29+00:00 Rich Felker dalias@aerifal.cx 2011年02月12日T05:22:29+00:00 0b44a0315b47dd8eced9f3b7f31580cf14bbfc01

AltStyle によって変換されたページ (->オリジナル) /