1 /* vi: set sw=4 ts=4: */
3 * __syscall_fcntl() for uClibc
5 * Copyright (C) 2006 Steven J. Hill <sjhill@realitydiluted.com>
6 * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
8 * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
11 #include <sys/syscall.h>
13 #include <cancel.h> /* Must come before <fcntl.h>. */
15 #include <bits/wordsize.h>
17 int __NC(fcntl)(int fd, int cmd, long arg)
20 if (cmd == F_GETLK64 || cmd == F_SETLK64 || cmd == F_SETLKW64) {
21 # if (defined __UCLIBC_HAS_LFS__ && defined __NR_fcntl64) || !defined __NR_fcntl
22 return INLINE_SYSCALL(fcntl64, 3, fd, cmd, arg);
30 #if defined __NR_fcntl
31 return INLINE_SYSCALL(fcntl, 3, fd, cmd, arg);
38 int fcntl(int fd, int cmd, ...)
44 arg = va_arg (ap, long);
47 if (SINGLE_THREAD_P || (cmd != F_SETLKW && cmd != F_SETLKW64))
48 #if defined __NR_fcntl
49 return __NC(fcntl)(fd, cmd, arg);
51 return INLINE_SYSCALL(fcntl64, 3, fd, cmd, arg);
54 int oldtype = LIBC_CANCEL_ASYNC ();
55 #if defined __NR_fcntl
56 int result = __NC(fcntl)(fd, cmd, arg);
58 int result = INLINE_SYSCALL(fcntl64, 3, fd, cmd, arg);
60 LIBC_CANCEL_RESET (oldtype);
64 lt_strong_alias(fcntl)
66 #if defined __UCLIBC_HAS_LFS__ && !defined __NR_fcntl64 && __WORDSIZE == 32
67 strong_alias_untyped(fcntl,fcntl64)
68 lt_strong_alias(fcntl64)
69 lt_libc_hidden(fcntl64)