michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef prsystem_h___ michael@0: #define prsystem_h___ michael@0: michael@0: /* michael@0: ** API to NSPR functions returning system info. michael@0: */ michael@0: #include "prtypes.h" michael@0: michael@0: PR_BEGIN_EXTERN_C michael@0: michael@0: /* michael@0: ** Get the host' directory separator. michael@0: ** Pathnames are then assumed to be of the form: michael@0: ** []*() michael@0: */ michael@0: michael@0: NSPR_API(char) PR_GetDirectorySeparator(void); michael@0: michael@0: /* michael@0: ** OBSOLETE -- the function name is misspelled. michael@0: ** Use PR_GetDirectorySeparator instead. michael@0: */ michael@0: michael@0: NSPR_API(char) PR_GetDirectorySepartor(void); michael@0: michael@0: /* michael@0: ** Get the host' path separator. michael@0: ** Paths are assumed to be of the form: michael@0: ** []* michael@0: */ michael@0: michael@0: NSPR_API(char) PR_GetPathSeparator(void); michael@0: michael@0: /* Types of information available via PR_GetSystemInfo(...) */ michael@0: typedef enum { michael@0: PR_SI_HOSTNAME, /* the hostname with the domain name (if any) michael@0: * removed */ michael@0: PR_SI_SYSNAME, michael@0: PR_SI_RELEASE, michael@0: PR_SI_ARCHITECTURE, michael@0: PR_SI_HOSTNAME_UNTRUNCATED /* the hostname exactly as configured michael@0: * on the system */ michael@0: } PRSysInfo; michael@0: michael@0: michael@0: /* michael@0: ** If successful returns a null termintated string in 'buf' for michael@0: ** the information indicated in 'cmd'. If unseccussful the reason for michael@0: ** the failure can be retrieved from PR_GetError(). michael@0: ** michael@0: ** The buffer is allocated by the caller and should be at least michael@0: ** SYS_INFO_BUFFER_LENGTH bytes in length. michael@0: */ michael@0: michael@0: #define SYS_INFO_BUFFER_LENGTH 256 michael@0: michael@0: NSPR_API(PRStatus) PR_GetSystemInfo(PRSysInfo cmd, char *buf, PRUint32 buflen); michael@0: michael@0: /* michael@0: ** Return the number of bytes in a page michael@0: */ michael@0: NSPR_API(PRInt32) PR_GetPageSize(void); michael@0: michael@0: /* michael@0: ** Return log2 of the size of a page michael@0: */ michael@0: NSPR_API(PRInt32) PR_GetPageShift(void); michael@0: michael@0: /* michael@0: ** PR_GetNumberOfProcessors() -- returns the number of CPUs michael@0: ** michael@0: ** Description: michael@0: ** PR_GetNumberOfProcessors() extracts the number of processors michael@0: ** (CPUs available in an SMP system) and returns the number. michael@0: ** michael@0: ** Parameters: michael@0: ** none michael@0: ** michael@0: ** Returns: michael@0: ** The number of available processors or -1 on error michael@0: ** michael@0: */ michael@0: NSPR_API(PRInt32) PR_GetNumberOfProcessors( void ); michael@0: michael@0: /* michael@0: ** PR_GetPhysicalMemorySize() -- returns the amount of system RAM michael@0: ** michael@0: ** Description: michael@0: ** PR_GetPhysicalMemorySize() determines the amount of physical RAM michael@0: ** in the system and returns the size in bytes. michael@0: ** michael@0: ** Parameters: michael@0: ** none michael@0: ** michael@0: ** Returns: michael@0: ** The amount of system RAM, or 0 on failure. michael@0: ** michael@0: */ michael@0: NSPR_API(PRUint64) PR_GetPhysicalMemorySize(void); michael@0: michael@0: PR_END_EXTERN_C michael@0: michael@0: #endif /* prsystem_h___ */