OSDN Git Service

- fix inline keyword
[uclinux-h8/uClibc.git] / libc / sysdeps / linux / common / fchown.c
1 /* vi: set sw=4 ts=4: */
2 /*
3  * fchown() for uClibc
4  *
5  * Copyright (C) 2000-2006 Erik Andersen <andersen@codepoet.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 <unistd.h>
12 #include <bits/wordsize.h>
13
14 #if (__WORDSIZE == 32 && defined(__NR_fchown32)) || __WORDSIZE == 64
15 # ifdef __NR_fchown32
16 #  undef __NR_fchown
17 #  define __NR_fchown __NR_fchown32
18 # endif
19
20 _syscall3(int, fchown, int, fd, uid_t, owner, gid_t, group);
21
22 #else
23
24 # define __NR___syscall_fchown __NR_fchown
25 static __inline__ _syscall3(int, __syscall_fchown, int, fd,
26                 __kernel_uid_t, owner, __kernel_gid_t, group);
27
28 int fchown(int fd, uid_t owner, gid_t group)
29 {
30         if (((owner + 1) > (uid_t) ((__kernel_uid_t) - 1U))
31                 || ((group + 1) > (gid_t) ((__kernel_gid_t) - 1U))) {
32                 __set_errno(EINVAL);
33                 return -1;
34         }
35         return (__syscall_fchown(fd, owner, group));
36 }
37
38 #endif