* 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.
This commit is contained in:
Corinna Vinschen 2009-11-12 14:40:48 +00:00
parent c08f09ab78
commit 339682e6de
6 changed files with 75 additions and 2 deletions

View File

@ -1,3 +1,15 @@
2009-11-12 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
Corinna Vinschen <corinna@vinschen.de>
* 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 <corinna@vinschen.de> 2009-11-11 Corinna Vinschen <corinna@vinschen.de>
* fhandler.h (class fhandler_mailslot): Declare new private method * fhandler.h (class fhandler_mailslot): Declare new private method

View File

@ -598,8 +598,12 @@ gcvt SIGFE
_gcvt = gcvt SIGFE _gcvt = gcvt SIGFE
gcvtf SIGFE gcvtf SIGFE
_gcvtf = gcvtf SIGFE _gcvtf = gcvtf SIGFE
get_avphys_pages SIGFE
get_nprocs SIGFE
get_nprocs_conf SIGFE
get_osfhandle SIGFE get_osfhandle SIGFE
_get_osfhandle = get_osfhandle SIGFE _get_osfhandle = get_osfhandle SIGFE
get_phys_pages SIGFE
getaddrinfo = cygwin_getaddrinfo SIGFE getaddrinfo = cygwin_getaddrinfo SIGFE
getc SIGFE getc SIGFE
_getc = getc SIGFE _getc = getc SIGFE

View File

@ -371,12 +371,13 @@ details. */
215: CW_EXIT_PROCESS added. 215: CW_EXIT_PROCESS added.
216: CW_SET_EXTERNAL_TOKEN added. 216: CW_SET_EXTERNAL_TOKEN added.
217: CW_GET_INSTKEY 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 */ /* Note that we forgot to bump the api for ualarm, strtoll, strtoull */
#define CYGWIN_VERSION_API_MAJOR 0 #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 /* There is also a compatibity version number associated with the
shared memory regions. It is incremented when incompatible shared memory regions. It is incremented when incompatible

View File

@ -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 <sys/cdefs.h>
__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 */

View File

@ -1026,6 +1026,10 @@ also IEEE Std 1003.1-2008 (POSIX.1-2008).</para>
fopencookie fopencookie
fremovexattr fremovexattr
fsetxattr fsetxattr
get_avphys_pages
get_phys_pages
get_nprocs
get_nprocs_conf
getopt_long getopt_long
getopt_long_only getopt_long_only
getxattr getxattr

View File

@ -1,7 +1,7 @@
/* sysconf.cc /* sysconf.cc
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 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. This file is part of Cygwin.
@ -11,6 +11,7 @@ details. */
#include "winsup.h" #include "winsup.h"
#include <unistd.h> #include <unistd.h>
#include <sys/sysinfo.h>
#include "cygerrno.h" #include "cygerrno.h"
#include "security.h" #include "security.h"
#include "path.h" #include "path.h"
@ -292,3 +293,27 @@ confstr (int in, char *buf, size_t len)
set_errno (EINVAL); set_errno (EINVAL);
return 0; 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);
}