summaryrefslogtreecommitdiffstats
path: root/upstream/opensuse-leap-15-6/man3/get_phys_pages.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/opensuse-leap-15-6/man3/get_phys_pages.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/opensuse-leap-15-6/man3/get_phys_pages.3')
-rw-r--r--upstream/opensuse-leap-15-6/man3/get_phys_pages.390
1 files changed, 90 insertions, 0 deletions
diff --git a/upstream/opensuse-leap-15-6/man3/get_phys_pages.3 b/upstream/opensuse-leap-15-6/man3/get_phys_pages.3
new file mode 100644
index 00000000..50c2bb13
--- /dev/null
+++ b/upstream/opensuse-leap-15-6/man3/get_phys_pages.3
@@ -0,0 +1,90 @@
+.\" Copyright (c) 2015 William Woodruff (william@tuffbizz.com)
+.\"
+.\" SPDX-License-Identifier: Linux-man-pages-copyleft
+.\"
+.TH get_phys_pages 3 2023-03-30 "Linux man-pages 6.04"
+.SH NAME
+get_phys_pages, get_avphys_pages \- get total and available physical
+page counts
+.SH LIBRARY
+Standard C library
+.RI ( libc ", " \-lc )
+.SH SYNOPSIS
+.nf
+.B "#include <sys/sysinfo.h>"
+.PP
+.B long get_phys_pages(void);
+.B long get_avphys_pages(void);
+.fi
+.SH DESCRIPTION
+The function
+.BR get_phys_pages ()
+returns the total number of physical pages of memory available on the system.
+.PP
+The function
+.BR get_avphys_pages ()
+returns the number of currently available physical pages of memory on the
+system.
+.SH RETURN VALUE
+On success,
+these functions return a nonnegative value as given in DESCRIPTION.
+On failure, they return \-1 and set
+.I errno
+to indicate the error.
+.SH ERRORS
+.TP
+.B ENOSYS
+The system could not provide the required information
+(possibly because the
+.I /proc
+filesystem was not mounted).
+.SH STANDARDS
+GNU.
+.SH HISTORY
+Before glibc 2.23,
+these functions obtained the required information by scanning the
+.I MemTotal
+and
+.I MemFree
+fields of
+.IR /proc/meminfo .
+Since glibc 2.23,
+these functions obtain the required information by calling
+.BR sysinfo (2).
+.SH NOTES
+The following
+.BR sysconf (3)
+calls provide a portable means of obtaining the same information as the
+functions described on this page.
+.PP
+.in +4n
+.EX
+total_pages = sysconf(_SC_PHYS_PAGES); /* total pages */
+avl_pages = sysconf(_SC_AVPHYS_PAGES); /* available pages */
+.EE
+.in
+.SH EXAMPLES
+The following example shows how
+.BR get_phys_pages ()
+and
+.BR get_avphys_pages ()
+can be used.
+.PP
+.\" SRC BEGIN (get_phys_pages.c)
+.EX
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/sysinfo.h>
+
+int
+main(void)
+{
+ printf("This system has %ld pages of physical memory and "
+ "%ld pages of physical memory available.\en",
+ get_phys_pages(), get_avphys_pages());
+ exit(EXIT_SUCCESS);
+}
+.EE
+.\" SRC END
+.SH SEE ALSO
+.BR sysconf (3)