getresgid.c 945 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /* vi: set sw=4 ts=4: */
  2. /*
  3. * getresgid() 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. #include <sys/syscall.h>
  10. #ifdef __USE_GNU
  11. #include <unistd.h>
  12. #if defined(__NR_getresgid32)
  13. # undef __NR_getresgid
  14. # define __NR_getresgid __NR_getresgid32
  15. _syscall3(int, getresgid, gid_t *, rgid, gid_t *, egid, gid_t *, sgid)
  16. #elif defined(__NR_getresgid)
  17. # define __NR___syscall_getresgid __NR_getresgid
  18. static __inline__ _syscall3(int, __syscall_getresgid, __kernel_gid_t *, rgid,
  19. __kernel_gid_t *, egid, __kernel_gid_t *, sgid)
  20. int getresgid(gid_t * rgid, gid_t * egid, gid_t * sgid)
  21. {
  22. int result;
  23. __kernel_gid_t k_rgid, k_egid, k_sgid;
  24. result = __syscall_getresgid(&k_rgid, &k_egid, &k_sgid);
  25. if (result == 0) {
  26. *rgid = (gid_t) k_rgid;
  27. *egid = (gid_t) k_egid;
  28. *sgid = (gid_t) k_sgid;
  29. }
  30. return result;
  31. }
  32. #endif
  33. #endif