diff options
author | csjp <csjp@FreeBSD.org> | 2004-11-19 16:11:54 +0000 |
---|---|---|
committer | csjp <csjp@FreeBSD.org> | 2004-11-19 16:11:54 +0000 |
commit | 9fa188200688cf5fb3cdc4886bdba90c50a33d8f (patch) | |
tree | 514718ab4ced0ee64f53eb6bdead437089fcbc6d /bin | |
parent | efabaa0455d0e03853f1a282bcca3f7bb9f88db9 (diff) | |
download | FreeBSD-src-9fa188200688cf5fb3cdc4886bdba90c50a33d8f.zip FreeBSD-src-9fa188200688cf5fb3cdc4886bdba90c50a33d8f.tar.gz |
Use statfs instead of getmntinfo(). This will make the procfs checks
play nicer in prisons. It also simplifies things.
Reviewed by: rwatson
Bumped into by: Jilles Tjoelker
Diffstat (limited to 'bin')
-rw-r--r-- | bin/ps/ps.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/bin/ps/ps.c b/bin/ps/ps.c index 6455ea6..2bedc17 100644 --- a/bin/ps/ps.c +++ b/bin/ps/ps.c @@ -1179,16 +1179,13 @@ kludge_oldps_options(const char *optlist, char *origval, const char *nextarg) static int check_procfs(void) { - struct statfs *mntbuf; - size_t mntsize, i; + struct statfs mnt; - mntsize = getmntinfo(&mntbuf, MNT_NOWAIT); - for (i = 0; i < mntsize; i++) - if (strcmp(mntbuf[i].f_mntonname, "/proc") == 0 && - strcmp(mntbuf[i].f_fstypename, "procfs") == 0) { - return (1); - } - return (0); + if (statfs("/proc", &mnt) < 0) + return (0); + if (strcmp(mnt.f_fstypename, "procfs") != 0) + return (0); + return (1); } static void |