nsprpub/pr/include/prsystem.h

Wed, 31 Dec 2014 06:55:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:50 +0100
changeset 2
7e26c7da4463
permissions
-rw-r--r--

Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2

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

mercurial