chiark / gitweb /
[PATCH] added vsyslog support to klibc.
[elogind.git] / klibc / klibc / setresgid.c
1 /*
2  * setresgid.c
3  */
4
5 #include <unistd.h>
6 #include <sys/syscall.h>
7
8 #ifdef __NR_setresgid
9
10 _syscall3(int,setresgid,gid_t,a0,gid_t,a1,gid_t,a2);
11
12 #elif defined(__NR_setresgid32)
13
14 static inline _syscall3(int,setresgid32,gid_t,a0,gid_t,a1,gid_t,a2);
15
16 int setresgid(gid_t a0, gid_t a1, gid_t a2)
17 {
18   if ( sizeof(gid_t) == sizeof(uint32_t) ) {
19     return setresgid32(a0,a1,a2);
20   } else {
21     uint32_t x0 = (a0 == (gid_t)-1) ? (uint32_t)-1 : a0;
22     uint32_t x1 = (a1 == (gid_t)-1) ? (uint32_t)-1 : a1;
23     uint32_t x2 = (a2 == (gid_t)-1) ? (uint32_t)-1 : a2;
24     
25     return setresgid32(x0,x1,x2);
26   }
27 }
28
29 #endif