]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/uclibc/lib/contrib/uclibc/libc/sysdeps/linux/common/__syscall_fcntl.c
355b22b00e9f63aa2d2e63dba7ed5b4527f84192
[l4.git] / l4 / pkg / uclibc / lib / contrib / uclibc / libc / sysdeps / linux / common / __syscall_fcntl.c
1 /* vi: set sw=4 ts=4: */
2 /*
3  * __syscall_fcntl() for uClibc
4  *
5  * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
6  *
7  * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
8  */
9
10 #include <sys/syscall.h>
11 #include <stdarg.h>
12 #include <fcntl.h>
13 #include <bits/wordsize.h>
14
15 #define __NR___syscall_fcntl __NR_fcntl
16 static __always_inline
17 _syscall3(int, __syscall_fcntl, int, fd, int, cmd, long, arg)
18
19 int fcntl(int fd, int cmd, ...)
20 {
21         long arg;
22         va_list list;
23
24         va_start(list, cmd);
25         arg = va_arg(list, long);
26         va_end(list);
27
28 #if __WORDSIZE == 32
29         if (cmd == F_GETLK64 || cmd == F_SETLK64 || cmd == F_SETLKW64) {
30 #if defined __UCLIBC_HAS_LFS__ && defined __NR_fcntl64
31                 return fcntl64(fd, cmd, arg);
32 #else
33                 __set_errno(ENOSYS);
34                 return -1;
35 #endif
36         }
37 #endif
38
39         return (__syscall_fcntl(fd, cmd, arg));
40 }
41 #ifndef __LINUXTHREADS_OLD__
42 libc_hidden_def(fcntl)
43 #else
44 libc_hidden_weak(fcntl)
45 strong_alias(fcntl,__libc_fcntl)
46 #endif
47
48 #if ! defined __NR_fcntl64 && defined __UCLIBC_HAS_LFS__
49 strong_alias(fcntl,fcntl64)
50 #endif