Date: Sat, 20 Apr 2013 07:58:21 +0000 (UTC) From: Mikolaj Golub <trociny@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249673 - head/usr.bin/procstat Message-ID: <201304200758.r3K7wLia097962@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: trociny Date: Sat Apr 20 07:58:20 2013 New Revision: 249673 URL: http://svnweb.freebsd.org/changeset/base/249673 Log: Use procstat_getumask(3) for retrieving umaks information instead of direct sysctl. MFC after: 1 month Modified: head/usr.bin/procstat/procstat_cred.c Modified: head/usr.bin/procstat/procstat_cred.c ============================================================================== --- head/usr.bin/procstat/procstat_cred.c Sat Apr 20 07:57:08 2013 (r249672) +++ head/usr.bin/procstat/procstat_cred.c Sat Apr 20 07:58:20 2013 (r249673) @@ -38,7 +38,8 @@ #include "procstat.h" -static const char *get_umask(struct kinfo_proc *kipp); +static const char *get_umask(struct procstat *procstat, + struct kinfo_proc *kipp); void procstat_cred(struct procstat *procstat, struct kinfo_proc *kipp) @@ -59,7 +60,7 @@ procstat_cred(struct procstat *procstat, printf("%5d ", kipp->ki_groups[0]); printf("%5d ", kipp->ki_rgid); printf("%5d ", kipp->ki_svgid); - printf("%5s ", get_umask(kipp)); + printf("%5s ", get_umask(procstat, kipp)); printf("%s", kipp->ki_cr_flags & CRED_FLAG_CAPMODE ? "C" : "-"); printf(" "); @@ -84,21 +85,12 @@ procstat_cred(struct procstat *procstat, } static const char * -get_umask(struct kinfo_proc *kipp) +get_umask(struct procstat *procstat, struct kinfo_proc *kipp) { - int error; - int mib[4]; - size_t len; u_short fd_cmask; static char umask[4]; - mib[0] = CTL_KERN; - mib[1] = KERN_PROC; - mib[2] = KERN_PROC_UMASK; - mib[3] = kipp->ki_pid; - len = sizeof(fd_cmask); - error = sysctl(mib, 4, &fd_cmask, &len, NULL, 0); - if (error == 0) { + if (procstat_getumask(procstat, kipp, &fd_cmask) == 0) { snprintf(umask, 4, "%03o", fd_cmask); return (umask); } else {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201304200758.r3K7wLia097962>