1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/nsprpub/pr/include/prsystem.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,108 @@ 1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef prsystem_h___ 1.10 +#define prsystem_h___ 1.11 + 1.12 +/* 1.13 +** API to NSPR functions returning system info. 1.14 +*/ 1.15 +#include "prtypes.h" 1.16 + 1.17 +PR_BEGIN_EXTERN_C 1.18 + 1.19 +/* 1.20 +** Get the host' directory separator. 1.21 +** Pathnames are then assumed to be of the form: 1.22 +** [<sep><root_component><sep>]*(<component><sep>)<leaf_name> 1.23 +*/ 1.24 + 1.25 +NSPR_API(char) PR_GetDirectorySeparator(void); 1.26 + 1.27 +/* 1.28 +** OBSOLETE -- the function name is misspelled. 1.29 +** Use PR_GetDirectorySeparator instead. 1.30 +*/ 1.31 + 1.32 +NSPR_API(char) PR_GetDirectorySepartor(void); 1.33 + 1.34 +/* 1.35 +** Get the host' path separator. 1.36 +** Paths are assumed to be of the form: 1.37 +** <directory>[<sep><directory>]* 1.38 +*/ 1.39 + 1.40 +NSPR_API(char) PR_GetPathSeparator(void); 1.41 + 1.42 +/* Types of information available via PR_GetSystemInfo(...) */ 1.43 +typedef enum { 1.44 + PR_SI_HOSTNAME, /* the hostname with the domain name (if any) 1.45 + * removed */ 1.46 + PR_SI_SYSNAME, 1.47 + PR_SI_RELEASE, 1.48 + PR_SI_ARCHITECTURE, 1.49 + PR_SI_HOSTNAME_UNTRUNCATED /* the hostname exactly as configured 1.50 + * on the system */ 1.51 +} PRSysInfo; 1.52 + 1.53 + 1.54 +/* 1.55 +** If successful returns a null termintated string in 'buf' for 1.56 +** the information indicated in 'cmd'. If unseccussful the reason for 1.57 +** the failure can be retrieved from PR_GetError(). 1.58 +** 1.59 +** The buffer is allocated by the caller and should be at least 1.60 +** SYS_INFO_BUFFER_LENGTH bytes in length. 1.61 +*/ 1.62 + 1.63 +#define SYS_INFO_BUFFER_LENGTH 256 1.64 + 1.65 +NSPR_API(PRStatus) PR_GetSystemInfo(PRSysInfo cmd, char *buf, PRUint32 buflen); 1.66 + 1.67 +/* 1.68 +** Return the number of bytes in a page 1.69 +*/ 1.70 +NSPR_API(PRInt32) PR_GetPageSize(void); 1.71 + 1.72 +/* 1.73 +** Return log2 of the size of a page 1.74 +*/ 1.75 +NSPR_API(PRInt32) PR_GetPageShift(void); 1.76 + 1.77 +/* 1.78 +** PR_GetNumberOfProcessors() -- returns the number of CPUs 1.79 +** 1.80 +** Description: 1.81 +** PR_GetNumberOfProcessors() extracts the number of processors 1.82 +** (CPUs available in an SMP system) and returns the number. 1.83 +** 1.84 +** Parameters: 1.85 +** none 1.86 +** 1.87 +** Returns: 1.88 +** The number of available processors or -1 on error 1.89 +** 1.90 +*/ 1.91 +NSPR_API(PRInt32) PR_GetNumberOfProcessors( void ); 1.92 + 1.93 +/* 1.94 +** PR_GetPhysicalMemorySize() -- returns the amount of system RAM 1.95 +** 1.96 +** Description: 1.97 +** PR_GetPhysicalMemorySize() determines the amount of physical RAM 1.98 +** in the system and returns the size in bytes. 1.99 +** 1.100 +** Parameters: 1.101 +** none 1.102 +** 1.103 +** Returns: 1.104 +** The amount of system RAM, or 0 on failure. 1.105 +** 1.106 +*/ 1.107 +NSPR_API(PRUint64) PR_GetPhysicalMemorySize(void); 1.108 + 1.109 +PR_END_EXTERN_C 1.110 + 1.111 +#endif /* prsystem_h___ */