OSDN Git Service

Last portion of libc_hidden_proto removal.
[uclinux-h8/uClibc.git] / 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 extern __typeof(fcntl) __libc_fcntl;
16 libc_hidden_proto(__libc_fcntl)
17
18 #if defined __UCLIBC_HAS_LFS__ && defined __NR_fcntl64
19 extern __typeof(fcntl64) __libc_fcntl64;
20 libc_hidden_proto(__libc_fcntl64)
21 #endif
22
23 #define __NR___syscall_fcntl __NR_fcntl
24 static __always_inline
25 _syscall3(int, __syscall_fcntl, int, fd, int, cmd, long, arg)
26
27 int __libc_fcntl(int fd, int cmd, ...)
28 {
29         long arg;
30         va_list list;
31
32         va_start(list, cmd);
33         arg = va_arg(list, long);
34         va_end(list);
35
36 #if __WORDSIZE == 32
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);
40 #else
41                 __set_errno(ENOSYS);
42                 return -1;
43 #endif
44         }
45 #endif
46
47         return (__syscall_fcntl(fd, cmd, arg));
48 }
49 libc_hidden_def(__libc_fcntl)
50
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)
59 #endif