Access to structure in <sys/user.h>
Chris Torek
chris at mimsy.UUCP
Tue Dec 30 20:22:55 AEST 1986
In article <96 at osupyr.UUCP> dusan at osupyr.UUCP (Dusan Nedeljkovic) writes:
>Does anyone have any clues as to how to access the "user" structure
>in <sys/user.h> ?
For anyone with source, the answer is `do what ``ps'' does'. For those
on a 4BSD Vax, there is a terribly hacky shortcut if you want to read
only your own user structure. It is already in your address space.
#include <sys/param.h>
#include <sys/dir.h>
#include <sys/user.h>
main()
{
struct user u;
u = *(struct user *)(0x80000000 - UPAGES*NBPG);
printf("%d %d\n", u.u_uid, u.u_gid);
}
`Undocumented features are subject to change without notice.'
--
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690)
UUCP: seismo!mimsy!chris ARPA/CSNet: chris at mimsy.umd.edu
More information about the Comp.unix.questions
mailing list