* 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,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 <unistd.h>
#include <sys/sysinfo.h>
#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);
}