getresgid.c 920 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * getresgid() for uClibc
  3. *
  4. * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
  5. *
  6. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  7. */
  8. #include <sys/syscall.h>
  9. #ifdef __USE_GNU
  10. #include <unistd.h>
  11. #if defined(__NR_getresgid32)
  12. # undef __NR_getresgid
  13. # define __NR_getresgid __NR_getresgid32
  14. _syscall3(int, getresgid, gid_t *, rgid, gid_t *, egid, gid_t *, sgid)
  15. #elif defined(__NR_getresgid)
  16. # define __NR___syscall_getresgid __NR_getresgid
  17. static __inline__ _syscall3(int, __syscall_getresgid, __kernel_gid_t *, rgid,
  18. __kernel_gid_t *, egid, __kernel_gid_t *, sgid)
  19. int getresgid(gid_t * rgid, gid_t * egid, gid_t * sgid)
  20. {
  21. int result;
  22. __kernel_gid_t k_rgid, k_egid, k_sgid;
  23. result = __syscall_getresgid(&k_rgid, &k_egid, &k_sgid);
  24. if (result == 0) {
  25. *rgid = (gid_t) k_rgid;
  26. *egid = (gid_t) k_egid;
  27. *sgid = (gid_t) k_sgid;
  28. }
  29. return result;
  30. }
  31. #endif
  32. #endif