diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 747672a43..eaa3433f5 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,15 @@ +2009-11-12 Yaakov Selkowitz + Corinna Vinschen + + * sysconf.cc (get_nprocs): New function. + (get_nprocs_conf): Ditto. + (get_avphys_pages): Ditto. + (get_phys_pages): Ditto. + * cygwin.din: Export them. + * include/sys/sysinfo.h: New header, decalre above new functions. + * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump. + * posix.sgml: Mention them as GNU extensions. + 2009-11-11 Corinna Vinschen * fhandler.h (class fhandler_mailslot): Declare new private method diff --git a/winsup/cygwin/cygwin.din b/winsup/cygwin/cygwin.din index a10d18ca0..74c487946 100644 --- a/winsup/cygwin/cygwin.din +++ b/winsup/cygwin/cygwin.din @@ -598,8 +598,12 @@ gcvt SIGFE _gcvt = gcvt SIGFE gcvtf SIGFE _gcvtf = gcvtf SIGFE +get_avphys_pages SIGFE +get_nprocs SIGFE +get_nprocs_conf SIGFE get_osfhandle SIGFE _get_osfhandle = get_osfhandle SIGFE +get_phys_pages SIGFE getaddrinfo = cygwin_getaddrinfo SIGFE getc SIGFE _getc = getc SIGFE diff --git a/winsup/cygwin/include/cygwin/version.h b/winsup/cygwin/include/cygwin/version.h index e88bb9d9a..763a26c7c 100644 --- a/winsup/cygwin/include/cygwin/version.h +++ b/winsup/cygwin/include/cygwin/version.h @@ -371,12 +371,13 @@ details. */ 215: CW_EXIT_PROCESS added. 216: CW_SET_EXTERNAL_TOKEN added. 217: CW_GET_INSTKEY added. + 218: Export get_nprocs, get_nprocs_conf, get_phys_pages, get_avphys_pages. */ /* Note that we forgot to bump the api for ualarm, strtoll, strtoull */ #define CYGWIN_VERSION_API_MAJOR 0 -#define CYGWIN_VERSION_API_MINOR 217 +#define CYGWIN_VERSION_API_MINOR 218 /* There is also a compatibity version number associated with the shared memory regions. It is incremented when incompatible diff --git a/winsup/cygwin/include/sys/sysinfo.h b/winsup/cygwin/include/sys/sysinfo.h new file mode 100644 index 000000000..1e24c860a --- /dev/null +++ b/winsup/cygwin/include/sys/sysinfo.h @@ -0,0 +1,27 @@ +/* sys/sysinfo.h + + Copyright 2009 Red Hat, Inc. + +This file is part of Cygwin. + +This software is a copyrighted work licensed under the terms of the +Cygwin license. Please consult the file "CYGWIN_LICENSE" for +details. */ + +/* sys/sysinfo.h header file for Cygwin. */ + +#ifndef _SYS_SYSINFO_H +#define _SYS_SYSINFO_H + +#include + +__BEGIN_DECLS + +extern int get_nprocs_conf (void); +extern int get_nprocs (void); +extern long get_phys_pages (void); +extern long get_avphys_pages (void); + +__END_DECLS + +#endif /* _SYS_SYSINFO_H */ diff --git a/winsup/cygwin/posix.sgml b/winsup/cygwin/posix.sgml index 06e49d20a..8c88417da 100644 --- a/winsup/cygwin/posix.sgml +++ b/winsup/cygwin/posix.sgml @@ -1026,6 +1026,10 @@ also IEEE Std 1003.1-2008 (POSIX.1-2008). fopencookie fremovexattr fsetxattr + get_avphys_pages + get_phys_pages + get_nprocs + get_nprocs_conf getopt_long getopt_long_only getxattr diff --git a/winsup/cygwin/sysconf.cc b/winsup/cygwin/sysconf.cc index cf403fb77..84aced16a 100644 --- a/winsup/cygwin/sysconf.cc +++ b/winsup/cygwin/sysconf.cc @@ -1,7 +1,7 @@ /* sysconf.cc Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, - 2006, 2007 Red Hat, Inc. + 2006, 2007, 2009 Red Hat, Inc. This file is part of Cygwin. @@ -11,6 +11,7 @@ details. */ #include "winsup.h" #include +#include #include "cygerrno.h" #include "security.h" #include "path.h" @@ -292,3 +293,27 @@ confstr (int in, char *buf, size_t len) set_errno (EINVAL); return 0; } + +extern "C" int +get_nprocs_conf (void) +{ + return get_nproc_values (_SC_NPROCESSORS_CONF); +} + +extern "C" int +get_nprocs (void) +{ + return get_nproc_values (_SC_NPROCESSORS_ONLN); +} + +extern "C" long +get_phys_pages (void) +{ + return get_nproc_values (_SC_PHYS_PAGES); +} + +extern "C" long +get_avphys_pages (void) +{ + return get_avphys (_SC_AVPHYS_PAGES); +}