KLD and UID

Simon Timms timmssimon at shaw.ca
Tue Mar 16 22:12:24 PST 2004


Hi there, I am playing around with kernel modules trying to learn
something and hopefully not destroy my computer too badly.  Right now my
goal is to print out the user id from an open() call.  I am basing my
work around that found at http://www.nux-acid.org/src/open.c.  To that
basic code I added (in the new_open method) 
 
printf("uid %u\n", p->p_ucred->cr_uid);
 
However this completely doesn't work and I end up crashing the kernel.
I notice in other places people do things like
 
uid_t uid = p->p_cred->p_svuid;
 
however I don't see a p_cred member in the proc structure.  Is there
something obvious I am missing here?  Complete code listing at
http://simon.ma.cx/module.c.  Any additional comments/criticisms always
appreciated.  
 
Thanks, Simon


More information about the freebsd-questions mailing list