From a97d025f9d557cb2e82b00c37b0d96c54a805a68 Mon Sep 17 00:00:00 2001 From: Philip Guenther Date: Wed, 11 Feb 2015 03:03:10 +0000 Subject: 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@ --- sys/kern/kern_sysctl.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'sys') 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; -- cgit v1.2.3