getresuid.c 685 B

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