like KERN_FILE2: *do* update "needed" when there is no count. we want
userland to know what sort of size to provide.. while here, slightly normalise the previous to init_sysctl.c.
This commit is contained in:
parent
aa75a65af2
commit
ce98775552
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: init_sysctl.c,v 1.158 2009/03/11 01:30:27 mrg Exp $ */
|
||||
/* $NetBSD: init_sysctl.c,v 1.159 2009/03/11 05:55:22 mrg Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003, 2007, 2008 The NetBSD Foundation, Inc.
|
||||
|
@ -30,7 +30,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: init_sysctl.c,v 1.158 2009/03/11 01:30:27 mrg Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: init_sysctl.c,v 1.159 2009/03/11 05:55:22 mrg Exp $");
|
||||
|
||||
#include "opt_sysv.h"
|
||||
#include "opt_compat_netbsd32.h"
|
||||
|
@ -2040,10 +2040,8 @@ sysctl_kern_file2(SYSCTLFN_ARGS)
|
|||
mutex_exit(&fp->f_lock);
|
||||
}
|
||||
needed += elem_size;
|
||||
if (elem_count > 0) {
|
||||
if (elem_count != INT_MAX)
|
||||
elem_count--;
|
||||
}
|
||||
if (elem_count > 0 && elem_count != INT_MAX)
|
||||
elem_count--;
|
||||
}
|
||||
mutex_exit(&filelist_lock);
|
||||
fputdummy(tp);
|
||||
|
@ -2116,10 +2114,8 @@ sysctl_kern_file2(SYSCTLFN_ARGS)
|
|||
mutex_exit(&ff->ff_lock);
|
||||
}
|
||||
needed += elem_size;
|
||||
if (elem_count > 0) {
|
||||
if (elem_count != INT_MAX)
|
||||
elem_count--;
|
||||
}
|
||||
if (elem_count > 0 && elem_count != INT_MAX)
|
||||
elem_count--;
|
||||
}
|
||||
mutex_exit(&fd->fd_lock);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: uipc_domain.c,v 1.77 2008/12/07 20:58:46 pooka Exp $ */
|
||||
/* $NetBSD: uipc_domain.c,v 1.78 2009/03/11 05:55:22 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1993
|
||||
|
@ -32,7 +32,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: uipc_domain.c,v 1.77 2008/12/07 20:58:46 pooka Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: uipc_domain.c,v 1.78 2009/03/11 05:55:22 mrg Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/socket.h>
|
||||
|
@ -460,11 +460,9 @@ sysctl_unpcblist(SYSCTLFN_ARGS)
|
|||
dp += elem_size;
|
||||
len -= elem_size;
|
||||
}
|
||||
if (elem_count > 0) {
|
||||
needed += elem_size;
|
||||
if (elem_count != INT_MAX)
|
||||
elem_count--;
|
||||
}
|
||||
needed += elem_size;
|
||||
if (elem_count > 0 && elem_count != INT_MAX)
|
||||
elem_count--;
|
||||
}
|
||||
mutex_exit(&filelist_lock);
|
||||
fputdummy(dfp);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: vfs_bio.c,v 1.217 2009/02/23 20:33:30 ad Exp $ */
|
||||
/* $NetBSD: vfs_bio.c,v 1.218 2009/03/11 05:55:22 mrg Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
|
||||
|
@ -107,7 +107,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.217 2009/02/23 20:33:30 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.218 2009/03/11 05:55:22 mrg Exp $");
|
||||
|
||||
#include "fs_ffs.h"
|
||||
#include "opt_bufcache.h"
|
||||
|
@ -1748,11 +1748,9 @@ sysctl_dobuf(SYSCTLFN_ARGS)
|
|||
dp += elem_size;
|
||||
len -= elem_size;
|
||||
}
|
||||
if (elem_count > 0) {
|
||||
needed += elem_size;
|
||||
if (elem_count != INT_MAX)
|
||||
elem_count--;
|
||||
}
|
||||
needed += elem_size;
|
||||
if (elem_count > 0 && elem_count != INT_MAX)
|
||||
elem_count--;
|
||||
}
|
||||
if (error != 0)
|
||||
break;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: bpf.c,v 1.142 2009/01/11 02:45:54 christos Exp $ */
|
||||
/* $NetBSD: bpf.c,v 1.143 2009/03/11 05:55:22 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1990, 1991, 1993
|
||||
|
@ -39,7 +39,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: bpf.c,v 1.142 2009/01/11 02:45:54 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: bpf.c,v 1.143 2009/03/11 05:55:22 mrg Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_bpf.h"
|
||||
|
@ -1846,11 +1846,9 @@ sysctl_net_bpf_peers(SYSCTLFN_ARGS)
|
|||
sp += elem_size;
|
||||
len -= elem_size;
|
||||
}
|
||||
if (elem_count > 0) {
|
||||
needed += elem_size;
|
||||
if (elem_count != INT_MAX)
|
||||
elem_count--;
|
||||
}
|
||||
needed += elem_size;
|
||||
if (elem_count > 0 && elem_count != INT_MAX)
|
||||
elem_count--;
|
||||
}
|
||||
mutex_exit(&bpf_mtx);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: tcp_usrreq.c,v 1.151 2009/02/18 13:18:32 yamt Exp $ */
|
||||
/* $NetBSD: tcp_usrreq.c,v 1.152 2009/03/11 05:55:22 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
||||
|
@ -95,7 +95,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.151 2009/02/18 13:18:32 yamt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.152 2009/03/11 05:55:22 mrg Exp $");
|
||||
|
||||
#include "opt_inet.h"
|
||||
#include "opt_ipsec.h"
|
||||
|
@ -1560,11 +1560,9 @@ sysctl_inpcblist(SYSCTLFN_ARGS)
|
|||
dp += elem_size;
|
||||
len -= elem_size;
|
||||
}
|
||||
if (elem_count > 0) {
|
||||
needed += elem_size;
|
||||
if (elem_count != INT_MAX)
|
||||
elem_count--;
|
||||
}
|
||||
needed += elem_size;
|
||||
if (elem_count > 0 && elem_count != INT_MAX)
|
||||
elem_count--;
|
||||
}
|
||||
|
||||
*oldlenp = needed;
|
||||
|
|
Loading…
Reference in New Issue