Search code examples
androidlibcuidbionic

How to get uid in bionic libc?


I am trying to get the uid of the process calling dns files in bionic libc. I know using current->cred->uid.val is used to get the uid in android/linux kernel, but how to get the uid in bionic libc. I don't think the same will work. Can you please suggest me a way to get uid in bionic libc and what headers to use?


Solution

  • The header is <unistd.h>, the functions are getuid, geteuid, getresuid and so on, depending on which kind of UID you need.