Line data Source code
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 5 : NSPR_API(char) PR_GetDirectorySeparator(void);
23 :
24 : /*
25 : ** OBSOLETE -- the function name is misspelled.
26 : ** Use PR_GetDirectorySeparator instead.
27 : */
28 :
29 0 : 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 0 : 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 : } PRSysInfo;
49 :
50 :
51 : /*
52 : ** If successful returns a null termintated string in 'buf' for
53 : ** the information indicated in 'cmd'. If unseccussful the reason for
54 : ** the failure can be retrieved from PR_GetError().
55 : **
56 : ** The buffer is allocated by the caller and should be at least
57 : ** SYS_INFO_BUFFER_LENGTH bytes in length.
58 : */
59 :
60 : #define SYS_INFO_BUFFER_LENGTH 256
61 :
62 6 : NSPR_API(PRStatus) PR_GetSystemInfo(PRSysInfo cmd, char *buf, PRUint32 buflen);
63 :
64 : /*
65 : ** Return the number of bytes in a page
66 : */
67 5 : NSPR_API(PRInt32) PR_GetPageSize(void);
68 :
69 : /*
70 : ** Return log2 of the size of a page
71 : */
72 1 : NSPR_API(PRInt32) PR_GetPageShift(void);
73 :
74 : /*
75 : ** PR_GetNumberOfProcessors() -- returns the number of CPUs
76 : **
77 : ** Description:
78 : ** PR_GetNumberOfProcessors() extracts the number of processors
79 : ** (CPUs available in an SMP system) and returns the number.
80 : **
81 : ** Parameters:
82 : ** none
83 : **
84 : ** Returns:
85 : ** The number of available processors or -1 on error
86 : **
87 : */
88 5 : NSPR_API(PRInt32) PR_GetNumberOfProcessors( void );
89 :
90 : /*
91 : ** PR_GetPhysicalMemorySize() -- returns the amount of system RAM
92 : **
93 : ** Description:
94 : ** PR_GetPhysicalMemorySize() determines the amount of physical RAM
95 : ** in the system and returns the size in bytes.
96 : **
97 : ** Parameters:
98 : ** none
99 : **
100 : ** Returns:
101 : ** The amount of system RAM, or 0 on failure.
102 : **
103 : */
104 11 : NSPR_API(PRUint64) PR_GetPhysicalMemorySize(void);
105 :
106 : PR_END_EXTERN_C
107 :
108 : #endif /* prsystem_h___ */
|