Debian Codegraph @

nsprpub/pr/include/prsystem.h

raw
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 #ifndef prsystem_h___
7 #define prsystem_h___
8
9 /*
10 ** API to NSPR functions returning system info.
11 */
12 #include "prtypes.h"
13
14 PR_BEGIN_EXTERN_C
15
16 /*
17 ** Get the host' directory separator.
18 ** Pathnames are then assumed to be of the form:
19 ** [<sep><root_component><sep>]*(<component><sep>)<leaf_name>
20 */
21
22 NSPR_API(char) PR_GetDirectorySeparator(void);
23
24 /*
25 ** OBSOLETE -- the function name is misspelled.
26 ** Use PR_GetDirectorySeparator instead.
27 */
28
29 NSPR_API(char) PR_GetDirectorySepartor(void);
30
31 /*
32 ** Get the host' path separator.
33 ** Paths are assumed to be of the form:
34 ** <directory>[<sep><directory>]*
35 */
36
37 NSPR_API(char) PR_GetPathSeparator(void);
38
39 /* Types of information available via PR_GetSystemInfo(...) */
40 typedef enum {
41 PR_SI_HOSTNAME, /* the hostname with the domain name (if any)
42 * removed */
43 PR_SI_SYSNAME,
44 PR_SI_RELEASE,
45 PR_SI_ARCHITECTURE,
46 PR_SI_HOSTNAME_UNTRUNCATED, /* the hostname exactly as configured
47 * on the system */
48 PR_SI_RELEASE_BUILD
49 } PRSysInfo;
50
51
52 /*
53 ** If successful returns a null termintated string in 'buf' for
54 ** the information indicated in 'cmd'. If unseccussful the reason for
55 ** the failure can be retrieved from PR_GetError().
56 **
57 ** The buffer is allocated by the caller and should be at least
58 ** SYS_INFO_BUFFER_LENGTH bytes in length.
59 */
60
61 #define SYS_INFO_BUFFER_LENGTH 256
62
63 NSPR_API(PRStatus) PR_GetSystemInfo(PRSysInfo cmd, char *buf, PRUint32 buflen);
64
65 /*
66 ** Return the number of bytes in a page
67 */
68 NSPR_API(PRInt32) PR_GetPageSize(void);
69
70 /*
71 ** Return log2 of the size of a page
72 */
73 NSPR_API(PRInt32) PR_GetPageShift(void);
74
75 /*
76 ** PR_GetNumberOfProcessors() -- returns the number of CPUs
77 **
78 ** Description:
79 ** PR_GetNumberOfProcessors() extracts the number of processors
80 ** (CPUs available in an SMP system) and returns the number.
81 **
82 ** Parameters:
83 ** none
84 **
85 ** Returns:
86 ** The number of available processors or -1 on error
87 **
88 */
89 NSPR_API(PRInt32) PR_GetNumberOfProcessors( void );
90
91 /*
92 ** PR_GetPhysicalMemorySize() -- returns the amount of system RAM
93 **
94 ** Description:
95 ** PR_GetPhysicalMemorySize() determines the amount of physical RAM
96 ** in the system and returns the size in bytes.
97 **
98 ** Parameters:
99 ** none
100 **
101 ** Returns:
102 ** The amount of system RAM, or 0 on failure.
103 **
104 */
105 NSPR_API(PRUint64) PR_GetPhysicalMemorySize(void);
106
107 PR_END_EXTERN_C
108
109 #endif /* prsystem_h___ */