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