John Baldwin jhb at
Thu May 28 13:53:09 UTC 2009

On Thursday 28 May 2009 12:48:17 am Sujit K M wrote:
> As per the Apple Documentation:
> In some cases it is helpful to impersonate the user, at least as far
> as the permissions checking done by the BSD subsystem of the kernel. A
> single-threaded daemon can do this using seteuid and setegid. These
> set the effective user and group ID of the process as a whole. This
> will cause problems if your daemon is using multiple threads to handle
> requests from different users. In that case you can set the effective
> user and group ID of a thread using pthread_setugid_np. This was
> introduced in Mac OS X 10.4.
> (AT)
> I think this is a part of the BSD (Mach) subsystem.

It has never been in BSD outside of OS X.  BSD from UC Berkeley did not 
support kernel threads and you are free to check the CVS history of the 
various kern_prot.c files on other BSD's yourself.  There is no BSD code to 
do this, and you could not use Darwin's code directly on FreeBSD anyway since 
the two OS's manage credential state differently.

John Baldwin

More information about the freebsd-arch mailing list