That's exactly what I was looking for. So can you tell me if that's
documented anywhere -- or is this just in the collective knowledge
of the Mac OS X Gestalt?
Do you consider the kernel sources documentation? ;-)
• /*
• * Set the per-thread override identity. The first parameter can be
the
• * current real UID, KAUTH_UID_NONE, or, if the caller is
priviledged, it
• * can be any UID. If it is KAUTH_UID_NONE, then as a special case,
this
• * means "revert to the per process credential"; otherwise, if
permitted,
• * it changes the effective, real, and saved UIDs and GIDs for the
current
• * thread to the requested UID and single GID, and clears all other
GIDs.
• */
This comment prefixes the implementation of settid in xnu/bsd/kern/
kern_prot.c.
I'll file a bug report on the lack of documentation for
pthread_getugid_np/pthread_setugid_np.