diff options
author | Bruno Haible <bruno@clisp.org> | 2009-10-18 10:56:30 +0200 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2009-10-18 10:56:30 +0200 |
commit | c1c314994ba1f47f5af0be7600c400841c5d34da (patch) | |
tree | 953d404d76b7547ea8197a9bb829ff9da13a3c79 /lib/nproc.c | |
parent | 2ea759e2faab0331078b1ea0df244ef781dbd994 (diff) | |
download | gnulib-c1c314994ba1f47f5af0be7600c400841c5d34da.tar.gz |
Implement nproc for IRIX.
Diffstat (limited to 'lib/nproc.c')
-rw-r--r-- | lib/nproc.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/nproc.c b/lib/nproc.c index 48c0d8aff6..04a047cfb4 100644 --- a/lib/nproc.c +++ b/lib/nproc.c @@ -29,6 +29,10 @@ # include <sys/pstat.h> #endif +#if HAVE_SYS_SYSMP_H +# include <sys/sysmp.h> +#endif + #if HAVE_SYS_PARAM_H # include <sys/param.h> #endif @@ -62,6 +66,17 @@ num_processors (void) } #endif +#if HAVE_SYSMP && defined MP_NAPROCS + { /* This works on IRIX. */ + /* MP_NPROCS yields the number of installed processors. + MP_NAPROCS yields the number of processors available to unprivileged + processes. We need the latter. */ + int nprocs = sysmp (MP_NAPROCS); + if (0 < nprocs) + return nprocs; + } +#endif + #if HAVE_SYSCTL && defined HW_NCPU { /* This works on MacOS X, FreeBSD, NetBSD, OpenBSD. */ int nprocs; |