OSDN Git Service

b3500630652ee4f6e24eeaf9789f9f04945bc5a6
[uclinux-h8/uClibc.git] / libc / sysdeps / linux / common / setfsgid.c
1 /* vi: set sw=4 ts=4: */
2 /*
3  * setfsgid() 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 <sys/fsuid.h>
12 #include <bits/wordsize.h>
13
14 #if (__WORDSIZE == 32 && defined(__NR_setfsgid32)) || __WORDSIZE == 64
15 # ifdef __NR_setfsgid32
16 #  undef __NR_setfsgid
17 #  define __NR_setfsgid __NR_setfsgid32
18 # endif
19
20 _syscall1(int, setfsgid, gid_t, gid);
21
22 #else
23
24 # define __NR___syscall_setfsgid __NR_setfsgid
25 static inline _syscall1(int, __syscall_setfsgid, __kernel_gid_t, gid);
26
27 int setfsgid(gid_t gid)
28 {
29         if (gid != (gid_t) ((__kernel_gid_t) gid)) {
30                 __set_errno(EINVAL);
31                 return -1;
32         }
33         return (__syscall_setfsgid(gid));
34 }
35 #endif