xref: /aosp_15_r20/bionic/libc/include/sys/sysinfo.h (revision 8d67ca893c1523eb926b9080dbe4e2ffd2a27ba1)
1 /*
2  * Copyright (C) 2008 The Android Open Source Project
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *  * Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  *  * Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in
12  *    the documentation and/or other materials provided with the
13  *    distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
18  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
22  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26  * SUCH DAMAGE.
27  */
28 
29 #pragma once
30 
31 /**
32  * @file sys/sysinfo.h
33  * @brief System information.
34  */
35 
36 #include <sys/cdefs.h>
37 #include <linux/kernel.h>
38 
39 __BEGIN_DECLS
40 
41 /**
42  * [sysinfo(2)](https://man7.org/linux/man-pages/man2/sysinfo.2.html) queries system information.
43  *
44  * Returns 0 on success, and returns -1 and sets `errno` on failure.
45  */
46 int sysinfo(struct sysinfo* _Nonnull __info);
47 
48 /**
49  * [get_nprocs_conf(3)](https://man7.org/linux/man-pages/man3/get_nprocs_conf.3.html) returns
50  * the total number of processors in the system.
51  *
52  * Available since API level 23.
53  *
54  * See also sysconf().
55  */
56 
57 #if __BIONIC_AVAILABILITY_GUARD(23)
58 int get_nprocs_conf(void) __INTRODUCED_IN(23);
59 
60 /**
61  * [get_nprocs(3)](https://man7.org/linux/man-pages/man3/get_nprocs.3.html) returns
62  * the number of processors in the system that are currently on-line.
63  *
64  * Available since API level 23.
65  *
66  * See also sysconf().
67  */
68 int get_nprocs(void) __INTRODUCED_IN(23);
69 
70 /**
71  * [get_phys_pages(3)](https://man7.org/linux/man-pages/man3/get_phys_pages.3.html) returns
72  * the total number of physical pages in the system.
73  *
74  * Available since API level 23.
75  *
76  * See also sysconf().
77  */
78 long get_phys_pages(void) __INTRODUCED_IN(23);
79 
80 /**
81  * [get_avphys_pages(3)](https://man7.org/linux/man-pages/man3/get_avphys_pages.3.html) returns
82  * the number of physical pages in the system that are currently available.
83  *
84  * Available since API level 23.
85  *
86  * See also sysconf().
87  */
88 long get_avphys_pages(void) __INTRODUCED_IN(23);
89 #endif /* __BIONIC_AVAILABILITY_GUARD(23) */
90 
91 
92 __END_DECLS
93