Back to index

lightning-sunbird  0.9+nobinonly
prsystem.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is the Netscape Portable Runtime (NSPR).
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998-2000
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *
00024  * Alternatively, the contents of this file may be used under the terms of
00025  * either the GNU General Public License Version 2 or later (the "GPL"), or
00026  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00027  * in which case the provisions of the GPL or the LGPL are applicable instead
00028  * of those above. If you wish to allow use of your version of this file only
00029  * under the terms of either the GPL or the LGPL, and not to allow others to
00030  * use your version of this file under the terms of the MPL, indicate your
00031  * decision by deleting the provisions above and replace them with the notice
00032  * and other provisions required by the GPL or the LGPL. If you do not delete
00033  * the provisions above, a recipient may use your version of this file under
00034  * the terms of any one of the MPL, the GPL or the LGPL.
00035  *
00036  * ***** END LICENSE BLOCK ***** */
00037 
00038 #ifndef prsystem_h___
00039 #define prsystem_h___
00040 
00041 /*
00042 ** API to NSPR functions returning system info.
00043 */
00044 #include "prtypes.h"
00045 
00046 PR_BEGIN_EXTERN_C
00047 
00048 /*
00049 ** Get the host' directory separator.
00050 **  Pathnames are then assumed to be of the form:
00051 **      [<sep><root_component><sep>]*(<component><sep>)<leaf_name>
00052 */
00053 
00054 NSPR_API(char) PR_GetDirectorySeparator(void);
00055 
00056 /*
00057 ** OBSOLETE -- the function name is misspelled.
00058 ** Use PR_GetDirectorySeparator instead.
00059 */
00060 
00061 NSPR_API(char) PR_GetDirectorySepartor(void);
00062 
00063 /*
00064 ** Get the host' path separator.
00065 **  Paths are assumed to be of the form:
00066 **      <directory>[<sep><directory>]*
00067 */
00068 
00069 NSPR_API(char) PR_GetPathSeparator(void);
00070 
00071 /* Types of information available via PR_GetSystemInfo(...) */
00072 typedef enum {
00073     PR_SI_HOSTNAME,  /* the hostname with the domain name (if any)
00074                       * removed */
00075     PR_SI_SYSNAME,
00076     PR_SI_RELEASE,
00077     PR_SI_ARCHITECTURE,
00078     PR_SI_HOSTNAME_UNTRUNCATED  /* the hostname exactly as configured
00079                                  * on the system */
00080 } PRSysInfo;
00081 
00082 
00083 /*
00084 ** If successful returns a null termintated string in 'buf' for
00085 ** the information indicated in 'cmd'. If unseccussful the reason for
00086 ** the failure can be retrieved from PR_GetError().
00087 **
00088 ** The buffer is allocated by the caller and should be at least
00089 ** SYS_INFO_BUFFER_LENGTH bytes in length.
00090 */
00091 
00092 #define SYS_INFO_BUFFER_LENGTH 256
00093 
00094 NSPR_API(PRStatus) PR_GetSystemInfo(PRSysInfo cmd, char *buf, PRUint32 buflen);
00095 
00096 /*
00097 ** Return the number of bytes in a page
00098 */
00099 NSPR_API(PRInt32) PR_GetPageSize(void);
00100 
00101 /*
00102 ** Return log2 of the size of a page
00103 */
00104 NSPR_API(PRInt32) PR_GetPageShift(void);
00105 
00106 /*
00107 ** PR_GetNumberOfProcessors() -- returns the number of CPUs
00108 **
00109 ** Description:
00110 ** PR_GetNumberOfProcessors() extracts the number of processors
00111 ** (CPUs available in an SMP system) and returns the number.
00112 ** 
00113 ** Parameters:
00114 **   none
00115 **
00116 ** Returns:
00117 **   The number of available processors or -1 on error
00118 ** 
00119 */
00120 NSPR_API(PRInt32) PR_GetNumberOfProcessors( void );
00121 
00122 /*
00123 ** PR_GetPhysicalMemorySize() -- returns the amount of system RAM
00124 **
00125 ** Description:
00126 ** PR_GetPhysicalMemorySize() determines the amount of physical RAM
00127 ** in the system and returns the size in bytes.
00128 **
00129 ** Parameters:
00130 **   none
00131 **
00132 ** Returns:
00133 **   The amount of system RAM, or 0 on failure.
00134 **
00135 */
00136 NSPR_API(PRUint64) PR_GetPhysicalMemorySize(void);
00137 
00138 PR_END_EXTERN_C
00139 
00140 #endif /* prsystem_h___ */