Date: Tue, 14 May 2013 10:00:21 +0200 From: Mike Ma <mikemandarine@gmail.com> To: freebsd-hackers@freebsd.org Subject: How to get ucred/xucred in user space? Message-ID: <CA%2BcqwfdohLfzeJXx-2wPwMjZDq3zX-BnDcOpyz_MU4PS9Ur6DA@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
Hi folks, Can I ask if there's any way to get ucred/xucred of a process in user space? As I'm trying to port glustertfs and it's a userland filesystem, I need to get secondary groups of a process. AFAIK, Linux gets them in /proc and NetBSD gets them in this way: int name[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, frame->root->pid }; size_t namelen = sizeof name / sizeof name[0]; struct kinfo_proc kp; size_t kplen = sizeof(kp); int i, ngroups; if (sysctl(name, namelen, &kp, &kplen, NULL, 0) != 0) return; ngroups = MIN(kp.kp_eproc.e_ucred.cr_ngroups, GF_REQUEST_MAXGROUPS); I realized none of them would work in FreeBSD. I'm wondering if there's any alternative way to get group information? -- Cheers, Mike
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CA%2BcqwfdohLfzeJXx-2wPwMjZDq3zX-BnDcOpyz_MU4PS9Ur6DA>