Melab
Melab

Reputation: 2822

Is seteuid a system call on Linux?

All of the literature that I have read so far on setuid talks about seteuid in a way that implies it is a system call. The section 2 man pages never say if a function is a system call or not, so seteuid(2) is no help. And if it isn't a system call, meaning the functionality is not provided by the kernel, then how can "set effective UID" be achieved?

Upvotes: 3

Views: 2095

Answers (2)

codegrep_admin
codegrep_admin

Reputation: 529

You can easily verify if it is a system call or if it is defined in libc by writing a little program and running strace on it. For example,

int main() {
  seteuid();
}
gcc -o main main.c
-bash-4.2$ strace ./main 2>&1 | grep set
setresuid(-1, 1, -1)                    = -1 EPERM (Operation not permitted)

So in this case seteuid is implemented in libc. See here for implementation

Upvotes: 0

Chris Dodd
Chris Dodd

Reputation: 126203

The section 2 man pages are all system calls -- that's what section 2 is for. The section 3 man pages are all library calls, as that's what section 3 is for. See man(1) (the manual page for man itself) for the list of sections and what they are:

   1   Executable programs or shell commands
   2   System calls (functions provided by the kernel)
   3   Library calls (functions within program libraries)
   4   Special files (usually found in /dev)
   5   File formats and conventions eg /etc/passwd
   6   Games
   7   Miscellaneous  (including  macro  packages  and  conventions), e.g.
       man(7), groff(7)
   8   System administration commands (usually only for root)
   9   Kernel routines [Non standard]

Upvotes: 7

Related Questions