diff options
Diffstat (limited to 'lib/libc/sys/fcntl.c')
-rw-r--r-- | lib/libc/sys/fcntl.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/lib/libc/sys/fcntl.c b/lib/libc/sys/fcntl.c index 480cc40..4cb887b 100644 --- a/lib/libc/sys/fcntl.c +++ b/lib/libc/sys/fcntl.c @@ -34,7 +34,23 @@ __FBSDID("$FreeBSD$"); #include <sys/syscall.h> #include "libc_private.h" -__weak_reference(__fcntl_compat, fcntl); +#pragma weak fcntl +int +fcntl(int fd, int cmd, ...) +{ + va_list args; + long arg; + + va_start(args, cmd); + arg = va_arg(args, long); + va_end(args); + + return (((int (*)(int, int, ...)) + __libc_interposing[INTERPOS_fcntl])(fd, cmd, arg)); +} + +#ifdef SYSCALL_COMPAT +__weak_reference(__fcntl_compat, __fcntl); int __fcntl_compat(int fd, int cmd, ...) @@ -87,3 +103,7 @@ __fcntl_compat(int fd, int cmd, ...) return (__sys_fcntl(fd, cmd, arg)); } } +#else +__weak_reference(__sys_fcntl, __fcntl_compat); +__weak_reference(__sys_fcntl, __fcntl); +#endif |