Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-6]: src Pull up following revision(s) (requested by christos in t...



details:   https://anonhg.NetBSD.org/src/rev/b0a34dae26c3
branches:  netbsd-6
changeset: 775538:b0a34dae26c3
user:      riz <riz%NetBSD.org@localhost>
date:      Wed Nov 28 21:38:12 2012 +0000

description:
Pull up following revision(s) (requested by christos in ticket #720):
        sys/sys/unistd.h: revision 1.54
        lib/libc/gen/sysconf.3: revision 1.41
        lib/libc/gen/sysconf.c: revision 1.35
add _SC_PHYS_PAGES
Add _SC_PHYS_PAGES
Add _SC_PHYS_PAGES

diffstat:

 lib/libc/gen/sysconf.3 |   8 ++++++--
 lib/libc/gen/sysconf.c |  13 +++++++++++--
 sys/sys/unistd.h       |   5 ++++-
 3 files changed, 21 insertions(+), 5 deletions(-)

diffs (89 lines):

diff -r 4510d8c810c1 -r b0a34dae26c3 lib/libc/gen/sysconf.3
--- a/lib/libc/gen/sysconf.3    Wed Nov 28 21:34:30 2012 +0000
+++ b/lib/libc/gen/sysconf.3    Wed Nov 28 21:38:12 2012 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: sysconf.3,v 1.40 2011/08/23 17:28:34 jmcneill Exp $
+.\"    $NetBSD: sysconf.3,v 1.40.4.1 2012/11/28 21:38:12 riz Exp $
 .\"
 .\" Copyright (c) 1993
 .\"    The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"    @(#)sysconf.3   8.3 (Berkeley) 4/19/94
 .\"
-.Dd August 23, 2011
+.Dd November 2, 2012
 .Dt SYSCONF 3
 .Os
 .Sh NAME
@@ -282,6 +282,10 @@
 The number of processors configured.
 .It Li _SC_NPROCESSORS_ONLN
 The number of processors online (capable of running processes).
+.It Li _SC_PHYS_PAGES
+The amount of physical memory on the system in 
+.Li _SC_PAGESIZE
+bytes.
 .El
 .Sh RETURN VALUES
 If the call to
diff -r 4510d8c810c1 -r b0a34dae26c3 lib/libc/gen/sysconf.c
--- a/lib/libc/gen/sysconf.c    Wed Nov 28 21:34:30 2012 +0000
+++ b/lib/libc/gen/sysconf.c    Wed Nov 28 21:38:12 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sysconf.c,v 1.33.22.1 2012/08/09 06:49:23 jdc Exp $    */
+/*     $NetBSD: sysconf.c,v 1.33.22.2 2012/11/28 21:38:13 riz Exp $    */
 
 /*-
  * Copyright (c) 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)sysconf.c  8.2 (Berkeley) 3/20/94";
 #else
-__RCSID("$NetBSD: sysconf.c,v 1.33.22.1 2012/08/09 06:49:23 jdc Exp $");
+__RCSID("$NetBSD: sysconf.c,v 1.33.22.2 2012/11/28 21:38:13 riz Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -75,6 +75,7 @@
 {
        struct rlimit rl;
        size_t len;
+       uint64_t mem;
        int mib[CTL_MAXNAME], value;
        unsigned int mib_len;
        struct clockinfo tmpclock;
@@ -367,6 +368,14 @@
                mib[1] = HW_NCPUONLINE;
                break;
 
+/* Linux/Solaris */
+       case _SC_PHYS_PAGES:
+               len = sizeof(mem);
+               mib[0] = CTL_HW;
+               mib[1] = HW_PHYSMEM64;
+               return sysctl(mib, 2, &mem, &len, NULL, 0) == -1 ? -1 : 
+                   (long)(mem / _getpagesize()); 
+
 /* Native */
        case _SC_SCHED_RT_TS:
                if (sysctlgetmibinfo("kern.sched.rtts", &mib[0], &mib_len,
diff -r 4510d8c810c1 -r b0a34dae26c3 sys/sys/unistd.h
--- a/sys/sys/unistd.h  Wed Nov 28 21:34:30 2012 +0000
+++ b/sys/sys/unistd.h  Wed Nov 28 21:38:12 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: unistd.h,v 1.52.18.1 2012/08/09 06:49:23 jdc Exp $     */
+/*     $NetBSD: unistd.h,v 1.52.18.2 2012/11/28 21:38:12 riz Exp $     */
 
 /*
  * Copyright (c) 1989, 1993
@@ -306,6 +306,9 @@
 /* This is implemented */
 #define        _SC_SPAWN                       86
 
+/* Extensions found in Solaris and Linux. */
+#define        _SC_PHYS_PAGES          121
+
 #ifdef _NETBSD_SOURCE
 /* Commonly provided sysconf() extensions */
 #define        _SC_NPROCESSORS_CONF    1001



Home | Main Index | Thread Index | Old Index