1 /* vi: set sw=4 ts=4: */
3 * __syscall_fcntl() for uClibc
5 * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
7 * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
10 #include <sys/syscall.h>
13 #include <bits/wordsize.h>
15 extern __typeof(fcntl) __libc_fcntl;
16 libc_hidden_proto(__libc_fcntl)
18 #if defined __UCLIBC_HAS_LFS__ && defined __NR_fcntl64
19 extern __typeof(fcntl64) __libc_fcntl64;
20 libc_hidden_proto(__libc_fcntl64)
23 #define __NR___syscall_fcntl __NR_fcntl
24 static __always_inline
25 _syscall3(int, __syscall_fcntl, int, fd, int, cmd, long, arg)
27 int __libc_fcntl(int fd, int cmd, ...)
33 arg = va_arg(list, long);
37 if (cmd == F_GETLK64 || cmd == F_SETLK64 || cmd == F_SETLKW64) {
38 #if defined __UCLIBC_HAS_LFS__ && defined __NR_fcntl64
39 return __libc_fcntl64(fd, cmd, arg);
47 return (__syscall_fcntl(fd, cmd, arg));
49 libc_hidden_def(__libc_fcntl)
51 /* libc_hidden_proto(fcntl) */
52 weak_alias(__libc_fcntl,fcntl)
53 libc_hidden_weak(fcntl)
54 #if ! defined __NR_fcntl64 && defined __UCLIBC_HAS_LFS__
55 strong_alias(__libc_fcntl,__libc_fcntl64)
56 /* libc_hidden_proto(fcntl64) */
57 weak_alias(__libc_fcntl,fcntl64)
58 libc_hidden_weak(fcntl64)