UnixOS.st
changeset 4084 797fd09b7808
parent 4020 e73a3c919ac0
child 4088 622551d3c0d7
equal deleted inserted replaced
4083:0f0b6c99acf7 4084:797fd09b7808
  6060        OS, for example, linux returns 'ix86', while WIN32 returns 'x86'.
  6060        OS, for example, linux returns 'ix86', while WIN32 returns 'x86'.
  6061 
  6061 
  6062        This method is mainly provided to augment error reports with some system
  6062        This method is mainly provided to augment error reports with some system
  6063        information. 
  6063        information. 
  6064        (in case of system/version specific OS errors, conditional workarounds and patches
  6064        (in case of system/version specific OS errors, conditional workarounds and patches
  6065 	may be based upon this info).
  6065         may be based upon this info).
  6066        Also, applications could enable/disable buffering or otherwise reduce
  6066        Also, applications could enable/disable buffering or otherwise reduce
  6067        their memory usage depending upon the amount of memory installed.
  6067        their memory usage depending upon the amount of memory installed.
  6068        Your application should NOT depend upon this in any way.
  6068        Your application may make use of available information for tuning,
       
  6069        but should NEVER DEPEND upon this in any way.
  6069 
  6070 
  6070      The returned info may (or may not) contain:
  6071      The returned info may (or may not) contain:
  6071 	#system -> some operating system identification (irix, Linux, nt, win32s ...) 
  6072         #system -> some operating system identification (irix, Linux, nt, win32s ...) 
  6072 	#version -> OS version (some os version identification)
  6073         #version -> OS version (some os version identification)
  6073 	#release -> OS release (3.5, 1.2.1 ...)
  6074         #release -> OS release (3.5, 1.2.1 ...)
  6074 	#node   -> some host identification (hostname)
  6075         #node   -> some host identification (hostname)
  6075 	#domain  -> domain name (hosts domain)
  6076         #domain  -> domain name (hosts domain)
  6076 	#machine -> type of CPU (i586, mips ...)
  6077         #machine -> type of CPU (i586, mips ...)
  6077      
  6078      
  6078      those are currently returned on some machines (no warranty)
  6079      those are currently returned on some machines (no warranty)
  6079      linux:
  6080      linux:
  6080 	#totalRam         -> total amount of memory available
  6081         #totalRam         -> total amount of memory available
  6081 	#sharedRam        -> amount of memory which is shared among processes
  6082         #sharedRam        -> amount of memory which is shared among processes
  6082 		             (i.e. shared code)
  6083                              (i.e. shared code)
  6083 	#bufferRam        -> amount used for buffers
  6084         #bufferRam        -> amount used for buffers
  6084 	#swapSize         -> total size of swap space
  6085         #swapSize         -> total size of swap space
  6085 	#freeSwap         -> free amount in swapSpace
  6086         #freeSwap         -> free amount in swapSpace
  6086 
  6087 
  6087      osf:
  6088      osf:
  6088 	#physicalRam      -> total amount of physical memory
  6089         #physicalRam      -> total amount of physical memory
  6089 	#cpuType          -> type of cpu (more detailed than machine)
  6090         #cpuType          -> type of cpu (more detailed than machine)
  6090 	#numberOfCPUs     -> number of cpus in box
  6091         #numberOfCPUs     -> number of cpus in box
  6091         
  6092         
  6092      solaris:
  6093      solaris:
  6093 	#physicalRam      -> total amount of physical memory
  6094         #physicalRam      -> total amount of physical memory
  6094 	#numberOfCPUs     -> number of cpus in box
  6095         #availableRam     -> total available amount of physical memory (i.e. unused ram)
  6095 	#dCacheSize       -> bytes in data cache
  6096         #freeRam          -> amount of free memory
  6096 	#iCacheSize       -> bytes in data cache
  6097         #numberOfCPUs     -> number of cpus in box (online CPUS)
       
  6098         [#dCacheSize]     -> bytes in data cache (only available on some solaris versions)
       
  6099         [#iCacheSize]     -> bytes in data cache (only available on some solaris versions)
       
  6100         [#instructionSets]-> instruction sets available (only available on some solaris versions)
       
  6101         [#platform]       -> platform name (only available on some solaris versions)
  6097 
  6102 
  6098      hpux:
  6103      hpux:
  6099 	#physicalRam      -> total amount of physical memory in box
  6104         #physicalRam      -> total amount of physical memory in box
  6100 	#activeRealMemory -> ? - read pstat documentation
  6105         #activeRealMemory -> ? - read pstat documentation
  6101 	#activeVirtualRam -> ? - read pstat documentation
  6106         #activeVirtualRam -> ? - read pstat documentation
  6102 	#freeMemory       -> ? - read pstat documentation
  6107         #freeMemory       -> ? - read pstat documentation
  6103 	#realMemory       -> ? (amount of memory left to user programs)
  6108         #realMemory       -> ? (amount of memory left to user programs)
  6104 	#virtualRam       -> ? - read pstat documentation
  6109         #virtualRam       -> ? - read pstat documentation
  6105     "
  6110     "
  6106 
  6111 
  6107     |sys node rel ver mach dom mtyp brel info arch cpuType
  6112     |sys node rel ver mach dom mtyp brel info arch cpuType
  6108      physicalRam totalRam sharedRam bufferRam swapSize freeSwap
  6113      physicalRam availableRam totalRam sharedRam bufferRam swapSize freeSwap
  6109      numberOfCPUs pageSize physicalPages dCacheSize iCacheSize
  6114      numberOfCPUs pageSize physicalPages availablePages dCacheSize iCacheSize
  6110      virtualRam activeVirtualRam realMemory activeRealMemory freeMemory|
  6115      virtualRam activeVirtualRam realMemory activeRealMemory freeMemory
       
  6116      instructionSets platform|
  6111 
  6117 
  6112 %{  /* STACK: 4096 */
  6118 %{  /* STACK: 4096 */
  6113 
  6119 
  6114 #ifdef LINUX
  6120 #ifdef LINUX
  6115 # ifdef ELF /* old a.out unixes do not have this ... */
  6121 # ifdef ELF /* old a.out unixes do not have this ... */
  6117      * additional info available ...
  6123      * additional info available ...
  6118      */
  6124      */
  6119     struct sysinfo infoBuffer;
  6125     struct sysinfo infoBuffer;
  6120 
  6126 
  6121     if (sysinfo(&infoBuffer) >= 0) {
  6127     if (sysinfo(&infoBuffer) >= 0) {
  6122 	totalRam   = __MKUINT(infoBuffer.totalram);
  6128         totalRam   = __MKUINT(infoBuffer.totalram);
  6123 	sharedRam = __MKUINT(infoBuffer.sharedram);
  6129         sharedRam = __MKUINT(infoBuffer.sharedram);
  6124 	bufferRam = __MKUINT(infoBuffer.bufferram);
  6130         bufferRam = __MKUINT(infoBuffer.bufferram);
  6125 	swapSize  = __MKUINT(infoBuffer.totalswap);
  6131         swapSize  = __MKUINT(infoBuffer.totalswap);
  6126 	freeSwap  = __MKUINT(infoBuffer.freeswap);
  6132         freeSwap  = __MKUINT(infoBuffer.freeswap);
  6127     }
  6133     }
  6128 # endif
  6134 # endif
  6129 #endif /* LINUX */
  6135 #endif /* LINUX */
  6130 
  6136 
  6131 #ifdef hpux
  6137 #ifdef hpux
  6144     freeMemory         = __MKUINT(dynam_buf.psd_free/256*1024*1024);
  6150     freeMemory         = __MKUINT(dynam_buf.psd_free/256*1024*1024);
  6145 #endif
  6151 #endif
  6146 
  6152 
  6147 #if defined(HAS_UNAME)
  6153 #if defined(HAS_UNAME)
  6148     {
  6154     {
  6149 	struct utsname ubuff;
  6155         struct utsname ubuff;
  6150 
  6156 
  6151 	if (uname(&ubuff) >= 0) {
  6157         if (uname(&ubuff) >= 0) {
  6152 	    sys  = __MKSTRING(ubuff.sysname);
  6158             sys  = __MKSTRING(ubuff.sysname);
  6153 	    node = __MKSTRING(ubuff.nodename);
  6159             node = __MKSTRING(ubuff.nodename);
  6154 	    rel  = __MKSTRING(ubuff.release);
  6160             rel  = __MKSTRING(ubuff.release);
  6155 	    ver  = __MKSTRING(ubuff.version);
  6161             ver  = __MKSTRING(ubuff.version);
  6156 	    mach = __MKSTRING(ubuff.machine);
  6162             mach = __MKSTRING(ubuff.machine);
  6157 # ifdef HAS_UTS_DOMAINNAME
  6163 # ifdef HAS_UTS_DOMAINNAME
  6158 	    dom  = __MKSTRING(ubuff.domainname);
  6164             dom  = __MKSTRING(ubuff.domainname);
  6159 # endif /* no HAS_UTS_DOMAINNAME */
  6165 # endif /* no HAS_UTS_DOMAINNAME */
  6160 	}
  6166         }
  6161     }
  6167     }
  6162 
  6168 
  6163 #else /* no UNAME */
  6169 #else /* no UNAME */
  6164 
  6170 
  6165     /*
  6171     /*
  6167      */
  6173      */
  6168 #endif /* no UNAME */
  6174 #endif /* no UNAME */
  6169 
  6175 
  6170 #if defined(HAS_SYSINFO) && defined(SI_ARCHITECTURE)
  6176 #if defined(HAS_SYSINFO) && defined(SI_ARCHITECTURE)
  6171     if (arch == nil) {
  6177     if (arch == nil) {
  6172 	char buffer[128];
  6178         char buffer[128];
  6173 
  6179 
  6174 	if (sysinfo(SI_ARCHITECTURE, buffer, sizeof(buffer))) {
  6180         if (sysinfo(SI_ARCHITECTURE, buffer, sizeof(buffer))) {
  6175 	    arch = __MKSTRING(buffer);
  6181             arch = __MKSTRING(buffer);
  6176 	}
  6182         }
       
  6183     }
       
  6184 #endif /* HAS_SYSINFO & SI_ARCHITECTURE */
       
  6185 
       
  6186 #if defined(HAS_SYSINFO) && defined(SI_ISALIST)
       
  6187     {
       
  6188         char buffer[128];
       
  6189 
       
  6190         if (sysinfo(SI_ISALIST, buffer, sizeof(buffer))) {
       
  6191             instructionSets = __MKSTRING(buffer);
       
  6192         }
       
  6193     }
       
  6194 #endif /* HAS_SYSINFO & SI_ARCHITECTURE */
       
  6195 
       
  6196 #if defined(HAS_SYSINFO) && defined(SI_PLATFORM)
       
  6197     {
       
  6198         char buffer[128];
       
  6199 
       
  6200         if (sysinfo(SI_PLATFORM, buffer, sizeof(buffer))) {
       
  6201             platform = __MKSTRING(buffer);
       
  6202         }
  6177     }
  6203     }
  6178 #endif /* HAS_SYSINFO & SI_ARCHITECTURE */
  6204 #endif /* HAS_SYSINFO & SI_ARCHITECTURE */
  6179 
  6205 
  6180 #if defined(HAS_GETDOMAINNAME)
  6206 #if defined(HAS_GETDOMAINNAME)
  6181     if (dom == nil) {
  6207     if (dom == nil) {
  6182 	char buffer[128];
  6208         char buffer[128];
  6183 
  6209 
  6184 	if (getdomainname(buffer, sizeof(buffer)) == 0) {
  6210         if (getdomainname(buffer, sizeof(buffer)) == 0) {
  6185 	    dom = __MKSTRING(buffer);
  6211             dom = __MKSTRING(buffer);
  6186 	}
  6212         }
  6187     }
  6213     }
  6188 #endif /* HAS_GETDOMAINNAME */
  6214 #endif /* HAS_GETDOMAINNAME */
  6189 
  6215 
  6190 #if defined(HAS_SYSCONF)
  6216 #if defined(HAS_SYSCONF)
  6191 
  6217 
  6192 # ifdef _SC_NPROCESSORS_ONLN
  6218 # ifdef _SC_NPROCESSORS_ONLN
  6193     {
  6219     {
  6194 	long val;
  6220         long val;
  6195  
  6221  
  6196 	val = sysconf(_SC_NPROCESSORS_ONLN);
  6222         val = sysconf(_SC_NPROCESSORS_ONLN);
  6197 	if (val > 0) {
  6223         if (val > 0) {
  6198 	    numberOfCPUs = __MKINT(val);
  6224             numberOfCPUs = __MKINT(val);
  6199 	}
  6225         }
  6200     }
  6226     }
  6201 # endif
  6227 # endif
  6202 # if defined(_SC_PHYS_PAGES) && defined(_SC_PAGESIZE)
  6228 # if defined(_SC_PAGESIZE)
  6203     {
  6229     {
  6204 	long val;
  6230         long val;
  6205 
  6231 
  6206 	val = sysconf(_SC_PHYS_PAGES);
  6232         val = sysconf(_SC_PAGESIZE);
  6207 	if (val != -1) {
  6233         if (val != -1) {
  6208 	    physicalPages = __MKUINT(val);
  6234             pageSize = __MKUINT(val);
  6209 	    val = sysconf(_SC_PAGESIZE);
  6235         }
  6210 	    if (val != -1) {
  6236     }
  6211 		pageSize = __MKUINT(val);
  6237 # endif
  6212 	    }
  6238 # if defined(_SC_PHYS_PAGES)
  6213 	}
  6239     {
       
  6240         long val;
       
  6241 
       
  6242         val = sysconf(_SC_PHYS_PAGES);
       
  6243         if (val != -1) {
       
  6244             physicalPages = __MKUINT(val);
       
  6245         }
       
  6246     }
       
  6247 # endif
       
  6248 # if defined(_SC_AVPHYS_PAGES)
       
  6249     {
       
  6250         long val;
       
  6251 
       
  6252         val = sysconf(_SC_AVPHYS_PAGES);
       
  6253         if (val != -1) {
       
  6254             availablePages = __MKUINT(val);
       
  6255         }
  6214     }
  6256     }
  6215 # endif
  6257 # endif
  6216 # if defined(_SC_ICACHE_SZ)
  6258 # if defined(_SC_ICACHE_SZ)
  6217     {
  6259     {
  6218 	long val;
  6260         long val;
  6219 
  6261 
  6220 	val = sysconf(_SC_ICACHE_SZ);
  6262         val = sysconf(_SC_ICACHE_SZ);
  6221 	if (val != -1) {
  6263         if (val != -1) {
  6222 	    iCacheSize = __MKUINT(val);
  6264             iCacheSize = __MKUINT(val);
  6223 	}
  6265         }
  6224     }
  6266     }
  6225 # endif
  6267 # endif
  6226 # if defined(_SC_DCACHE_SZ)
  6268 # if defined(_SC_DCACHE_SZ)
  6227     {
  6269     {
  6228 	long val;
  6270         long val;
  6229  
  6271  
  6230 	val = sysconf(_SC_DCACHE_SZ);
  6272         val = sysconf(_SC_DCACHE_SZ);
  6231 	if (val != -1) {
  6273         if (val != -1) {
  6232 	    dCacheSize = __MKUINT(val);
  6274             dCacheSize = __MKUINT(val);
  6233 	}
  6275         }
  6234     }
  6276     }
  6235 # endif
  6277 # endif
  6236 
  6278 
  6237 
  6279 
  6238 #endif /* HAS_SYSCONF */
  6280 #endif /* HAS_SYSCONF */
  6239 
  6281 
  6240 #if defined(HAS_GETSYSTEMINFO)
  6282 #if defined(HAS_GETSYSTEMINFO)
  6241     {
  6283     {
  6242 	INT index;
  6284         INT index;
  6243 	int retInt32 = 0;
  6285         int retInt32 = 0;
  6244 
  6286 
  6245 # if defined(GSI_CPU)
  6287 # if defined(GSI_CPU)
  6246 	index = 0;
  6288         index = 0;
  6247 	if (getsysinfo(GSI_CPU, &retInt32, sizeof(retInt32), &index, NULL) > 0) {
  6289         if (getsysinfo(GSI_CPU, &retInt32, sizeof(retInt32), &index, NULL) > 0) {
  6248 	    switch (retInt32) {
  6290             switch (retInt32) {
  6249 #  ifdef VAX_780
  6291 #  ifdef VAX_780
  6250 		case VAX_780:
  6292                 case VAX_780:
  6251 		    cpuType = __MKSTRING("VAX_780");
  6293                     cpuType = __MKSTRING("VAX_780");
  6252 		    break;
  6294                     break;
  6253 #  endif
  6295 #  endif
  6254 #  ifdef VAX_750
  6296 #  ifdef VAX_750
  6255 		case VAX_750:
  6297                 case VAX_750:
  6256 		    cpuType = __MKSTRING("VAX_750");
  6298                     cpuType = __MKSTRING("VAX_750");
  6257 		    break;
  6299                     break;
  6258 #  endif
  6300 #  endif
  6259 #  ifdef VAX_730
  6301 #  ifdef VAX_730
  6260 		case VAX_730:
  6302                 case VAX_730:
  6261 		    cpuType = __MKSTRING("VAX_730");
  6303                     cpuType = __MKSTRING("VAX_730");
  6262 		    break;
  6304                     break;
  6263 #  endif
  6305 #  endif
  6264 #  ifdef VAX_8600
  6306 #  ifdef VAX_8600
  6265 		case VAX_8600:
  6307                 case VAX_8600:
  6266 		    cpuType = __MKSTRING("VAX_8600");
  6308                     cpuType = __MKSTRING("VAX_8600");
  6267 		    break;
  6309                     break;
  6268 #  endif
  6310 #  endif
  6269 #  ifdef VAX_8200
  6311 #  ifdef VAX_8200
  6270 		case VAX_8200:
  6312                 case VAX_8200:
  6271 		    cpuType = __MKSTRING("VAX_8200");
  6313                     cpuType = __MKSTRING("VAX_8200");
  6272 		    break;
  6314                     break;
  6273 #  endif
  6315 #  endif
  6274 #  ifdef VAX_8800
  6316 #  ifdef VAX_8800
  6275 		case VAX_8800:
  6317                 case VAX_8800:
  6276 		    cpuType = __MKSTRING("VAX_8800");
  6318                     cpuType = __MKSTRING("VAX_8800");
  6277 		    break;
  6319                     break;
  6278 #  endif
  6320 #  endif
  6279 #  ifdef MVAX_I
  6321 #  ifdef MVAX_I
  6280 		case MVAX_I:
  6322                 case MVAX_I:
  6281 		    cpuType = __MKSTRING("MVAX_I");
  6323                     cpuType = __MKSTRING("MVAX_I");
  6282 		    break;
  6324                     break;
  6283 #  endif
  6325 #  endif
  6284 #  ifdef MVAX_II
  6326 #  ifdef MVAX_II
  6285 		case MVAX_II:
  6327                 case MVAX_II:
  6286 		    cpuType = __MKSTRING("MVAX_II");
  6328                     cpuType = __MKSTRING("MVAX_II");
  6287 		    break;
  6329                     break;
  6288 #  endif
  6330 #  endif
  6289 #  ifdef V_VAX
  6331 #  ifdef V_VAX
  6290 		case V_VAX:
  6332                 case V_VAX:
  6291 		    cpuType = __MKSTRING("V_VAX");
  6333                     cpuType = __MKSTRING("V_VAX");
  6292 		    break;
  6334                     break;
  6293 #  endif
  6335 #  endif
  6294 #  ifdef VAX_3600
  6336 #  ifdef VAX_3600
  6295 		case VAX_3600:
  6337                 case VAX_3600:
  6296 		    cpuType = __MKSTRING("VAX_3600");
  6338                     cpuType = __MKSTRING("VAX_3600");
  6297 		    break;
  6339                     break;
  6298 #  endif
  6340 #  endif
  6299 #  ifdef VAX_6200
  6341 #  ifdef VAX_6200
  6300 		case VAX_6200:
  6342                 case VAX_6200:
  6301 		    cpuType = __MKSTRING("VAX_6200");
  6343                     cpuType = __MKSTRING("VAX_6200");
  6302 		    break;
  6344                     break;
  6303 #  endif
  6345 #  endif
  6304 #  ifdef VAX_3400
  6346 #  ifdef VAX_3400
  6305 		case VAX_3400:
  6347                 case VAX_3400:
  6306 		    cpuType = __MKSTRING("VAX_3400");
  6348                     cpuType = __MKSTRING("VAX_3400");
  6307 		    break;
  6349                     break;
  6308 #  endif
  6350 #  endif
  6309 #  ifdef C_VAXSTAR
  6351 #  ifdef C_VAXSTAR
  6310 		case C_VAXSTAR:
  6352                 case C_VAXSTAR:
  6311 		    cpuType = __MKSTRING("C_VAXSTAR");
  6353                     cpuType = __MKSTRING("C_VAXSTAR");
  6312 		    break;
  6354                     break;
  6313 #  endif
  6355 #  endif
  6314 #  ifdef VAX_60
  6356 #  ifdef VAX_60
  6315 		case VAX_60:
  6357                 case VAX_60:
  6316 		    cpuType = __MKSTRING("VAX_60");
  6358                     cpuType = __MKSTRING("VAX_60");
  6317 		    break;
  6359                     break;
  6318 #  endif
  6360 #  endif
  6319 #  ifdef VAX_3900
  6361 #  ifdef VAX_3900
  6320 		case VAX_3900:
  6362                 case VAX_3900:
  6321 		    cpuType = __MKSTRING("VAX_3900");
  6363                     cpuType = __MKSTRING("VAX_3900");
  6322 		    break;
  6364                     break;
  6323 #  endif
  6365 #  endif
  6324 #  ifdef DS_3100
  6366 #  ifdef DS_3100
  6325 		case DS_3100:
  6367                 case DS_3100:
  6326 		    cpuType = __MKSTRING("DS_3100");
  6368                     cpuType = __MKSTRING("DS_3100");
  6327 		    break;
  6369                     break;
  6328 #  endif
  6370 #  endif
  6329 #  ifdef VAX_8820
  6371 #  ifdef VAX_8820
  6330 		case VAX_8820:
  6372                 case VAX_8820:
  6331 		    cpuType = __MKSTRING("VAX_8820");
  6373                     cpuType = __MKSTRING("VAX_8820");
  6332 		    break;
  6374                     break;
  6333 #  endif
  6375 #  endif
  6334 #  ifdef DS_5400
  6376 #  ifdef DS_5400
  6335 		case DS_5400:
  6377                 case DS_5400:
  6336 		    cpuType = __MKSTRING("DS_5400");
  6378                     cpuType = __MKSTRING("DS_5400");
  6337 		    break;
  6379                     break;
  6338 #  endif
  6380 #  endif
  6339 #  ifdef DS_5800
  6381 #  ifdef DS_5800
  6340 		case DS_5800:
  6382                 case DS_5800:
  6341 		    cpuType = __MKSTRING("DS_5800");
  6383                     cpuType = __MKSTRING("DS_5800");
  6342 		    break;
  6384                     break;
  6343 #  endif
  6385 #  endif
  6344 #  ifdef DS_5000
  6386 #  ifdef DS_5000
  6345 		case DS_5000:
  6387                 case DS_5000:
  6346 		    cpuType = __MKSTRING("DS_5000");
  6388                     cpuType = __MKSTRING("DS_5000");
  6347 		    break;
  6389                     break;
  6348 #  endif
  6390 #  endif
  6349 #  ifdef DS_CMAX
  6391 #  ifdef DS_CMAX
  6350 		case DS_CMAX:
  6392                 case DS_CMAX:
  6351 		    cpuType = __MKSTRING("DS_CMAX");
  6393                     cpuType = __MKSTRING("DS_CMAX");
  6352 		    break;
  6394                     break;
  6353 #  endif
  6395 #  endif
  6354 #  ifdef VAX_6400
  6396 #  ifdef VAX_6400
  6355 		case VAX_6400:
  6397                 case VAX_6400:
  6356 		    cpuType = __MKSTRING("VAX_6400");
  6398                     cpuType = __MKSTRING("VAX_6400");
  6357 		    break;
  6399                     break;
  6358 #  endif
  6400 #  endif
  6359 #  ifdef VAXSTAR
  6401 #  ifdef VAXSTAR
  6360 		case VAXSTAR:
  6402                 case VAXSTAR:
  6361 		    cpuType = __MKSTRING("VAXSTAR");
  6403                     cpuType = __MKSTRING("VAXSTAR");
  6362 		    break;
  6404                     break;
  6363 #  endif
  6405 #  endif
  6364 #  ifdef DS_5500
  6406 #  ifdef DS_5500
  6365 		case DS_5500:
  6407                 case DS_5500:
  6366 		    cpuType = __MKSTRING("DS_5500");
  6408                     cpuType = __MKSTRING("DS_5500");
  6367 		    break;
  6409                     break;
  6368 #  endif
  6410 #  endif
  6369 #  ifdef DS_5100
  6411 #  ifdef DS_5100
  6370 		case DS_5100:
  6412                 case DS_5100:
  6371 		    cpuType = __MKSTRING("DS_5100");
  6413                     cpuType = __MKSTRING("DS_5100");
  6372 		    break;
  6414                     break;
  6373 #  endif
  6415 #  endif
  6374 #  ifdef VAX_9000
  6416 #  ifdef VAX_9000
  6375 		case VAX_9000:
  6417                 case VAX_9000:
  6376 		    cpuType = __MKSTRING("VAX_9000");
  6418                     cpuType = __MKSTRING("VAX_9000");
  6377 		    break;
  6419                     break;
  6378 #  endif
  6420 #  endif
  6379 #  ifdef DS_500_100
  6421 #  ifdef DS_500_100
  6380 		case DS_500_100:
  6422                 case DS_500_100:
  6381 		    cpuType = __MKSTRING("DS_500_100");
  6423                     cpuType = __MKSTRING("DS_500_100");
  6382 		    break;
  6424                     break;
  6383 #  endif
  6425 #  endif
  6384 
  6426 
  6385 
  6427 
  6386 #  ifdef ALPHA_ADU
  6428 #  ifdef ALPHA_ADU
  6387 		case ALPHA_ADU:
  6429                 case ALPHA_ADU:
  6388 		    cpuType = __MKSTRING("ALPHA_ADU");
  6430                     cpuType = __MKSTRING("ALPHA_ADU");
  6389 		    break;
  6431                     break;
  6390 #  endif
  6432 #  endif
  6391 #  ifdef DEC_4000
  6433 #  ifdef DEC_4000
  6392 		case DEC_4000:
  6434                 case DEC_4000:
  6393 		    cpuType = __MKSTRING("DEC_4000");
  6435                     cpuType = __MKSTRING("DEC_4000");
  6394 		    break;
  6436                     break;
  6395 #  endif
  6437 #  endif
  6396 #  ifdef DEC_3000_500
  6438 #  ifdef DEC_3000_500
  6397 		case DEC_3000_500:
  6439                 case DEC_3000_500:
  6398 		    cpuType = __MKSTRING("DEC_3000_500");
  6440                     cpuType = __MKSTRING("DEC_3000_500");
  6399 		    break;
  6441                     break;
  6400 #  endif
  6442 #  endif
  6401 #  ifdef DEC_7000
  6443 #  ifdef DEC_7000
  6402 		case DEC_7000:
  6444                 case DEC_7000:
  6403 		    cpuType = __MKSTRING("DEC_7000");
  6445                     cpuType = __MKSTRING("DEC_7000");
  6404 		    break;
  6446                     break;
  6405 #  endif
  6447 #  endif
  6406 #  ifdef DS_5000_300
  6448 #  ifdef DS_5000_300
  6407 		case DS_5000_300:
  6449                 case DS_5000_300:
  6408 		    cpuType = __MKSTRING("DS_5000_300");
  6450                     cpuType = __MKSTRING("DS_5000_300");
  6409 		    break;
  6451                     break;
  6410 #  endif
  6452 #  endif
  6411 #  ifdef DEC_3000_300
  6453 #  ifdef DEC_3000_300
  6412 		case DEC_3000_300:
  6454                 case DEC_3000_300:
  6413 		    cpuType = __MKSTRING("DEC_3000_300");
  6455                     cpuType = __MKSTRING("DEC_3000_300");
  6414 		    break;
  6456                     break;
  6415 #  endif
  6457 #  endif
  6416 #  ifdef DEC_2000_300
  6458 #  ifdef DEC_2000_300
  6417 		case DEC_2000_300:
  6459                 case DEC_2000_300:
  6418 		    cpuType = __MKSTRING("DEC_2000_300");
  6460                     cpuType = __MKSTRING("DEC_2000_300");
  6419 		    break;
  6461                     break;
  6420 #  endif
  6462 #  endif
  6421 #  ifdef DEC_2100_A500
  6463 #  ifdef DEC_2100_A500
  6422 		case DEC_2100_A500:
  6464                 case DEC_2100_A500:
  6423 		    cpuType = __MKSTRING("DEC_2100_A500");
  6465                     cpuType = __MKSTRING("DEC_2100_A500");
  6424 		    break;
  6466                     break;
  6425 #  endif
  6467 #  endif
  6426 #  ifdef DEC_2100_A50
  6468 #  ifdef DEC_2100_A50
  6427 		case DEC_2100_A50:
  6469                 case DEC_2100_A50:
  6428 		    cpuType = __MKSTRING("DEC_2100_A50");
  6470                     cpuType = __MKSTRING("DEC_2100_A50");
  6429 		    break;
  6471                     break;
  6430 #  endif
  6472 #  endif
  6431 #  ifdef ALPHA_KN20AA
  6473 #  ifdef ALPHA_KN20AA
  6432 		case ALPHA_KN20AA:
  6474                 case ALPHA_KN20AA:
  6433 		    cpuType = __MKSTRING("ALPHA_KN20AA");
  6475                     cpuType = __MKSTRING("ALPHA_KN20AA");
  6434 		    break;
  6476                     break;
  6435 #  endif
  6477 #  endif
  6436 #  ifdef DEC_21000
  6478 #  ifdef DEC_21000
  6437 		case DEC_21000:
  6479                 case DEC_21000:
  6438 		    cpuType = __MKSTRING("DEC_21000");
  6480                     cpuType = __MKSTRING("DEC_21000");
  6439 		    break;
  6481                     break;
  6440 #  endif
  6482 #  endif
  6441 #  ifdef DEC_AXPVME_64
  6483 #  ifdef DEC_AXPVME_64
  6442 		case DEC_AXPVME_64:
  6484                 case DEC_AXPVME_64:
  6443 		    cpuType = __MKSTRING("DEC_AXPVME_64");
  6485                     cpuType = __MKSTRING("DEC_AXPVME_64");
  6444 		    break;
  6486                     break;
  6445 #  endif
  6487 #  endif
  6446 #  ifdef DEC_2100_C500
  6488 #  ifdef DEC_2100_C500
  6447 		case DEC_2100_C500:
  6489                 case DEC_2100_C500:
  6448 		    cpuType = __MKSTRING("DEC_2100_C500");
  6490                     cpuType = __MKSTRING("DEC_2100_C500");
  6449 		    break;
  6491                     break;
  6450 #  endif
  6492 #  endif
  6451 #  ifdef DEC_AXPPCI_33
  6493 #  ifdef DEC_AXPPCI_33
  6452 		case DEC_AXPPCI_33:
  6494                 case DEC_AXPPCI_33:
  6453 		    cpuType = __MKSTRING("DEC_AXPPCI_33");
  6495                     cpuType = __MKSTRING("DEC_AXPPCI_33");
  6454 		    break;
  6496                     break;
  6455 #  endif
  6497 #  endif
  6456 #  ifdef DEC_1000
  6498 #  ifdef DEC_1000
  6457 		case DEC_1000:
  6499                 case DEC_1000:
  6458 		    cpuType = __MKSTRING("DEC_1000");
  6500                     cpuType = __MKSTRING("DEC_1000");
  6459 		    break;
  6501                     break;
  6460 #  endif
  6502 #  endif
  6461 #  ifdef EB64_PLUS
  6503 #  ifdef EB64_PLUS
  6462 		case EB64_PLUS:
  6504                 case EB64_PLUS:
  6463 		    cpuType = __MKSTRING("EB64_PLUS");
  6505                     cpuType = __MKSTRING("EB64_PLUS");
  6464 		    break;
  6506                     break;
  6465 #  endif
  6507 #  endif
  6466 #  ifdef LCA_EB66
  6508 #  ifdef LCA_EB66
  6467 		case LCA_EB66:
  6509                 case LCA_EB66:
  6468 		    cpuType = __MKSTRING("LCA_EB66");
  6510                     cpuType = __MKSTRING("LCA_EB66");
  6469 		    break;
  6511                     break;
  6470 #  endif
  6512 #  endif
  6471 #  ifdef ALPHA_EB164
  6513 #  ifdef ALPHA_EB164
  6472 		case ALPHA_EB164:
  6514                 case ALPHA_EB164:
  6473 		    cpuType = __MKSTRING("ALPHA_EB164");
  6515                     cpuType = __MKSTRING("ALPHA_EB164");
  6474 		    break;
  6516                     break;
  6475 #  endif
  6517 #  endif
  6476 #  ifdef DEC_EV45_PBP
  6518 #  ifdef DEC_EV45_PBP
  6477 		case DEC_EV45_PBP:
  6519                 case DEC_EV45_PBP:
  6478 		    cpuType = __MKSTRING("DEC_EV45_PBP");
  6520                     cpuType = __MKSTRING("DEC_EV45_PBP");
  6479 		    break;
  6521                     break;
  6480 #  endif
  6522 #  endif
  6481 #  ifdef DEC_1000A
  6523 #  ifdef DEC_1000A
  6482 		case DEC_1000A:
  6524                 case DEC_1000A:
  6483 		    cpuType = __MKSTRING("DEC_1000A");
  6525                     cpuType = __MKSTRING("DEC_1000A");
  6484 		    break;
  6526                     break;
  6485 #  endif
  6527 #  endif
  6486 #  ifdef DEC_4100
  6528 #  ifdef DEC_4100
  6487 		case DEC_4100:
  6529                 case DEC_4100:
  6488 		    cpuType = __MKSTRING("DEC_4100");
  6530                     cpuType = __MKSTRING("DEC_4100");
  6489 		    break;
  6531                     break;
  6490 #  endif
  6532 #  endif
  6491 #  ifdef DEC_ALPHAVME_224
  6533 #  ifdef DEC_ALPHAVME_224
  6492 		case DEC_ALPHAVME_224:
  6534                 case DEC_ALPHAVME_224:
  6493 		    cpuType = __MKSTRING("DEC_ALPHAVME_224");
  6535                     cpuType = __MKSTRING("DEC_ALPHAVME_224");
  6494 		    break;
  6536                     break;
  6495 #  endif
  6537 #  endif
  6496 #  ifdef DEC_1000_5
  6538 #  ifdef DEC_1000_5
  6497 		case DEC_1000_5:
  6539                 case DEC_1000_5:
  6498 		    cpuType = __MKSTRING("DEC_1000_5");
  6540                     cpuType = __MKSTRING("DEC_1000_5");
  6499 		    break;
  6541                     break;
  6500 #  endif
  6542 #  endif
  6501 #  ifdef DEC_1000A_5
  6543 #  ifdef DEC_1000A_5
  6502 		case DEC_1000A_5:
  6544                 case DEC_1000A_5:
  6503 		    cpuType = __MKSTRING("DEC_1000A_5");
  6545                     cpuType = __MKSTRING("DEC_1000A_5");
  6504 		    break;
  6546                     break;
  6505 #  endif
  6547 #  endif
  6506 #  ifdef UNKN_SYSTEM
  6548 #  ifdef UNKN_SYSTEM
  6507 		case UNKN_SYSTEM:
  6549                 case UNKN_SYSTEM:
  6508 		    cpuType = __MKSTRING("UNKN_SYSTEM");
  6550                     cpuType = __MKSTRING("UNKN_SYSTEM");
  6509 		    break;
  6551                     break;
  6510 #  endif
  6552 #  endif
  6511 	    }
  6553             }
  6512 	}
  6554         }
  6513 # endif /* GSI_CPU */
  6555 # endif /* GSI_CPU */
  6514 
  6556 
  6515 # if defined(GSI_CPUS_IN_BOX)
  6557 # if defined(GSI_CPUS_IN_BOX)
  6516 	index = 0;
  6558         index = 0;
  6517 	if (getsysinfo(GSI_CPUS_IN_BOX, &retInt32, sizeof(retInt32), &index, NULL) > 0) {
  6559         if (getsysinfo(GSI_CPUS_IN_BOX, &retInt32, sizeof(retInt32), &index, NULL) > 0) {
  6518 	    numberOfCPUs   = __MKUINT(retInt32);
  6560             numberOfCPUs   = __MKUINT(retInt32);
  6519 	}
  6561         }
  6520 # endif /* GSI_CPUS_IN_BOX */
  6562 # endif /* GSI_CPUS_IN_BOX */
  6521 
  6563 
  6522 # if defined(GSI_PHYSMEM)
  6564 # if defined(GSI_PHYSMEM)
  6523 	index = 0;
  6565         index = 0;
  6524 	if (getsysinfo(GSI_PHYSMEM, &retInt32, sizeof(retInt32), &index, NULL) > 0) {
  6566         if (getsysinfo(GSI_PHYSMEM, &retInt32, sizeof(retInt32), &index, NULL) > 0) {
  6525 	    INT bytes = retInt32 * 1024;
  6567             INT bytes = retInt32 * 1024;
  6526 
  6568 
  6527 	    physicalRam   = __MKUINT(bytes);
  6569             physicalRam   = __MKUINT(bytes);
  6528 	}
  6570         }
  6529 # endif /* GSI_PHYSMEM */
  6571 # endif /* GSI_PHYSMEM */
  6530 
  6572 
  6531     }
  6573     }
  6532 #endif /* HAS_GETSYSTEMINFO */
  6574 #endif /* HAS_GETSYSTEMINFO */
  6533 
  6575 
  6534 %}.
  6576 %}.
  6535     sys isNil ifTrue:[
  6577     sys isNil ifTrue:[
  6536 	sys := self getSystemType.
  6578         sys := self getSystemType.
  6537     ].
  6579     ].
  6538     node isNil ifTrue:[
  6580     node isNil ifTrue:[
  6539 	node := self getHostName.
  6581         node := self getHostName.
  6540     ].
  6582     ].
  6541     dom isNil ifTrue:[
  6583     dom isNil ifTrue:[
  6542 	dom := self getDomainName.
  6584         dom := self getDomainName.
  6543     ].
  6585     ].
  6544     mach isNil ifTrue:[
  6586     mach isNil ifTrue:[
  6545 	mach := self getCPUType.
  6587         mach := self getCPUType.
  6546     ].
  6588     ].
  6547     arch isNil ifTrue:[
  6589     arch isNil ifTrue:[
  6548 	arch := sys.
  6590         arch := sys.
  6549     ].
  6591     ].
  6550 
  6592 
  6551     info := IdentityDictionary new.
  6593     info := IdentityDictionary new.
  6552     info at:#system put:sys.
  6594     info at:#system put:sys.
  6553     info at:#node put:node.
  6595     info at:#node put:node.
  6555     ver notNil ifTrue:[info at:#version put:ver].
  6597     ver notNil ifTrue:[info at:#version put:ver].
  6556     mach notNil ifTrue:[info at:#machine put:mach].
  6598     mach notNil ifTrue:[info at:#machine put:mach].
  6557     arch notNil ifTrue:[info at:#architecture put:arch].
  6599     arch notNil ifTrue:[info at:#architecture put:arch].
  6558     dom notNil ifTrue:[info at:#domain put:dom].
  6600     dom notNil ifTrue:[info at:#domain put:dom].
  6559     (pageSize notNil and:[physicalPages notNil]) ifTrue:[
  6601     (pageSize notNil and:[physicalPages notNil]) ifTrue:[
  6560 	physicalRam := pageSize * physicalPages. "/ done here - could be largeInt.
  6602         physicalRam := pageSize * physicalPages. "/ done here - could be largeInt.
       
  6603         physicalRam notNil ifTrue:[info at:#physicalRam put:physicalRam].
  6561     ].
  6604     ].
  6562     physicalRam notNil ifTrue:[info at:#physicalRam put:physicalRam].
  6605     (pageSize notNil and:[availablePages notNil]) ifTrue:[
       
  6606         availableRam := pageSize * availablePages. "/ done here - could be largeInt.
       
  6607         availableRam notNil ifTrue:[info at:#availableRam put:availableRam].
       
  6608     ].
  6563     totalRam notNil ifTrue:[info at:#totalRam put:totalRam].
  6609     totalRam notNil ifTrue:[info at:#totalRam put:totalRam].
  6564     sharedRam notNil ifTrue:[info at:#sharedRam put:sharedRam].
  6610     sharedRam notNil ifTrue:[info at:#sharedRam put:sharedRam].
  6565     bufferRam notNil ifTrue:[info at:#bufferRam put:bufferRam].
  6611     bufferRam notNil ifTrue:[info at:#bufferRam put:bufferRam].
  6566     virtualRam notNil ifTrue:[info at:#virtualRam put:virtualRam].
  6612     virtualRam notNil ifTrue:[info at:#virtualRam put:virtualRam].
  6567     activeVirtualRam notNil ifTrue:[info at:#activeVirtualRam put:activeVirtualRam].
  6613     activeVirtualRam notNil ifTrue:[info at:#activeVirtualRam put:activeVirtualRam].
  6572     freeSwap notNil ifTrue:[info at:#freeSwap put:freeSwap].
  6618     freeSwap notNil ifTrue:[info at:#freeSwap put:freeSwap].
  6573     numberOfCPUs notNil ifTrue:[info at:#numberOfCPUs put:numberOfCPUs].
  6619     numberOfCPUs notNil ifTrue:[info at:#numberOfCPUs put:numberOfCPUs].
  6574     cpuType notNil ifTrue:[info at:#cpuType put:cpuType].
  6620     cpuType notNil ifTrue:[info at:#cpuType put:cpuType].
  6575     dCacheSize notNil ifTrue:[info at:#dCacheSize put:dCacheSize].
  6621     dCacheSize notNil ifTrue:[info at:#dCacheSize put:dCacheSize].
  6576     iCacheSize notNil ifTrue:[info at:#iCacheSize put:iCacheSize].
  6622     iCacheSize notNil ifTrue:[info at:#iCacheSize put:iCacheSize].
       
  6623     instructionSets notNil ifTrue:[info at:#instructionSets put:instructionSets].
       
  6624     platform notNil ifTrue:[info at:#platform put:platform].
  6577     info at:#osType put:(self getOSType).
  6625     info at:#osType put:(self getOSType).
  6578     ^ info
  6626     ^ info
  6579 
  6627 
  6580     "
  6628     "
  6581      OperatingSystem getSystemInfo
  6629      OperatingSystem getSystemInfo
  8525 ! !
  8573 ! !
  8526 
  8574 
  8527 !UnixOperatingSystem class methodsFor:'documentation'!
  8575 !UnixOperatingSystem class methodsFor:'documentation'!
  8528 
  8576 
  8529 version
  8577 version
  8530     ^ '$Header: /cvs/stx/stx/libbasic/Attic/UnixOS.st,v 1.50 1999-03-03 19:16:20 cg Exp $'
  8578     ^ '$Header: /cvs/stx/stx/libbasic/Attic/UnixOS.st,v 1.51 1999-03-31 19:59:01 cg Exp $'
  8531 ! !
  8579 ! !
  8532 UnixOperatingSystem initialize!
  8580 UnixOperatingSystem initialize!