--- a/UnixOperatingSystem.st Tue Oct 19 16:38:52 1999 +0200
+++ b/UnixOperatingSystem.st Tue Oct 19 17:07:19 1999 +0200
@@ -947,16 +947,16 @@
"catch image restart and flush some cached data"
something == #earlyRestart ifTrue:[
- "
- flush cached data/info
- "
- HostName := nil.
- DomainName := nil.
- LastErrorNumber := nil.
- PipeFailed := false.
- SlowFork := false.
- ForkFailed := false.
- CurrentDirectory := nil.
+ "
+ flush cached data/info
+ "
+ HostName := nil.
+ DomainName := nil.
+ LastErrorNumber := nil.
+ PipeFailed := false.
+ SlowFork := false.
+ ForkFailed := false.
+ CurrentDirectory := nil.
]
"Created: / 15.6.1996 / 15:22:37 / cg"
@@ -3091,31 +3091,31 @@
aCommandString isNil ifTrue:[^ nil].
(in := anExternalInStream) isNil ifTrue:[
- in := '/dev/null' asFilename readStream
+ in := '/dev/null' asFilename readStream
].
(out := anExternalOutStream) isNil ifTrue:[
- out := '/dev/null' asFilename writeStream
+ out := '/dev/null' asFilename writeStream
].
(err := anExternalErrStream) isNil ifTrue:[
- anExternalOutStream isNil ifTrue:[
- err := out
- ] ifFalse:[
- err := '/dev/null' asFilename writeStream
- ]
+ anExternalOutStream isNil ifTrue:[
+ err := out
+ ] ifFalse:[
+ err := '/dev/null' asFilename writeStream
+ ]
].
shellAndArgs := self commandAndArgsForOSCommand:aCommandString.
rslt := self
- exec:(shellAndArgs at:1)
- withArguments:(shellAndArgs at:2)
- fileDescriptors:(Array with:in fileDescriptor
- with:out fileDescriptor
- with:err fileDescriptor)
- closeDescriptors:nil
- fork:true
- newPgrp:false
- inDirectory:dir.
+ exec:(shellAndArgs at:1)
+ withArguments:(shellAndArgs at:2)
+ fileDescriptors:(Array with:in fileDescriptor
+ with:out fileDescriptor
+ with:err fileDescriptor)
+ closeDescriptors:nil
+ fork:true
+ newPgrp:false
+ inDirectory:dir.
^ rslt
@@ -3138,7 +3138,7 @@
The following will no longer work. monitorPid has disappeared
pid notNil ifTrue:[
- Processor monitorPid:pid action:[:OSstatus | sema signal ].
+ Processor monitorPid:pid action:[:OSstatus | sema signal ].
].
in close.
out close.
@@ -3983,8 +3983,8 @@
The amount of information returned depends upon the OS, and is
not guaranteed to be consistent across architectures.
On unix, the information returned is (at least):
- mountPoint - mount point
- fileSystem - device or NFS-remotePath
+ mountPoint - mount point
+ fileSystem - device or NFS-remotePath
"
|p outputText keys values info infoEntry|
@@ -3993,9 +3993,9 @@
p isNil ifTrue:[^ nil].
[
- outputText := p contentsOfEntireFile.
+ outputText := p contentsOfEntireFile.
] valueNowOrOnUnwindDo:[
- p close.
+ p close.
].
"/ Transcript showCR:outputText asString.
outputText isNil ifTrue:[^ nil].
@@ -4010,15 +4010,15 @@
info := OrderedCollection new.
outputText from:2 do:[:line |
- values := line asCollectionOfWords.
-
- values size >= 2 ifTrue:[
-
- infoEntry := IdentityDictionary new.
- infoEntry at:#mountPoint put:(values last).
- infoEntry at:#fileSystem put:(values first).
- info add:infoEntry.
- ]
+ values := line asCollectionOfWords.
+
+ values size >= 2 ifTrue:[
+
+ infoEntry := IdentityDictionary new.
+ infoEntry at:#mountPoint put:(values last).
+ infoEntry at:#fileSystem put:(values first).
+ info add:infoEntry.
+ ]
].
^ info
@@ -4039,21 +4039,21 @@
"return some object filled with info for the file 'aPathName';
the info (for which corresponding access methods are understood by
the returned object) is:
- type - a symbol giving the files type
- mode - numeric access mode
- uid - owners user id
- gid - owners group id
- size - files size
- id - files number (i.e. inode number)
- accessed - last access time (as Timestamp)
- modified - last modification time (as Timestamp)
- statusChanged - last status change time (as Timestamp)
- alternativeName - (windows only:) the MSDOS name of the file
- recordFormatNumeric - (VMS only:) numeric value of the recordFormat
- recordFormat - (VMS only:) symbolic value of the recordFormat
- recordAttributes - (VMS only:) recordAttributes
- fixedHeaderSize - (VMS only:) fixed header size in a variable record format
- recordSize - (VMS only:) record size.
+ type - a symbol giving the files type
+ mode - numeric access mode
+ uid - owners user id
+ gid - owners group id
+ size - files size
+ id - files number (i.e. inode number)
+ accessed - last access time (as Timestamp)
+ modified - last modification time (as Timestamp)
+ statusChanged - last status change time (as Timestamp)
+ alternativeName - (windows only:) the MSDOS name of the file
+ recordFormatNumeric - (VMS only:) numeric value of the recordFormat
+ recordFormat - (VMS only:) symbolic value of the recordFormat
+ recordAttributes - (VMS only:) recordAttributes
+ fixedHeaderSize - (VMS only:) fixed header size in a variable record format
+ recordSize - (VMS only:) record size.
Some of the fields may be returned as nil on systems which do not provide
all of the information.
@@ -4074,95 +4074,95 @@
if (__isString(aPathName)) {
# ifdef TRACE_STAT_CALLS
- printf("stat on '%s' for info\n", __stringVal(aPathName));
-# endif
- __BEGIN_INTERRUPTABLE__
- do {
- ret = stat((char *) __stringVal(aPathName), &buf);
- } while ((ret < 0) && (errno == EINTR));
- __END_INTERRUPTABLE__
-
- if (ret < 0) {
- @global(LastErrorNumber) = __MKSMALLINT(errno);
- RETURN ( nil );
- }
- switch (buf.st_mode & S_IFMT) {
- case S_IFDIR:
- type = @symbol(directory);
- break;
-
- case S_IFREG:
- type = @symbol(regular);
- break;
+ printf("stat on '%s' for info\n", __stringVal(aPathName));
+# endif
+ __BEGIN_INTERRUPTABLE__
+ do {
+ ret = stat((char *) __stringVal(aPathName), &buf);
+ } while ((ret < 0) && (errno == EINTR));
+ __END_INTERRUPTABLE__
+
+ if (ret < 0) {
+ @global(LastErrorNumber) = __MKSMALLINT(errno);
+ RETURN ( nil );
+ }
+ switch (buf.st_mode & S_IFMT) {
+ case S_IFDIR:
+ type = @symbol(directory);
+ break;
+
+ case S_IFREG:
+ type = @symbol(regular);
+ break;
# ifdef S_IFCHR
- case S_IFCHR:
- type = @symbol(characterSpecial);
- break;
+ case S_IFCHR:
+ type = @symbol(characterSpecial);
+ break;
# endif
# ifdef S_IFBLK
- case S_IFBLK:
- type = @symbol(blockSpecial);
- break;
+ case S_IFBLK:
+ type = @symbol(blockSpecial);
+ break;
# endif
# ifdef S_IFMPC
- case S_IFMPC:
- type = @symbol(multiplexedCharacterSpecial);
- break;
+ case S_IFMPC:
+ type = @symbol(multiplexedCharacterSpecial);
+ break;
# endif
# ifdef S_IFMPB
- case S_IFMPB:
- type = @symbol(multiplexedBlockSpecial);
- break;
+ case S_IFMPB:
+ type = @symbol(multiplexedBlockSpecial);
+ break;
# endif
# ifdef S_IFLNK
- case S_IFLNK:
- type = @symbol(symbolicLink);
- break;
+ case S_IFLNK:
+ type = @symbol(symbolicLink);
+ break;
# endif
# ifdef S_IFSOCK
- case S_IFSOCK:
- type = @symbol(socket);
- break;
+ case S_IFSOCK:
+ type = @symbol(socket);
+ break;
# endif
# ifdef S_IFIFO
- case S_IFIFO:
- type = @symbol(fifo);
- break;
-# endif
- default:
- type = @symbol(unknown);
- break;
- }
-
- ino = buf.st_ino;
- id = __MKUINT(ino);
-
- mode = __MKSMALLINT(buf.st_mode & 0777);
- uid = __MKSMALLINT(buf.st_uid);
- gid = __MKSMALLINT(buf.st_gid);
- size = __MKUINT(buf.st_size);
- aOStime = __MKUINT(buf.st_atime);
- mOStime = __MKUINT(buf.st_mtime);
- cOStime = __MKUINT(buf.st_ctime);
+ case S_IFIFO:
+ type = @symbol(fifo);
+ break;
+# endif
+ default:
+ type = @symbol(unknown);
+ break;
+ }
+
+ ino = buf.st_ino;
+ id = __MKUINT(ino);
+
+ mode = __MKSMALLINT(buf.st_mode & 0777);
+ uid = __MKSMALLINT(buf.st_uid);
+ gid = __MKSMALLINT(buf.st_gid);
+ size = __MKUINT(buf.st_size);
+ aOStime = __MKUINT(buf.st_atime);
+ mOStime = __MKUINT(buf.st_mtime);
+ cOStime = __MKUINT(buf.st_ctime);
}
%}.
mode notNil ifTrue:[
- atime := AbsoluteTime fromOSTime:(aOStime * 1000).
- mtime := AbsoluteTime fromOSTime:(mOStime * 1000).
- ctime := AbsoluteTime fromOSTime:(cOStime * 1000).
-
- info := FileStatusInfo
- type:type
- mode:mode
- uid:uid
- gid:gid
- size:size
- id:id
- accessed:atime
- modified:mtime
- statusChanged:ctime
- path:nil.
- ^ info
+ atime := AbsoluteTime fromOSTime:(aOStime * 1000).
+ mtime := AbsoluteTime fromOSTime:(mOStime * 1000).
+ ctime := AbsoluteTime fromOSTime:(cOStime * 1000).
+
+ info := FileStatusInfo
+ type:type
+ mode:mode
+ uid:uid
+ gid:gid
+ size:size
+ id:id
+ accessed:atime
+ modified:mtime
+ statusChanged:ctime
+ path:nil.
+ ^ info
].
^ self primitiveFailed
@@ -6158,6 +6158,7 @@
#bufferRam -> amount used for buffers
#swapSize -> total size of swap space
#freeSwap -> free amount in swapSpace
+ #extendedInstructions -> extended instruction set info
osf:
#physicalRam -> total amount of physical memory
@@ -6187,10 +6188,9 @@
physicalRam availableRam totalRam sharedRam bufferRam swapSize freeSwap
numberOfCPUs pageSize physicalPages availablePages dCacheSize iCacheSize
virtualRam activeVirtualRam realMemory activeRealMemory freeMemory
- instructionSets platform|
+ instructionSets extendedInstructions platform|
%{ /* STACK: 4096 */
-
#ifdef LINUX
# ifdef ELF /* old a.out unixes do not have this ... */
/*
@@ -6247,7 +6247,8 @@
*/
#endif /* no UNAME */
-#if defined(HAS_SYSINFO) && defined(SI_ARCHITECTURE)
+#if defined(HAS_SYSINFO)
+# if defined(SI_ARCHITECTURE)
if (arch == nil) {
char buffer[128];
@@ -6255,9 +6256,9 @@
arch = __MKSTRING(buffer);
}
}
-#endif /* HAS_SYSINFO & SI_ARCHITECTURE */
-
-#if defined(HAS_SYSINFO) && defined(SI_ISALIST)
+ #endif /* SI_ARCHITECTURE */
+
+# if defined(SI_ISALIST)
{
char buffer[128];
@@ -6265,9 +6266,9 @@
instructionSets = __MKSTRING(buffer);
}
}
-#endif /* HAS_SYSINFO & SI_ARCHITECTURE */
-
-#if defined(HAS_SYSINFO) && defined(SI_PLATFORM)
+# endif /* SI_ISALIST */
+
+# if defined(SI_PLATFORM)
{
char buffer[128];
@@ -6275,7 +6276,8 @@
platform = __MKSTRING(buffer);
}
}
-#endif /* HAS_SYSINFO & SI_ARCHITECTURE */
+# endif /* SI_PLATFORM */
+#endif /* HAS_SYSINFO */
#if defined(HAS_GETDOMAINNAME)
if (dom == nil) {
@@ -6288,7 +6290,6 @@
#endif /* HAS_GETDOMAINNAME */
#if defined(HAS_SYSCONF)
-
# ifdef _SC_NPROCESSORS_ONLN
{
long val;
@@ -6299,6 +6300,7 @@
}
}
# endif
+
# if defined(_SC_PAGESIZE)
{
long val;
@@ -6309,6 +6311,7 @@
}
}
# endif
+
# if defined(_SC_PHYS_PAGES)
{
long val;
@@ -6319,6 +6322,7 @@
}
}
# endif
+
# if defined(_SC_AVPHYS_PAGES)
{
long val;
@@ -6329,6 +6333,7 @@
}
}
# endif
+
# if defined(_SC_ICACHE_SZ)
{
long val;
@@ -6339,6 +6344,7 @@
}
}
# endif
+
# if defined(_SC_DCACHE_SZ)
{
long val;
@@ -6349,8 +6355,6 @@
}
}
# endif
-
-
#endif /* HAS_SYSCONF */
#if defined(HAS_GETSYSINFO)
@@ -6704,6 +6708,11 @@
}
#endif /* HAS_GETSYSINFO */
+ {
+ extern OBJ __getInstructionSetInfo();
+
+ extendedInstructions = __getInstructionSetInfo();
+ }
%}.
sys isNil ifTrue:[
sys := self getSystemType.
@@ -6753,6 +6762,7 @@
dCacheSize notNil ifTrue:[info at:#dCacheSize put:dCacheSize].
iCacheSize notNil ifTrue:[info at:#iCacheSize put:iCacheSize].
instructionSets notNil ifTrue:[info at:#instructionSets put:instructionSets].
+ extendedInstructions notNil ifTrue:[info at:#extendedInstructions put:(extendedInstructions asOrderedCollection select:[:e | e notNil])].
platform notNil ifTrue:[info at:#platform put:platform].
info at:#osType put:(self getOSType).
^ info
@@ -7175,21 +7185,21 @@
if (__bothSmallInteger(y, m)
&& __bothSmallInteger(d, h)
&& __bothSmallInteger(min, s)) {
- tm.tm_hour = __intVal(h);
- tm.tm_min = __intVal(min);
- tm.tm_sec = __intVal(s);
-
- tm.tm_year = __intVal(y) - 1900;
- tm.tm_mon = __intVal(m) - 1;
- tm.tm_mday = __intVal(d);
- tm.tm_isdst = 0;
-
- t = mktime(&tm);
- osSeconds = __MKUINT((INT)t-TIMEZONE(tmPtr));
+ tm.tm_hour = __intVal(h);
+ tm.tm_min = __intVal(min);
+ tm.tm_sec = __intVal(s);
+
+ tm.tm_year = __intVal(y) - 1900;
+ tm.tm_mon = __intVal(m) - 1;
+ tm.tm_mday = __intVal(d);
+ tm.tm_isdst = 0;
+
+ t = mktime(&tm);
+ osSeconds = __MKUINT((INT)t-TIMEZONE(tmPtr));
}
%}.
osSeconds notNil ifTrue:[
- ^ osSeconds * 1000 + millis
+ ^ osSeconds * 1000 + millis
].
^ self primitiveFailed
@@ -8713,6 +8723,6 @@
!UnixOperatingSystem class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/UnixOperatingSystem.st,v 1.71 1999-10-08 12:46:02 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/UnixOperatingSystem.st,v 1.72 1999-10-19 15:07:19 cg Exp $'
! !
UnixOperatingSystem initialize!