summaryrefslogtreecommitdiffstats
path: root/upstream/mageia-cauldron/man3/get_nprocs.3
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 19:43:11 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 19:43:11 +0000
commitfc22b3d6507c6745911b9dfcc68f1e665ae13dbc (patch)
treece1e3bce06471410239a6f41282e328770aa404a /upstream/mageia-cauldron/man3/get_nprocs.3
parentInitial commit. (diff)
downloadmanpages-l10n-fc22b3d6507c6745911b9dfcc68f1e665ae13dbc.tar.xz
manpages-l10n-fc22b3d6507c6745911b9dfcc68f1e665ae13dbc.zip
Adding upstream version 4.22.0.upstream/4.22.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'upstream/mageia-cauldron/man3/get_nprocs.3')
-rw-r--r--upstream/mageia-cauldron/man3/get_nprocs.393
1 files changed, 93 insertions, 0 deletions
diff --git a/upstream/mageia-cauldron/man3/get_nprocs.3 b/upstream/mageia-cauldron/man3/get_nprocs.3
new file mode 100644
index 00000000..3cc99d7f
--- /dev/null
+++ b/upstream/mageia-cauldron/man3/get_nprocs.3
@@ -0,0 +1,93 @@
+'\" t
+.\" Copyright (c) 2012, Petr Benas
+.\" and Copyright (c) 2012, Michael Kerrisk <mtk.man-pages@gmail.com>
+.\"
+.\" SPDX-License-Identifier: Linux-man-pages-copyleft
+.\"
+.TH get_nprocs 3 2023-10-31 "Linux man-pages 6.06"
+.SH NAME
+get_nprocs, get_nprocs_conf \- get number of processors
+.SH LIBRARY
+Standard C library
+.RI ( libc ", " \-lc )
+.SH SYNOPSIS
+.nf
+.B #include <sys/sysinfo.h>
+.P
+.B int get_nprocs(void);
+.B int get_nprocs_conf(void);
+.fi
+.SH DESCRIPTION
+The function
+.BR get_nprocs_conf ()
+returns the number of processors configured by the operating system.
+.P
+The function
+.BR get_nprocs ()
+returns the number of processors currently available in the system.
+This may be less than the number returned by
+.BR get_nprocs_conf ()
+because processors may be offline (e.g., on hotpluggable systems).
+.SH RETURN VALUE
+As given in DESCRIPTION.
+.SH ATTRIBUTES
+For an explanation of the terms used in this section, see
+.BR attributes (7).
+.TS
+allbox;
+lbx lb lb
+l l l.
+Interface Attribute Value
+T{
+.na
+.nh
+.BR get_nprocs (),
+.BR get_nprocs_conf ()
+T} Thread safety MT-Safe
+.TE
+.SH STANDARDS
+GNU.
+.SH NOTES
+The current
+.\" glibc 2.15
+implementation of these functions is rather expensive,
+since they open and parse files in the
+.I /sys
+filesystem each time they are called.
+.P
+The following
+.BR sysconf (3)
+calls make use of the functions documented on this page
+to return the same information.
+.P
+.in +4n
+.EX
+np = sysconf(_SC_NPROCESSORS_CONF); /* processors configured */
+np = sysconf(_SC_NPROCESSORS_ONLN); /* processors available */
+.EE
+.in
+.SH EXAMPLES
+The following example shows how
+.BR get_nprocs ()
+and
+.BR get_nprocs_conf ()
+can be used.
+.P
+.\" SRC BEGIN (get_nprocs_conf.c)
+.EX
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/sysinfo.h>
+\&
+int
+main(void)
+{
+ printf("This system has %d processors configured and "
+ "%d processors available.\en",
+ get_nprocs_conf(), get_nprocs());
+ exit(EXIT_SUCCESS);
+}
+.EE
+.\" SRC END
+.SH SEE ALSO
+.BR nproc (1)