I'm in the middle of taking my first OS class, so hopefully I don't have any big misconceptions here.
I was wondering why getpid() is implemented as a system call in Linux. As I understand it, certain functions are made into system calls because they access or change information that the OS might want to protect, so they are implemented as a system call in order to transfer control to the kernel.
But as I understand it, getpid() is just returning the process id of the calling process. Is there any case where permission for this information wouldn't be granted? Wouldn't it be safe to simply let getpid() be a normal user function?
Thanks for the help.