getresuid.c 715 B

123456789101112131415161718192021222324252627282930
  1. /* vi: set sw=4 ts=4: */
  2. /*
  3. * getresuid() for uClibc
  4. *
  5. * Copyright (C) 2000-2004 by Erik Andersen <andersen@codepoet.org>
  6. *
  7. * GNU Library General Public License (LGPL) version 2 or later.
  8. */
  9. #include "syscalls.h"
  10. #ifdef __NR_getresuid
  11. #define __NR___syscall_getresuid __NR_getresuid
  12. static inline _syscall3(int, __syscall_getresuid, __kernel_uid_t *, ruid,
  13. __kernel_uid_t *, euid, __kernel_uid_t *, suid);
  14. int getresuid(uid_t * ruid, uid_t * euid, uid_t * suid)
  15. {
  16. int result;
  17. __kernel_uid_t k_ruid, k_euid, k_suid;
  18. result = __syscall_getresuid(&k_ruid, &k_euid, &k_suid);
  19. if (result == 0) {
  20. *ruid = (uid_t) k_ruid;
  21. *euid = (uid_t) k_euid;
  22. *suid = (uid_t) k_suid;
  23. }
  24. return result;
  25. }
  26. #endif