5 #include <sys/socket.h>
8 getepinfo(endpoint_t proc_ep
, uid_t
*uid
, gid_t
*gid
)
13 memset(&m
, 0, sizeof(m
));
14 m
.m_lsys_pm_getepinfo
.endpt
= proc_ep
;
15 m
.m_lsys_pm_getepinfo
.groups
= (vir_bytes
)NULL
;
16 m
.m_lsys_pm_getepinfo
.ngroups
= 0;
18 if ((r
= _taskcall(PM_PROC_NR
, PM_GETEPINFO
, &m
)) < 0)
22 *uid
= m
.m_pm_lsys_getepinfo
.euid
;
24 *gid
= m
.m_pm_lsys_getepinfo
.egid
;
29 getnpid(endpoint_t proc_ep
)
31 return getepinfo(proc_ep
, NULL
, NULL
);
35 getnuid(endpoint_t proc_ep
)
40 if ((r
= getepinfo(proc_ep
, &uid
, NULL
)) < 0)
47 getngid(endpoint_t proc_ep
)
52 if ((r
= getepinfo(proc_ep
, NULL
, &gid
)) < 0)
59 getsockcred(endpoint_t proc_ep
, struct sockcred
* sockcred
, gid_t
* groups
,
65 memset(&m
, 0, sizeof(m
));
66 m
.m_lsys_pm_getepinfo
.endpt
= proc_ep
;
67 m
.m_lsys_pm_getepinfo
.groups
= (vir_bytes
)groups
;
68 m
.m_lsys_pm_getepinfo
.ngroups
= ngroups
;
70 if ((r
= _taskcall(PM_PROC_NR
, PM_GETEPINFO
, &m
)) < 0)
73 sockcred
->sc_uid
= m
.m_pm_lsys_getepinfo
.uid
;
74 sockcred
->sc_euid
= m
.m_pm_lsys_getepinfo
.euid
;
75 sockcred
->sc_gid
= m
.m_pm_lsys_getepinfo
.gid
;
76 sockcred
->sc_egid
= m
.m_pm_lsys_getepinfo
.egid
;
77 sockcred
->sc_ngroups
= m
.m_pm_lsys_getepinfo
.ngroups
;