Based on the feedback on wasabisystems.com!bsd-api-discuss (sure wish
people would read that list in a more timely fashion!), change the new 64-bit memory reporting sysctl nodes to report bytes. This should not be a problem, since it's only a week old, and no applications use the new nodes yet.
This commit is contained in:
parent
feeb962699
commit
9e7bb2595e
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: kern_sysctl.c,v 1.130 2003/03/05 11:46:49 dsl Exp $ */
|
/* $NetBSD: kern_sysctl.c,v 1.131 2003/03/06 20:33:00 thorpej Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1982, 1986, 1989, 1993
|
* Copyright (c) 1982, 1986, 1989, 1993
|
||||||
|
@ -43,7 +43,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: kern_sysctl.c,v 1.130 2003/03/05 11:46:49 dsl Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: kern_sysctl.c,v 1.131 2003/03/06 20:33:00 thorpej Exp $");
|
||||||
|
|
||||||
#include "opt_ddb.h"
|
#include "opt_ddb.h"
|
||||||
#include "opt_insecure.h"
|
#include "opt_insecure.h"
|
||||||
|
@ -692,15 +692,31 @@ hw_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp,
|
||||||
case HW_BYTEORDER:
|
case HW_BYTEORDER:
|
||||||
return (sysctl_rdint(oldp, oldlenp, newp, BYTE_ORDER));
|
return (sysctl_rdint(oldp, oldlenp, newp, BYTE_ORDER));
|
||||||
case HW_PHYSMEM:
|
case HW_PHYSMEM:
|
||||||
return (sysctl_rdint(oldp, oldlenp, newp, ctob(physmem)));
|
{
|
||||||
case HW_PHYSPAGES:
|
u_int rval;
|
||||||
return (sysctl_rdquad(oldp, oldlenp, newp, physmem));
|
|
||||||
case HW_USERMEM:
|
if ((u_int)physmem > (UINT_MAX / PAGE_SIZE))
|
||||||
return (sysctl_rdint(oldp, oldlenp, newp,
|
rval = UINT_MAX;
|
||||||
ctob(physmem - uvmexp.wired)));
|
else
|
||||||
case HW_USERPAGES:
|
rval = physmem * PAGE_SIZE;
|
||||||
|
return (sysctl_rdint(oldp, oldlenp, newp, rval));
|
||||||
|
}
|
||||||
|
case HW_PHYSMEM64:
|
||||||
return (sysctl_rdquad(oldp, oldlenp, newp,
|
return (sysctl_rdquad(oldp, oldlenp, newp,
|
||||||
physmem - uvmexp.wired));
|
(u_quad_t)physmem * PAGE_SIZE));
|
||||||
|
case HW_USERMEM:
|
||||||
|
{
|
||||||
|
u_int rval;
|
||||||
|
|
||||||
|
if ((u_int)(physmem - uvmexp.wired) > (UINT_MAX / PAGE_SIZE))
|
||||||
|
rval = UINT_MAX;
|
||||||
|
else
|
||||||
|
rval = (physmem - uvmexp.wired) * PAGE_SIZE;
|
||||||
|
return (sysctl_rdint(oldp, oldlenp, newp, rval));
|
||||||
|
}
|
||||||
|
case HW_USERMEM64:
|
||||||
|
return (sysctl_rdquad(oldp, oldlenp, newp,
|
||||||
|
(u_quad_t)(physmem - uvmexp.wired) * PAGE_SIZE));
|
||||||
case HW_PAGESIZE:
|
case HW_PAGESIZE:
|
||||||
return (sysctl_rdint(oldp, oldlenp, newp, PAGE_SIZE));
|
return (sysctl_rdint(oldp, oldlenp, newp, PAGE_SIZE));
|
||||||
case HW_ALIGNBYTES:
|
case HW_ALIGNBYTES:
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: sysctl.h,v 1.92 2003/03/01 05:41:55 atatat Exp $ */
|
/* $NetBSD: sysctl.h,v 1.93 2003/03/06 20:32:59 thorpej Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1989, 1993
|
* Copyright (c) 1989, 1993
|
||||||
|
@ -532,8 +532,8 @@ struct kinfo_lwp {
|
||||||
#define HW_MACHINE_ARCH 10 /* string: machine architecture */
|
#define HW_MACHINE_ARCH 10 /* string: machine architecture */
|
||||||
#define HW_ALIGNBYTES 11 /* int: ALIGNBYTES for the kernel */
|
#define HW_ALIGNBYTES 11 /* int: ALIGNBYTES for the kernel */
|
||||||
#define HW_CNMAGIC 12 /* string: console magic sequence(s) */
|
#define HW_CNMAGIC 12 /* string: console magic sequence(s) */
|
||||||
#define HW_PHYSPAGES 13 /* quad: total memory (pages) */
|
#define HW_PHYSMEM64 13 /* quad: total memory (bytes) */
|
||||||
#define HW_USERPAGES 14 /* quad: non-kernel memory (pages) */
|
#define HW_USERMEM64 14 /* quad: non-kernel memory (bytes) */
|
||||||
#define HW_MAXID 15 /* number of valid hw ids */
|
#define HW_MAXID 15 /* number of valid hw ids */
|
||||||
|
|
||||||
#define CTL_HW_NAMES { \
|
#define CTL_HW_NAMES { \
|
||||||
|
@ -550,8 +550,8 @@ struct kinfo_lwp {
|
||||||
{ "machine_arch", CTLTYPE_STRING }, \
|
{ "machine_arch", CTLTYPE_STRING }, \
|
||||||
{ "alignbytes", CTLTYPE_INT }, \
|
{ "alignbytes", CTLTYPE_INT }, \
|
||||||
{ "cnmagic", CTLTYPE_STRING }, \
|
{ "cnmagic", CTLTYPE_STRING }, \
|
||||||
{ "physpages", CTLTYPE_QUAD }, \
|
{ "physmem64", CTLTYPE_QUAD }, \
|
||||||
{ "userpages", CTLTYPE_QUAD }, \
|
{ "usermem64", CTLTYPE_QUAD }, \
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue