diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2015-02-11 03:03:10 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2015-02-11 03:03:10 +0000 |
commit | a97d025f9d557cb2e82b00c37b0d96c54a805a68 (patch) | |
tree | d519b13fe30095c21d06350bca185a5525010720 /sys | |
parent | b62d642f586ac0d39a5ae95ec450b3e137b276f2 (diff) |
sysctl({CTL_KERN, KERN_FILE, KERN_FILE_BYFILE}) previously required
the extra argument to be zero; instead, make it filter on the file
type (DTYPE_*) when non-zero to make claudio's netstat work easier.
ok claudio@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/kern_sysctl.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c index 4533da7223a..2708e7a0e53 100644 --- a/sys/kern/kern_sysctl.c +++ b/sys/kern/kern_sysctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sysctl.c,v 1.280 2015/02/09 11:52:47 miod Exp $ */ +/* $OpenBSD: kern_sysctl.c,v 1.281 2015/02/11 03:03:08 guenther Exp $ */ /* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */ /*- @@ -1231,14 +1231,11 @@ sysctl_file(int *name, u_int namelen, char *where, size_t *sizep, switch (op) { case KERN_FILE_BYFILE: - if (arg != 0) { - /* no arg in file mode */ - error = EINVAL; - break; - } LIST_FOREACH(fp, &filehead, f_list) { if (fp->f_count == 0) continue; + if (arg && fp->f_type != arg) + continue; FILLIT(fp, NULL, 0, NULL, NULL); } break; |