Subject: Re: uid,gid, and socket protocols
To: Joe Reed <>
From: Andrew Brown <>
List: tech-kern
Date: 09/06/2002 12:07:32
>1)  what is the proper way of getting the uid and gid of a process from the 
>proc struct?  can i just p->p_cred->p_ruid, or would p_svuid be better?  or 
>is there a macro or someting i'm missing?

p->p_ucred->cr_uid and p->p_ucred->cr_gid, i would imagine.  unless
you specifically want the real uid or saved uid.

>2) how to i determine what protocol a socket is using?  i want to be able to 
>differentiate between a TCP/UDP/ICMP socket.  i was looking at the protosw 
>struct, but couln't find the values for the pr_protocol member.  where are 
>they located?


|-----< "CODE WARRIOR" >-----|             * "ah!  i see you have the internet (Andrew Brown)                that goes *ping*!"       * "information is power -- share the wealth."