eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'AbstractOperatingSystem':

Home

everywhere
www.exept.de
for:
[back]

Class: AbstractOperatingSystem


Inheritance:

   Object
   |
   +--AbstractOperatingSystem
      |
      +--UnixOperatingSystem

Package:
stx:libbasic
Category:
System-Support
Version:
rev: 1.197 date: 2010/03/30 13:50:30
user: stefan
file: AbstractOperatingSystem.st directory: libbasic
module: stx stc-classLibrary: libbasic
Author:
Claus Gittinger

Description:


this class realizes services common to the supported operating systems;
typically, services which can be implemented based upon more primitive
functions, or which can be implemented in a portable way (but probably
less performant) are implemented here.

[Class variables:]
    ConcreteClass   <Class>         the real OS class

    LocaleInfo      <Dictionary>    if non nil, that is taken instead of the operating
                                    systems locale definitions (allows for overwriting
                                    these, or provide a compatible info on systems which do
                                    not support locales)

    LastErrorNumber <Integer>       the last value of errno

    OSSignals       <Array>         Array of signals to be raised for corresponding
                                    OperatingSystem signals.

    PipeFailed      <Boolean>       set if a fork (or popen) has failed;
                                    ST/X will avoid doing more forks/popens
                                    if this flag is set, for a slightly
                                    smoother operation.

    ErrorSignal     <Signal>        Parentsignal of all OS error signals.
                                    not directly raised.

    AccessDeniedErrorSignal         misc concrete error reporting signals
    FileNotFoundErrorSignal
    UnsupportedOperationSignal
    InvalidArgumentsSignal


Related information:

    OSProcessStatus
    Filename
    Date
    Time
    ExternalStream
    FileStream
    PipeStream
    Socket

Class protocol:

OS signal constants
o  sigABRT
return the signal number for SIGABRT - 0 if not supported by OS
(the numeric value is not the same across unix-systems)

o  sigALRM
return the signal number for SIGALRM - 0 if not supported
(the numeric value is not the same across unix-systems)

o  sigBREAK
return the signal number for SIGBREAK - 0 if not supported.
This is an MSDOS specific signal

o  sigBUS
return the signal number for SIGBUS - 0 if not supported
(the numeric value is not the same across unix-systems)

o  sigCHLD
return the signal number for SIGCHLD - 0 if not supported
(the numeric value is not the same across unix-systems)

o  sigCONT
return the signal number for SIGCONT - 0 if not supported
(the numeric value is not the same across unix-systems)

o  sigDANGER
return the signal number for SIGDANGER - 0 if not supported
(seems to be an AIX special)

o  sigEMT
return the signal number for SIGEMT - 0 if not supported by OS
(the numeric value is not the same across unix-systems)

o  sigFP
return the signal number for SIGFP - 0 if not supported by OS
(the numeric value is not the same across unix-systems)

o  sigGRANT
return the signal number for SIGGRANT - 0 if not supported
(seems to be an AIX special)

o  sigHUP
return the signal number for SIGHUP
(the numeric value is not the same across unix-systems)

o  sigILL
return the signal number for SIGILL - 0 if not supported by OS
(the numeric value is not the same across unix-systems)

o  sigINT
return the signal number for SIGINT
(the numeric value is not the same across unix-systems)

o  sigIO
return the signal number for SIGIO - 0 if not supported
(the numeric value is not the same across unix-systems)

o  sigIOT
return the signal number for SIGIOT - 0 if not supported by OS
(the numeric value is not the same across unix-systems)

o  sigKILL
return the signal number for SIGKILL
(the numeric value is not the same across unix-systems)

o  sigLOST
return the signal number for SIGLOST - 0 if not supported
(the numeric value is not the same across unix-systems)

o  sigMIGRATE
return the signal number for SIGMIGRATE - 0 if not supported
(seems to be an AIX special)

o  sigMSG
return the signal number for SIGMSG - 0 if not supported
(seems to be an AIX special)

o  sigPIPE
return the signal number for SIGPIPE - 0 if not supported
(the numeric value is not the same across unix-systems)

o  sigPOLL
return the signal number for SIGPOLL - 0 if not supported
(the numeric value is not the same across unix-systems)

o  sigPRE
return the signal number for SIGPRE - 0 if not supported
(seems to be an AIX special)

o  sigPROF
return the signal number for SIGPROF - 0 if not supported
(the numeric value is not the same across unix-systems)

o  sigPWR
return the signal number for SIGPWR - 0 if not supported
(not available on all systems)

o  sigQUIT
return the signal number for SIGQUIT
(the numeric value is not the same across unix-systems)

o  sigRETRACT
return the signal number for SIGRETRACT - 0 if not supported
(seems to be an AIX special)

o  sigSAK
return the signal number for SIGSAK - 0 if not supported
(seems to be an AIX special)

o  sigSEGV
return the signal number for SIGSEGV - 0 if not supported
(the numeric value is not the same across unix-systems)

o  sigSOUND
return the signal number for SIGSOUND - 0 if not supported
(seems to be an AIX special)

o  sigSTOP
return the signal number for SIGSTOP - 0 if not supported
(the numeric value is not the same across unix-systems)

o  sigSYS
return the signal number for SIGSYS - 0 if not supported
(the numeric value is not the same across unix-systems)

o  sigTERM
return the signal number for SIGTERM - 0 if not supported
(the numeric value is not the same across unix-systems)

o  sigTRAP
return the signal number for SIGTRAP - 0 if not supported by OS
(the numeric value is not the same across unix-systems)

o  sigTSTP
return the signal number for SIGTSTP - 0 if not supported
(the numeric value is not the same across unix-systems)

o  sigTTIN
return the signal number for SIGTTIN - 0 if not supported
(the numeric value is not the same across unix-systems)

o  sigTTOU
return the signal number for SIGTTOU - 0 if not supported
(the numeric value is not the same across unix-systems)

o  sigURG
return the signal number for SIGURG - 0 if not supported
(the numeric value is not the same across unix-systems)

o  sigUSR1
return the signal number for SIGUSR1 - 0 if not supported
(the numeric value is not the same across unix-systems)

o  sigUSR2
return the signal number for SIGUSR2 - 0 if not supported
(the numeric value is not the same across unix-systems)

o  sigVTALRM
return the signal number for SIGVTALRM - 0 if not supported
(the numeric value is not the same across unix-systems)

o  sigWINCH
return the signal number for SIGWINCH - 0 if not supported
(the numeric value is not the same across unix-systems)

o  sigXCPU
return the signal number for SIGXCPU - 0 if not supported
(the numeric value is not the same across unix-systems)

o  sigXFSZ
return the signal number for SIGXFSZ - 0 if not supported
(the numeric value is not the same across unix-systems)

Signal constants
o  accessDeniedErrorSignal
return the signal raised when a (file-) access is denied.

o  errorSignal
return the parent signal of all OS signals.

o  fileNotFoundErrorSignal
return the signal raised when a file was not found.

o  invalidArgumentsSignal
return the signal which is raised for invalid arguments.
Currently, this is never raised.

o  unsupportedOperationSignal
return the signal which is raised when an operation
is attempted, which is not supported by the OS.
(For example, creating a link on VMS or MSDOS)

change & update
o  update: something with: aParameter from: changedObject
Smalltalk notifies us about changes

error messages
o  clearLastErrorNumber
return the last errors number.
See also: #lastErrorSymbol and #lastErrorString.
Notice: having a single error number is a bad idea in a multithreaded
environment - this interface will change.

o  currentErrorNumber
returns the OS's last error nr (i.e. the value of errno).
Notice, that the value of this flag is only valid immediately
after the error occurred - it gets updated with every other
request to the OS.
Use lastErrorNumber - currentErrorNumber is invalidated by
many, many internal calls.

o  errorHolderForNumber: anInteger

** This method raises an error - it must be redefined in concrete classes **

o  errorNumberFor: aSymbol
given a symbolic error, return the numeric;
(i.e. errorNumberFor:#EBADF returns EBADF's value).
Use this, since error numbers are really not standard across unix systems.

o  errorStringForSymbol: errorSymbol
return an errorMessage for an errorSymbol
(as kept in an osErrorHolder).

o  errorSymbolAndTextForNumber: errNr
do not use - temporary for backward compatibility.
The returned message is in english (as found in /usr/include/errno.h)
and should be replaced by a resource lookup before being presented to the user.

o  errorSymbolForNumber: errNr
return a symbol for a unix errorNumber
(as returned by a system call).

o  errorTextForNumber: errNr
return a message string from a unix errorNumber
(as returned by a system call).
The returned message is in english (as found in /usr/include/errno.h)
and should be replaced by a resource lookup before being presented to the user.

o  lastErrorNumber
return the last errors number.
See also: #lastErrorSymbol and #lastErrorString.
Notice: having a single error number is a bad idea in a multithreaded
environment - this interface will change.

o  lastErrorString
return a message string describing the last error.
See also: #lastErrorNumber and #lastErrorSymbol.
Notice: having a single error number is a bad idea in a multithreaded
environment - this interface will change.

o  lastErrorSymbol
return a symbol (such as #EBADF or #EACCESS) describing the last error.
See also: #lastErrorNumber and #lastErrorString.
Notice: having a single error number is a bad idea in a multithreaded
environment - this interface will change.

executing OS commands-implementation
o  exec: aCommandPath withArguments: argArray environment: env fileDescriptors: fds fork: doFork newPgrp: newGrp inDirectory: aDirectory
execute an OS command

** This method raises an error - it must be redefined in concrete classes **

o  fork
fork a new (HEAVY-weight) unix process.
Not supported with MSDOS & VMS systems.
Dont confuse this with Block>>fork, which creates
lightweight smalltalk processes. This method will return
0 to the child process, and a non-zero number (which is the childs
unix-process-id) to the parent (original) process.

In normal situations, you dont need to use this low level entry; see
#startProcess: and #executCommand: for higher level interfaces.

o  startProcess: aCommandString inputFrom: anExternalInStream outputTo: anExternalOutStream errorTo: anExternalErrStream auxFrom: anExternalAuxStreamOrNil environment: environment inDirectory: dir
start executing the OS command as specified by the argument, aCommandString
as a separate process; do not wait for the command to finish.
The commandString is passed to a shell for execution - see the description of
'sh -c' in your UNIX manual ('cmd.com' in your MSDOS manual).
The command gets stdIn, stdOut and stdErr assigned from the arguments;
each may be nil.
Return the processId if successful, nil otherwise.
Use #monitorPid:action: for synchronization and exec status return,
or #killProcess: to stop it.

** This method raises an error - it must be redefined in concrete classes **

executing OS commands-private
o  shuffleAllFrom: anInStream to: anOutStream lineWise: lineWise lockWith: aLock

o  shuffleFrom: anInStream to: anOutStream lineWise: lineWise
copy data from anInStream to anOutStream.
Caller makes sure, than anInStream does not block.
anOutstream should have been set to non-blocking-mode

o  shuffleRestFrom: anInStream to: anOutStream lineWise: lineWise

o  startProcess: aCommandString
start executing the OS command as specified by the argument, aCommandString
as a separate process; do not wait for the command to finish.
The commandString is passed to a shell for execution - see the description of
'sh -c' in your UNIX manual.
Return the processId if successful, nil otherwise.
Use #waitForProcess: for synchronization and exec status return,
or #killProcess: to stop it.

o  startProcess: aCommandString inDirectory: aDirectory
start executing the OS command as specified by the argument, aCommandString
as a separate process; do not wait for the command to finish.
The commandString is passed to a shell for execution - see the description of
'sh -c' in your UNIX manual.
Return the processId if successful, nil otherwise.
Use #waitForProcess: for synchronization and exec status return,
or #killProcess: to stop it.

o  startProcess: aCommandString inputFrom: anExternalInStream outputTo: anExternalOutStream errorTo: anExternalErrStream
start executing the OS command as specified by the argument, aCommandString
as a separate process; do not wait for the command to finish.
The commandString is passed to a shell for execution - see the description of
'sh -c' in your UNIX manual ('cmd.com' in your MSDOS manual).
The command gets stdIn, stdOut and stdErr assigned from the arguments;
each may be nil.
Return the processId if successful, nil otherwise.
Use #monitorPid:action: for synchronization and exec status return,
or #killProcess: to stop it.

o  startProcess: aCommandString inputFrom: anExternalInStream outputTo: anExternalOutStream errorTo: anExternalErrStream auxFrom: anAuxiliaryStream inDirectory: dir

o  startProcess: aCommandString inputFrom: anExternalInStream outputTo: anExternalOutStream errorTo: anExternalErrStream inDirectory: dir
start executing the OS command as specified by the argument, aCommandString
as a separate process; do not wait for the command to finish.
The commandString is passed to a shell for execution - see the description of
'sh -c' in your UNIX manual ('cmd.com' in your MSDOS manual).
The command gets stdIn, stdOut and stdErr assigned from the arguments;
each may be nil.
Return the processId if successful, nil otherwise.
Use #monitorPid:action: for synchronization and exec status return,
or #killProcess: to stop it.

executing OS commands-public
o  executeCommand: aCommandString
execute the unix command specified by the argument, aCommandString.
The commandString is passed to a shell for execution - see the description of
'sh -c' in your UNIX manual.
Return true if successful, false otherwise.

o  executeCommand: aCommandString errorTo: errorStream
execute the unix command specified by the argument, aCommandString.
The commandString is passed to a shell for execution - see the description of
'sh -c' in your UNIX manual.
Return true if successful, false otherwise.

o  executeCommand: aCommandString errorTo: errorStream inDirectory: aDirectory
execute the unix command specified by the argument, aCommandString.
The commandString is passed to a shell for execution - see the description of
'sh -c' in your UNIX manual.
Return true if successful, false otherwise.

o  executeCommand: aCommandString inDirectory: aDirectory
execute the unix command specified by the argument, aCommandString.
The commandString is passed to a shell for execution - see the description of
'sh -c' in your UNIX manual.
Return true if successful, false otherwise.

o  executeCommand: aCommandString inDirectory: aDirectory onError: aBlock
execute the unix command specified by the argument, aCommandString.
The commandString is passed to a shell for execution - see the description of
'sh -c' in your UNIX manual.
Return true if successful, the value from aBlock if not.
If not successfull, aBlock is called with an OsProcessStatus
(containing the exit status) as argument.

o  executeCommand: aCommandString inputFrom: anInStream outputTo: anOutStream errorTo: anErrStream auxFrom: anAuxStream environment: environmentDictionary inDirectory: dirOrNil lineWise: lineWise onError: aBlock
execute the unix command specified by the argument, aCommandString.
The commandString is passed to a shell for execution - see the description of
'sh -c' in your UNIX manual.
Return true if successful, or the value of aBlock if not.
If not successfull, aBlock is called with an OsProcessStatus
(containing the exit status) as argument.
The given in, out and err streams may be arbitrary (Smalltalk-) streams;
if any is not an external stream (which is required by the command),
extra pipes and shuffler processes are created, which stuff the data into
those internal stream(s).
Nil stream args will execute the command connected to ST/X's standard input, output or
error resp. - i.e. usually, i/o will be from/to the terminal.

Set lineWise to true, if both error and output is sent to the same stream
and you don't want lines to be mangled. Set lineWise = false to
avoid vlocking on pipes

o  executeCommand: aCommandString inputFrom: anInStream outputTo: anOutStream errorTo: anErrStream auxFrom: anAuxStream inDirectory: dirOrNil lineWise: lineWise onError: aBlock

o  executeCommand: aCommandString inputFrom: inputStreamOrNil outputTo: outStreamOrNil errorTo: errStreamOrNil inDirectory: aDirectory
much like #executeCommand:, but changes the current directory
for the command. Since this is OS specific, use this instead of
hardwiring any 'cd ..' command strings into your applictions.

o  executeCommand: aCommandString inputFrom: anInStream outputTo: anOutStream errorTo: anErrStream inDirectory: dirOrNil lineWise: lineWise onError: aBlock
execute the unix command specified by the argument, aCommandString.
The commandString is passed to a shell for execution - see the description of
'sh -c' in your UNIX manual.
Return true if successful, the value from aBlock if not.
If not successfull, aBlock is called with an OsProcessStatus
(containing the exit status) as argument.
The given in, out and err streams may be arbitrary (Smalltalk-) streams;
if any is not an external stream (which is required by the command),
extra pipes and shuffler processes are created, which stuff the data into
those internal stream(s).
Nil stream args will execute the command connected to ST/X's standard input, output or
error resp. - i.e. usually, i/o will be from/to the terminal

o  executeCommand: aCommandString inputFrom: anInStream outputTo: anOutStream errorTo: anErrStream inDirectory: dirOrNil onError: aBlock
execute the unix command specified by the argument, aCommandString.
The commandString is passed to a shell for execution - see the description of
'sh -c' in your UNIX manual.
Return true if successful, the value from aBlock if not.
If not successfull, aBlock is called with an OsProcessStatus
(containing the exit status) as argument.
The given in, out and err streams may be arbitrary (Smalltalk-) streams;
if any is not an external stream (which is required by the command),
extra pipes and shuffler processes are created, which stuff the data into
those internal stream(s).
Nil stream args will execute the command connected to ST/X's input, output or
error resp. - i.e. i/o will be from/to the xterminal

o  executeCommand: aCommandString inputFrom: anInStream outputTo: anOutStream errorTo: anErrStream onError: aBlock
execute the unix command specified by the argument, aCommandString.
The commandString is passed to a shell for execution - see the description of
'sh -c' in your UNIX manual.
Return true if successful, the value from aBlock if not.
If not successfull, aBlock is called with an OsProcessStatus
(containing the exit status) as argument.

o  executeCommand: aCommandString onError: aBlock
execute the unix command specified by the argument, aCommandString.
The commandString is passed to a shell for execution - see the description of
'sh -c' in your UNIX manual.
Return true if successful, the value from aBlock if not.
If not successfull, aBlock is called with an OsProcessStatus
(containing the exit status) as argument.

o  executeCommand: aCommandString onError: aBlock inDirectory: aDirectory
OBSOLETE for backward compatibility.
execute the unix command specified by the argument, aCommandString.
The commandString is passed to a shell for execution - see the description of
'sh -c' in your UNIX manual.
Return true if successful, the value from aBlock if not.
If not successfull, aBlock is called with an OsProcessStatus
(containing the exit status) as argument.

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  executeCommand: aCommandString outputTo: anOutStreamOrNil
execute the unix command specified by the argument, aCommandString.
The commandString is passed to a shell for execution - see the description of
'sh -c' in your UNIX manual.
Return true if successful, false otherwise.

o  executeCommand: aCommandString outputTo: outStreamOrNil errorTo: errStreamOrNil inDirectory: aDirectory
much like #executeCommand:, but changes the current directory
for the command. Since this is OS specific, use this instead of
hardwiring any 'cd ..' command strings into your applictions.

o  getCommandOutputFrom: aCommand
execute a simple command (such as hostname) and
return the commands first line of output as a string (forget stdErr).
If the command generates multiple output lines, only the first line is returned.
If the commands does not generate any output, an empty string is returned;
if the command fails, nil is returned.

o  getCommandOutputFrom: aCommand maxNumberOfLines: numLinesOrNil errorDisposition: errorDisposition
execute a simple command (such as hostname) and
return the commands output as a collection of strings,
but only up to the given number of lines (if non-nil).
If the command generates more output, only the first nLines are returned
(but the command is allowed to finish execution).
If the commands does not generate any output, an empty string is returned;
if the command fails, nil is returned.
errorDisposition controls where the stdErr output should go,
and may be one of #discard, #inline or #stderr (default).
#discard causes stderr to be discarded (/dev/null),
#inline causes it to be written to smalltalks own stdout and
#stderr causes it to be written to smalltalks own stderr.
Nil is treated like #stderr

o  getFullCommandOutputFrom: aCommand
execute a command and
return the commands output as a collection of strings (ignoring stdErr).
If the commands does not generate any output, an empty string is returned;
if the command fails, nil is returned.

executing OS commands-queries
o  canExecuteCommand: aCommandString
return true, if the OS can execute aCommand.
For now, this only works with UNIX.

o  commandAndArgsForOSCommand: aCommandString
get a shell and shell arguments for command execution

** This method raises an error - it must be redefined in concrete classes **

o  executableFileExtensions
return a collection of extensions for executable program files.
Only req'd for msdos & vms like systems ...

o  nameOfSTXExecutable
return the name of the running ST/X executable program.
Usually, 'stx' is returned -
but may be different for standAlone apps (or winstx.exe).

o  pathOfCommand: aCommand
find where aCommand's executable file is;
return its full pathName if there is such a command, otherwise
return nil.

** This method raises an error - it must be redefined in concrete classes **

o  pathOfSTXExecutable
return the full path of the running ST/X executable program.
Usually, '.../stx' is returned -
but may be different for standAlone apps (or winstx.exe).

executing OS commands-wrappers
o  exec: aCommandPath withArguments: argArray
execute the OS command specified by the argument, aCommandPath, with
arguments in argArray (no arguments, if nil).
If successful, this method does NOT return and smalltalk is gone.
If not successful, it does return.
Can be used on UNIX with fork or on other systems to chain to another program.

o  exec: aCommandPath withArguments: argArray fileDescriptors: fileDescriptors fork: doFork newPgrp: newPgrp inDirectory: aDirectory

o  exec: aCommandPath withArguments: argArray fork: doFork
execute an OS command without I/O redirection.
The command reads its input and writes its output
from/to whatever terminal device ST/X was started
(typically, the terminal window)

o  exec: aCommandPath withArguments: argArray fork: doFork inDirectory: aDirectory
execute an OS command without I/O redirection.
The command reads its input and writes its output
from/to whatever terminal device ST/X was started
(typically, the terminal window)

file access
o  closeFd: anInteger
low level close of a filedescriptor

** This method raises an error - it must be redefined in concrete classes **

o  copyFromFd: inFd toFd: outFd startIndex: startIdx count: count
directly copy from one FD to another (if supported by the OS)

o  createDirectory: aPathName
create a new directory with name 'aPathName', which may be an absolute
path, or relative to the current directory.
Return true if successful (or the directory existed already), false if failed.
This is a low-level entry - use Filename protocol for compatibility.

** This method raises an error - it must be redefined in concrete classes **

o  createFileForReadAppend: pathName

** This method raises an error - it must be redefined in concrete classes **

o  createFileForReadWrite: pathName

** This method raises an error - it must be redefined in concrete classes **

o  createHardLinkFrom: oldPath to: newPath
link the file 'oldPath' to 'newPath'. The link will be a hard link.
Return true if successful, false if not.

o  createSymbolicLinkFrom: oldPath to: newPath
make a link from the file 'oldPath' to the file 'newPath'.
The link will be a soft (symbolic) link.
Return true if successful, false if not.

o  linkFile: oldPath to: newPath
link the file 'oldPath' to 'newPath'. The link will be a hard link.
Return true if successful, false if not.
This method has been renamed - it remains in existance for
backward compatibility.

o  openFileForAppend: pathName

** This method raises an error - it must be redefined in concrete classes **

o  openFileForRead: pathName

** This method raises an error - it must be redefined in concrete classes **

o  openFileForReadAppend: pathName

** This method raises an error - it must be redefined in concrete classes **

o  openFileForReadWrite: pathName

** This method raises an error - it must be redefined in concrete classes **

o  openFileForWrite: pathName

** This method raises an error - it must be redefined in concrete classes **

o  recursiveCopyDirectory: fullPathName to: destinationPathName
copy the directory named 'fullPathName' and all contained
files/directories recursively to destinationPathName.
Return true if successful.
Here, false is returned and the caller should be prepared
for a fallBack solution.
Notice:
this is not a public interface; instead, it is used
internally by the Filename class, to try a fast copy
before doing things manually.
Please use Filename recursiveCopyTo:

o  recursiveCreateDirectory: dirName
create a directory - with all parent dirs if needed.
Return true if successful, false otherwise. If false
is returned, a partial created tree may be left,
which is not cleaned-up here.

o  recursiveRemoveDirectory: fullPathName
remove the directory named 'fullPathName' and all contained files/directories.
Return true if successful.
Here, false is returned and the caller should be prepared
for a fallBack solution.
Notice:
this is not a public interface; instead, it is used
internally by the Filename class, to try a fast remove
before doing things manually.
Please use Filename recursiveRemoveDirectory:

o  removeDirectory: fullPathName
remove the directory named 'fullPathName'.
The directory must be empty and you must have appropriate access rights.
Return true if successful, false if directory is not empty or no permission.
This is a lowLevel entry - use Filename protocol for compatibility.

** This method raises an error - it must be redefined in concrete classes **

o  removeFile: fullPathName
remove the file named 'fullPathName'; return true if successful.
This is a lowLevel entry - use Filename protocol for compatibility.

** This method raises an error - it must be redefined in concrete classes **

o  renameFile: oldPath to: newPath
rename the file 'oldPath' to 'newPath'.
Someone else has to care for the names to be correct and
correct for the OS used - therefore, this should not be called
directlt. Instead, use Filename protocol to rename; this cares for
any invalid names.
Returns true if successful, false if not

** This method raises an error - it must be redefined in concrete classes **

o  truncateFile: aPathName to: newSize
change a files size return true on success, false on failure.
This may not be supported on all architectures.

This is a low-level entry - use Filename protocol.

** This method raises an error - it must be redefined in concrete classes **

file access rights
o  accessMaskFor: aSymbol
return the access bits mask for numbers as returned by
OperatingSystem>>accessModeOf:
and expected by OperatingSystem>>changeAccessModeOf:to:.
Since these numbers are OS dependent, always use the mask
(never hardcode 8rxxx into your code).

** This method raises an error - it must be redefined in concrete classes **

o  accessModeOf: aPathName
return a number representing access rights rwxrwxrwx for owner,
group and others. Return nil if such a file does not exist.
Notice that the returned number is OS dependent - use the
modeMasks as returned by OperatingSystem>>accessMaskFor:

o  changeAccessModeOf: aPathName to: modeBits
change the access rights of aPathName to the OS dependent modeBits.
You should construct this mask using accessMaskFor, to be OS
independent. Return true if changed,
false if such a file does not exist or change was not allowd.

** This method raises an error - it must be redefined in concrete classes **

file locking
o  lockFD: aFileDescriptor shared: isSharedReadLock blocking: blockIfLocked
set a lock on the file represented by aFileDescriptor.
(such as returned by ExternalStream>>fileDescriptor).
On some systems, only advisory locks are available -
these depends on other accessors to also perform the locking operation.
If they do not, they may still access the file
(on some systems, locks are mandatory, on others, they are advisory).
The isSharedReadLock argument (if true) specifies if multiple readers
are to be allowed - if false, they are not.
On some systems, all locks are non-exclusive locks.

Returns true, if the lock was aquired, false otherwise.

Notice, that not all OS's support these locks;
on some, this may simply be a no-op.
Also notice, that some systems block the process, to wait for the lock.
This can (again: on some systems) be avoided by passing a false blockIfLocked
argument.

o  supportsFileLinks
return true, if the OS supports file links (hard links).
Typically, only unix returns true here.

o  supportsFileLocks
return true, if the OS supports file locking

o  supportsNonBlockingFileLocks
return true, if the OS supports nonBlocking file locking
(i.e. with immediate return instead of waiting for the lock)

o  supportsSharedLocks
return true, if the OS supports shared (i.e. multiple reader)
file locking. Assume false here - redefined in concrete classes.

o  supportsSymbolicLinks
return true, if the OS supports symbolic links on files/directories.
Typically, only Unix returns true here

o  unlockFD: aFileDescriptor
clear a file lock on the file represented by aFileDescriptor,
which was previously aquired by #lockFD:.
Return false, if the unlock failed
(which may happens when a wrong fd is passed,
no lock was set previously, or the systsem does not support locks).
Notice, that not all OS's support file locks;
on some, this may simply be a no-op.

file queries
o  caseSensitiveFilenames
return true, if the OS has caseSensitive file naming.
On MSDOS, this will return false;
on a real OS, we return true.

** This method raises an error - it must be redefined in concrete classes **

o  compressPath: pathName
return the pathName compressed - that is, remove all ..-entries
and . entries. This does not always (in case of symbolic links)
return the true pathName and is therefore used as a fallback
if realPath and popen failed.

** This method raises an error - it must be redefined in concrete classes **

o  directoryNameOf: aPath

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  fileSeparator
return the character used to separate names in a path.
This character differs for MSDOS and other systems,
(but those are currently not supported - so this is some
preparation for the future)

o  getDiskInfoOf: aDirectoryPath
return some disk info.
The amount of information returned depends upon the OS, and is
not guaranteed to be consistent across architectures.
On unix and msdos, the information returned is (at least):
freeBytes
totalBytes
Do not depend on any information being present in the returned dictionary;
users of this method should always use #at:ifAbsent:, and care for the absent case.
Nil is returned if no such information can be obtained.

o  getDriveList
return a list of volumes in the system.
On unix, no such thing like a volume exists
- there, a syntetic list with root, home & current is returned.
On MSDOS, a list of drive letters is (eventually) returned.
On VMS, a list of volumes is (eventually) returned.

o  getMountedVolumes
return info about mounted volumes.
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

o  getNullDevice
get the name of the null-device. Nil is returned if not supported

o  idOf: aPathName
return the fileNumber (i.e. inode number) of a file.

Not all operatingSystems may provide this - on those that do not,
some dummy id will be returned.
On unix, this information can be used to check for two files being
physically identical, even if found in different directories
(i.e. if they are hardLinked).

o  infoOf: aPathName
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)

Some of the fields may be returned as nil on systems which do not provide
all of the information.
Return nil if such a file does not exist.
For symbolic links (if supported by the OS),
the info of the pointed-to-file (i.e. the target) is returned;
use #linkInfoOf: to get info about the link itself.


** This method raises an error - it must be redefined in concrete classes **

o  isDirectory: aPathName
return true, if 'aPathName' is a valid directory path name.
(i.e. exists and is a directory).
This also returns true for symbolic links pointing to a directory;
if you need to check for this, use #linkInfo:.

o  isExecutable: aPathName
return true, if the given file is executable.
For symbolic links, the pointed-to-file is checked.

** This method raises an error - it must be redefined in concrete classes **

o  isMountPoint: aPathName
return true, if the given file is a mounted fileSystems mountPoint

o  isReadable: aPathName
return true, if the file/dir 'aPathName' is readable.
For symbolic links, the pointed-to-file is checked.

** This method raises an error - it must be redefined in concrete classes **

o  isSymbolicLink: aPathName
return true, if the given file is a symbolic link

o  isValidPath: aPathName
return true, if 'aPathName' is a valid path name
(i.e. the file or directory exists)

** This method raises an error - it must be redefined in concrete classes **

o  isWritable: aPathName
return true, if the given file is writable.
For symbolic links, the pointed-to-file is checked.

** This method raises an error - it must be redefined in concrete classes **

o  linkInfoOf: aPathName
return a dictionary filled with info for the file 'aPathName',
IFF aPathName is a symbolic link.
If aPathName is invalid, or its NOT a symbolic link, nil is returned.
(which means, that systems like VMS or MSDOS always return nil here.)

The contents of the dictionary gives info about the link itself,
on contrast to #infoOf:, which returns the info of the pointed to file
in case of a symbolic link.

** This method raises an error - it must be redefined in concrete classes **

o  mimeTypeForFilename: aFilename
given a filename, return a corresponding mimeType.
This is placed here, to allow for OS-specific configuration
files and/or the win32 registry to be consultet.
Returns nil if no mimeType for the given name is known.

o  mimeTypeForSuffix: aFileSuffix
given a file suffix, return a corresponding mimeType.
This is placed here, to allow for OS-specific configuration
files and/or the win32 registry to be consultet.
Returns nil if no mimeType for the given suffix is known.

o  mountPoints
return a collection of mountPoints (aka. topDirectories of mounted file systems)

o  parentDirectoryName
return the name used to refer to parent directories.
In MSDOS, Unix and other systems this is '..', but maybe different
for other systems.
(but those are currently not supported - so this is some
preparation for the future)

o  pathNameOf: pathName
return the pathName of the argument, aPathString,
- thats the full pathname of the directory, starting at '/'.
This method needs the path to be valid
(i.e. all directories must exist, be readable and executable).
Notice: if symbolic links are involved, the result may look different
from what you expect.

** This method raises an error - it must be redefined in concrete classes **

o  primIdOf: aPathName
the actual code to return the fileNumber (i.e. inode number) of a file.

** This method raises an error - it must be redefined in concrete classes **

o  primPathNameOf: pathName
return the pathName of the argument, aPathString,
- thats the full pathname of the directory, starting at '/'.
This method here returns nil, if the OS does not provide a
realPath library function.
Notice: if symbolic links are involved, the result may look different
from what you expect.

** This method raises an error - it must be redefined in concrete classes **

o  timeOfLastAccess: aPathName
return the time, when the file was last accessed.
For nonexistent files, nil is returned.

o  timeOfLastChange: aPathName
return the time, when the file was last changed.
For nonexistent files, nil is returned.

o  typeOf: aPathName
return the type of a file as a symbol; for nonexistent files,
nil is returned.
Notice: for symbolic links, the type of the pointed-to file is returned.

o  volumeNameOf: aPathString
return the volumeName of the argument, aPath
- thats the name of the volume where aPath is.
Not all OperatingSystems support/use volumes; on unix,
this always returns an empty string.

initialization
o  initResources
allow for ResourcePack class to be missing (non-GUI smalltalks)

o  initialize
initialize the class

o  initializeConcreteClass

interprocess communication
o  createCOMFileForVMSCommand: aCommandString in: aDirectory
this is only implemented/required for VMS systems, to execute commands

o  createMailBox
this is only implemented/required for VMS systems, to emulate pipes

o  destroyMailBox: mbx
this is only implemented/required for VMS systems, to emulate pipes

o  mailBoxNameOf: mbx
this is only implemented/required for VMS systems, to emulate pipes

o  makeBidirectionalPipe
answer an array with 2 filedescriptors representing
the two ends of a bidirectional pipe - see also #makePipe

** This method raises an error - it must be redefined in concrete classes **

o  makePipe
answer an array with 2 filedescriptors representing
the two ends of a unidirectional pipe- see also #makeSocketPair

** This method raises an error - it must be redefined in concrete classes **

o  shutdownBidirectionalPipeOutput: fileDescriptor
inform the other end of the bidirectional pipe represented by fileDescriptor, that
we will send no more data to the pipe, i.e. EOF is reached

** This method raises an error - it must be redefined in concrete classes **

interrupts & signals
o  blockInterrupts
disable interrupt processing - if disabled, incoming
interrupts will be registered and handled as soon as
interrupts are reenabled by OperatingSystemclass>>unblockInterrupts.
Returns the previous blocking status i.e. true if interrupts
where already blocked. You need this information for proper
unblocking, in case of nested block/unblock calls.

o  defaultSignal: signalNumber
revert to the default action on arrival of a (Unix-)signal.
Dont confuse Unix signals with smalltalk signals.
WARNING: for some signals, it is no good idea to revert to default;
for example, the default for SIGINT (i.e. ^C) is to exit; while the
default for SIGQUIT (^ \) is to dump core.
Also, NOTICE that signal numbers are not portable between unix
systems - use OperatingSystem sigXXX to get the numeric value for
a signal.

** This method raises an error - it must be redefined in concrete classes **

o  disableChildSignalInterrupts
disable childSignal interrupts
(SIGCHLD, if the architecture supports it).
We have to set the signal back to default, because ignoring
SIGCHLD breaks wait & co

o  disableIOInterruptsOn: fd
turn off IO interrupts for a filedescriptor

** This method raises an error - it must be redefined in concrete classes **

o  disableSignal: signalNumber
disable (Unix-) signal processing for signalNumber.
Dont confuse Unix signals with smalltalk signals.
WARNING: for some signals, it is no good idea to disable
them; for example, disabling the SIGINT signal turns off ^C
handling.
Also, NOTICE that signal numbers are not portable between unix
systems - use OperatingSystem sigXXX to get the numeric value for
a signal.
Use only for fully debugged stand alone applications.

** This method raises an error - it must be redefined in concrete classes **

o  disableTimer
disable timer interrupts.
WARNING:
the system will not operate correctly with timer interrupts
disabled, because no scheduling or timeouts are possible.

** This method raises an error - it must be redefined in concrete classes **

o  disableUserInterrupts
disable userInterrupt processing;
when disabled, no ^C processing takes place.
WARNING:
If at all, use this only for debugged stand-alone applications, since
no exit to the debugger is possible with user interrupts disabled.
We recommend setting up a handler for the signal instead of disabling it.

o  enableAbortInterrupts
enable abort signalhandling, and make it a regular signalInterrupt.
(the default will dump core and exit - which is not a good idea for
end-user applications ...).
This is especially useful, if linked-in C-libraries call abort() ...

o  enableChildSignalInterrupts
enable childSignal interrupts
(SIGCHLD, if the architecture supports it).
After enabling, these signals will send the message
'childSignalInterrupt' to the ChildSignalInterruptHandler object.

o  enableCrashSignalInterrupts
enable powerFail signal exception interrupts (sigPWR).
After enabling, this signal will trigger the writing of a crash-image

o  enableFpExceptionInterrupts
enable floating point exception interrupts (if the
architecture supports it).
After enabling, fpu-exceptions will send the message
'fpuExceptionInterrupt' to the FPUExceptionInterruptHandler object.

o  enableHardSignalInterrupts
enable hard signal exception interrupts (trap, buserror & segm. violation).
After enabling, these exceptions will send the message
'signalInterrupt' to the SignalInterruptHandler object.

o  enableIOInterruptsOn: fd
turn on IO interrupts for a filedescriptor

o  enableQuitInterrupts
enable quitInterrupt (usually ^\) handling, and make it a userInterrupt.
(the default will dump core and exit - which is not a good idea for
end-user applications ...)

o  enableSignal: signalNumber
enable (Unix-)signal processing for signalNumber.
Don't confuse Unix signals with smalltalk signals.
The signal will be delivered to one of the standard handlers
(SIGINT, SIGQUIT, etc) or to a general handler, which
sends #signalInterrupt:.

NOTICE that signal numbers are not portable between unix
systems - use OperatingSystem sigXXX to get the numeric value for
a signal.

** This method raises an error - it must be redefined in concrete classes **

o  enableTimer: milliSeconds
setup for a timerInterrupt, to be signalled after some (real) time.

o  enableUserInterrupts
enable userInterrupt (^C) handling;
when enabled, ^C in the terminal window will send the message
'userInterrupt' to the UserInterruptHandler object.

o  interruptPending
return true, if an interrupt is pending. The returned value is
invalid if interrupts are not currently blocked, since otherwise
the interrupt is usually already handled before arriving here,
or may be served while returning from here.

o  interruptsBlocked
return true, if interrupt handling is currently disabled;
false otherwise.

o  isFatalSignal: aNumber
return true if a signal with number aNumber is a fatal signal,
i.e. some severe internal error occured

** This method raises an error - it must be redefined in concrete classes **

o  killProcess: processId
kill an OS process.
The process has a no chance to do some cleanup.

WARNING: in order to avoid zombie processes (on unix),
you may have to fetch the processes exitstatus with
OperatingSystem>>getStatusOfProcess:aProcessId.

** This method raises an error - it must be redefined in concrete classes **

o  killProcessGroup: processGroupId
kill an OS process group.
The process has NO chance to do some cleanup.

WARNING: in order to avoid zombie processes (on unix),
you may have to fetch the processes exitstatus with
OperatingSystem>>getStatusOfProcess:aProcessId.

** This method raises an error - it must be redefined in concrete classes **

o  nameForSignal: aSignalNumber
for a given Unix signalnumber, return a descriptive string

o  operatingSystemSignal: signalNumber
return the signal to be raised when an
operatingSystem-signal occurs, or nil

o  operatingSystemSignal: signalNumber install: aSignal
install a signal to be raised when an operatingSystem-signal occurs

o  sendSignal: signalNumber to: processId
send a unix signal to some process (maybe myself).
Returns false if any error occurred, true otherwise.

Do not confuse UNIX signals with Smalltalk-Signals.

** This method raises an error - it must be redefined in concrete classes **

o  startSpyTimer
trigger a spyInterrupt, to be signalled after some short (virtual) time.
Return true, if the spy-timerInterrupt was enabled.
This was used by the old MessageTally for profiling.
On systems, where no virtual timer is available, use the real timer
(which is of course less correct).
OBSOLETE: the new messageTally runs as a high prio process, not using
spy interrupts.

o  stopSpyTimer
stop spy timing - disable spy timer.
OBSOLETE: the new messageTally runs as a high prio process, not using
spy interrupts.

o  terminateProcess: processId
terminate a unix process.
The process has a chance to do some cleanup.

WARNING: in order to avoid zombie processes (on unix),
you may have to fetch the processes exitstatus with
OperatingSystem>>getStatusOfProcess:aProcessId.

** This method raises an error - it must be redefined in concrete classes **

o  terminateProcessGroup: processGroupId
terminate a unix process group.
The process has a chance to do some cleanup.

WARNING: in order to avoid zombie processes (on unix),
you may have to fetch the processes exitstatus with
OperatingSystem>>getStatusOfProcess:aProcessId.

** This method raises an error - it must be redefined in concrete classes **

o  unblockInterrupts
enable interrupt processing - if any interrupts are pending,
these will be handled immediately.
When unblocking interrupts, take care of nested block/unblock
calls - you must only unblock after a blockcall if they where
really not blocked before. See OperatingSystemclass>>blockInterrupts.

misc
o  closePid: pid
free pid resource

** This method raises an error - it must be redefined in concrete classes **

o  exit
shutdown smalltalk immediately - this method does not return.
Return 'good'-status (0) to the parent unix process.

o  exit: exitCode
shutdown smalltalk immediately -
returning an exit-code to the parent unix process.

o  exitWithCoreDump
shutdown smalltalk immediately - dumping core.
This always returns 'bad'-status to the parent unix process.
Notice, that no cleanup is performed at all - you may have to
manually remove any tempfiles.
Use this only for debugging ST/X itself

o  getVMSSymbol: aSymbolString
get a symbols value, or nil if there is none

o  playSound: fileName
unsupported - simply stay silent

o  playSound: fileName mode: modeInteger
unsupported - simply stay silent

obsolete
o  baseNameOf: aPath

** This is an obsolete interface - do not use it (it may vanish in future versions) **

os queries
o  getCCDefine
return a string which was used to identify the C-Compiler used
when STX was compiled, and which should be passed down when compiling methods.
For example, on linux, this is '__GNUC__';
on windows, this is either '__MSC__' or '__BORLANDC__'

o  getCPUDefine
return a string which was used to identify this CPU type when STX was
compiled, and which should be passed down when compiling methods.
For example, on linux, this may be '-Di386'; on a vax, this would be '-Dvax'.
This is normally not of interest to 'normal' users; however, it is passed
down to the c-compiler when methods are incrementally compiled to machine code.

o  getCPUType
return a string giving the type of machine we're running on.
Here, the machine for which ST/X was compiled is returned
(i.e. for all x86's, the same i386 is returned).
This may normally not be of any interest to you ...

o  getDomainName
return the domain this host is in.
Notice:
not all systems support this; on some, 'unknown' is returned.

** This method raises an error - it must be redefined in concrete classes **

o  getEnvironment: aStringOrSymbol
get an environment string

** This method raises an error - it must be redefined in concrete classes **

o  getHostName
return the hostname we are running on - if there is
a HOST environment variable, we are much faster here ...
Notice:
not all systems support this; on some, 'unknown' is returned.

** This method raises an error - it must be redefined in concrete classes **

o  getLanguage
get the LANGUAGE setting (example: de_DE.iso8859-15@euro)

o  getLocaleInfo
return a dictionary filled with values from the locale information;
Not all fields may be present, depending on the OS's setup and capabilities.
Possible fields are:
decimalPoint <String>

thousandsSep <String>

internationalCurrencySymbol <String>

currencySymbol <String>

monetaryDecimalPoint <String>

monetaryThousandsSeparator <String>

positiveSign <String>

negativeSign <String>

internationalFractionalDigits <Integer>

fractionalDigits <Integer>

positiveSignPrecedesCurrencySymbol <Boolean>

negativeSignPrecedesCurrencySymbol <Boolean>

positiveSignSeparatedBySpaceFromCurrencySymbol <Boolean>

negativeSignSeparatedBySpaceFromCurrencySymbol <Boolean>

positiveSignPosition <Symbol>
one of: #parenthesesAround,
#signPrecedes,
#signSuceeds,
#signPrecedesCurrencySymbol,
#signSuceedsCurrencySymbol

negativeSignPosition <like above>

it is up to the application to deal with undefined values.

Notice, that (for now), the system does not use this information;
it should be used by applications as required.


** This method raises an error - it must be redefined in concrete classes **

o  getNetworkAddresses
return a dictionary with key:name of interface and
value:the network address for each interface

** This method raises an error - it must be redefined in concrete classes **

o  getNetworkMACAddresses
return a dictionary with key:name of interface and
value:the MAC adress for each interface

** This method raises an error - it must be redefined in concrete classes **

o  getNetworkMACAddressesForIf: ifName
return the MAC adress for interface ifName

o  getNumberOfProcessors
answer the number of physical processors in the system

** This method raises an error - it must be redefined in concrete classes **

o  getOSDefine
return a string which was used to identify this machine when stx was
compiled, and which should be passed down when compiling methods.
For example, on linux, this is '-DLINUX'.

o  getOSType
return a string giving the type of OS we're running on.
This can be used to adapt programs to certain environment
differences (for example: mail-lock strategy ...)

o  getPlatformDefine
return a string which defines the platform,
and which should be passed down when compiling methods.
For example, on all unices, this is '-DUNIX'.

o  getProcessId
return the (unix-)processId

** This method raises an error - it must be redefined in concrete classes **

o  getSystemID
if supported by the OS, return the systemID;
a unique per machine identification.
WARNING:
not all systems support this; on some, 'unknown' is returned.

o  getSystemInfo
return info on the system weare running on.
If the system supports the uname system call, that info is returned;
otherwise, some simulated info is returned.

WARNING:
Do not depend on the amount and contents of the returned information, some
systems may return more/less than others. Also, the contents depends on the
OS, for example, linux returns 'ix86', while WIN32 returns 'x86'.

This method is mainly provided to augment error reports with some system
information.
(in case of system/version specific OS errors, conditional workarounds and patches
may be based upon this info).
Your application should NOT depend upon this in any way.

The returned info may (or may not) contain:
#system -> some operating system identification (irix, Linux, nt, win32s ...)
#version -> OS version (some os version identification)
#release -> OS release (3.5, 1.2.1 ...)
#node -> some host identification (hostname)
#domain -> domain name (hosts domain)
#machine -> type of machine (i586, mips ...)

o  getSystemType
return a string giving the type of system we're running on.
This is almost the same as getOSType, but the returned string
is slightly different for some systems (i.e. iris vs. irix).
Dont depend on this - use getOSType. I dont really see a point
here ...
(except for slight differences between next/mach and other machs)

o  getWindowsDirectory
internal interface - only for Windows based systems.
Return the windows directory, which, depending on the system,
may be
'\WINNT', '\WINDOWS'
or whatever.
On non-windows systems, nil is returned.

o  getWindowsSystemDirectory
internal interface - only for Windows based systems.
Return the windows system directory, which, depending on the system,
may be
'\WINNT\SYSTEM32', '\WINDOWS\SYSTEM'
or whatever.
On non-windows systems, nil is returned.

o  hasConsole
return true, if there is some kind of console available
(i.e. for proper stdIn, stdOut and stdErr handling).
This only returns false when running under windows, and
the system is running as a pure windows application.
If false, the miniDebugger is useless and not used.

o  isBSDlike
return true, if the OS we're running on is a 'real' unix.

o  isMAClike
return true, if running on a macOS (but not on A/UX or OS/X)

o  isMSDOSlike
return true, if the OS we're running on is msdos like (in contrast to unix-like).
This returns true for any of msdos, win32s, win95, winNT and os/2.

o  isMSWINDOWSNTlike
This returns true if running in a Windows-NT system.

o  isMSWINDOWSlike
return true, if running on a MS-Windows like system.
This returns true for any of win32s, win95 and winNT.

o  isOS2like
return true, if the OS we're running on is OS2 like.
Only returns true for a plain OS/2 system.

o  isProcessIdPresent: pid
answer true, if a process with process id pid is present, false if not.
Raise an error, if an exception occures

** This method raises an error - it must be redefined in concrete classes **

o  isUNIXlike
return true, if the OS we're running on is a unix like.

o  isVMSlike
return true, if the OS we're running in is VMS (or openVMS).

o  knownPlatformNames
return a collection of strings as possibly returned by getPlatformName.
Should be used instead of getOSType or getSystemType if multiple choice
dialogs are presented to the user.

o  maxFileNameLength
return the max number of characters in a filename.
CAVEAT:
Actually, the following is somewhat wrong - some systems
support different sizes, depending on the volume.
We return a somewhat conservative number here.
Another entry, to query for volume specific max
will be added in the future.

** This method raises an error - it must be redefined in concrete classes **

o  maxNumberOfOpenFiles
answer the maximum number of open files for this process

** This method raises an error - it must be redefined in concrete classes **

o  maxPathLength
return the max number of characters in a pathName.

** This method raises an error - it must be redefined in concrete classes **

o  pathSeparator
return the character which separates items in the PATH variable

** This method raises an error - it must be redefined in concrete classes **

o  platformDefineForPlatformName: osID
return a c-define for a particular platform (use only for makefile generation etc.)

o  platformName
return a string describing the OS platform very we're running on.
This returns #unix for all unix derivatives.
I.e. it is much less specific than getOSType or getSystemType.

o  randomBytesInto: bufferOrInteger
If bufferOrInteger is a String or a ByteArray,
fill a given buffer with random bytes from the RtlGenRandom function
and nswer the buffer.

If bufferOrInteger is a SmallInteger,
return this many bytes (max 4) as a SmallInteger.

Return nil on error (may raise PrimitiveFailure, too).

NOTE: This is a private interface, please use RandomGenerator!

Subclasses should implement this, if the OperatingSystem supports a random generator.

o  setEnvironment: aStringOrSymbol to: newValueString
set an environment variable

** This method raises an error - it must be redefined in concrete classes **

o  setLocaleInfo: anInfoDictionary
set the locale information; if set, this oerrides the OS's settings.
(internal in ST/X only - the OS's settings remain unaffected)
See description of fields in #getLocaleInfo.

Notice, that (for now), the system does not use this information;
it should be used by applications as required.

o  supportsChildInterrupts
return true, if the OS supports childProcess termination signalling
through interrupts (i.e. SIGCHILD)

o  supportsFileOwnerGroups
return true, if the OS's file system supports file
group ownership - here, we are optimistic assuming that
we are running under a real OS.
Redefined in Win32OS to return false.

o  supportsFileOwners
return true, if the OS's file system supports file
ownership - here, we are optimistic assuming that
we are running under a real OS.
Redefined in Win32OS to return false.

o  supportsIOInterrupts
return true, if the OS supports IO availability interrupts
(i.e. SIGPOLL/SIGIO).

o  supportsNonBlockingIO
return true, if the OS supports nonblocking IO.

o  supportsSelect
return true, if the OS supports selecting on multiple
filedescriptors via select.
If false is returned, ProcessorScheduler will poll in 50ms
intervals for I/O becoming ready.

o  supportsSelectOnPipes
return true, if the OS supports selecting on pipe
filedescriptors via select.
If false is returned, ProcessorScheduler will poll in 50ms
intervals for I/O becoming ready.

o  supportsSelectOnSockets
return true, if the OS supports selecting on socket
filedescriptors via select.
If false is returned, ProcessorScheduler will poll in 50ms
intervals for I/O becoming ready.

o  supportsVolumes
return true, if the OS supports disk volumes.
False is returned for UNIX, true for MSDOS and VMS

path queries
o  defaultPackagePath
return a default packagePath - thats a collection of
dirnames, where ST/X searches for its package subdirs.
This method might be redefined in concrete OS's to add
OS-specific directory names.

o  defaultSystemPath
return a default systemPath - thats a collection of
dirnames, where ST/X searches for its files.
This method is redefined in concrete OS's to add
OS-specific directory names.

printing support
o  getPrinters
return a collection of PrinterInfos

** This method raises an error - it must be redefined in concrete classes **

private
o  osProcessStatusClass

** This method raises an error - it must be redefined in concrete classes **

queries-sockets
o  domainCodeOf: aSymbolOrInteger
return the numeric AF_xxx code of a given symbolic domain name.
Return nil for invalid or unsupported domains.
For backward compatibility, the obsolete (non-AF-prefixed) names
are still supported for a while - this support will vanish.

o  domainSymbolOf: anInteger
return the symbolic domainName of a given numeric AF_xxx code.
Return nil for invalid or unsupported domains.

o  protocolCodeOf: aSymbolOrInteger
return the numeric IPPROTO_xxx code of a given symbolic protocol name.
Return nil for invalid or unsupported protocols.
For backward compatibility, the obsolete (non-IPPROTO-prefixed) names
are still supported for a while - this support will vanish.

o  protocolSymbolOf: anInteger
return the symbolic protocolName of a given numeric IPPROTO_xxx code.
Return nil for invalid or unsupported protocols.

o  socketAddressSizeOfDomain: aSymbolOrInteger
Return the os-specific size of a socket address for a domain aSymbolOrInteger.
Return nil, if unknown or unsupported.

o  socketTypeCodeOf: aSymbolOrInteger
return the numeric SOCK_xxx code of a given symbolic socket type name.
Return nil for invalid or unsupported socket types.

o  socketTypeSymbolOf: anInteger
return the symbolic typeName of a given numeric SOCK_xxx socket type code.
Return nil for invalid or unsupported socket types.

o  supportedProtocolFamilies
return a collection of supported protocol families.
This list specifies what the Socket class supports -
socket creation may still fail, if your system was built without it.
For backward compatibility, the returned list includes the old
(non-AF-prefixed) symbols; these will vanish.

o  supportedSocketTypes
return the symbolic typeName of a given numeric SOCK_xxx socket type code.
Return nil for invalid or unsupported socket types.

shared memory access
o  shmAttach: id address: addr flags: flags
low level entry to shmat()-system call.
Not supported on all operatingSystems

o  shmDetach: addr
low level entry to shmdt()-system call.
Not supported on all operatingSystems

o  shmGet: key size: size flags: flags
low level entry to shmget()-system call.
This is not for public use and not supported with all operatingSystems.
- use the provided wrapper class SharedExternalBytes instead.

time and date
o  computeDatePartsOf: osTime for: aBlock
compute year, month and day from the OS time, osTime
and evaluate the argument, a 3-arg block with these.
Conversion is to localtime including any daylight saving adjustments.

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  computeOSTimeFromUTCYear: y month: m day: d hour: h minute: min second: s millisecond: millis
return the OS-dependent time for the given time and day.
The arguments are assumed to be in UTC Time

** This method raises an error - it must be redefined in concrete classes **

o  computeOSTimeFromYear: y month: m day: d hour: h minute: min seconds: s millis: millis
return the OS-dependent time for the given time and day.
The arguments are assumed to be in localtime including
any daylight saving adjustings.

** This method raises an error - it must be redefined in concrete classes **

o  computeTimeAndDateFrom: osTime
given an OS-dependent time in osTime, return an Array
containing (full-) year, month, day, hour, minute and seconds,
offset to UTC, daylight savings time flag, milliseconds,
dayInYear (1..) and dayInWeek (1..).
Conversion is to localtime including any daylight saving adjustments.

o  computeTimePartsOf: osTime for: aBlock
compute hours, minutes, seconds and milliseconds from the local osTime
and evaluate the argument, a 4-arg block with these.
Conversion is to localtime including any daylight saving adjustments.

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  computeUTCTimeAndDateFrom: osTime
given an OS-dependent time in osTime, return an Array
containing:
(full-) year,
month, (1..)
day, (1..)
hour, (0..23)
minute (0..59)
seconds, (0..59)
offset to UTC, (seconds)
daylight savings time flag,
milliseconds, (0..999)
dayInYear (1..)
dayInWeek (1..).
Conversion is to utc.

o  computeUTCTimePartsOf: osTime for: aBlock
compute hours, minutes, seconds and milliseconds from the osTime
and evaluate the argument, a 4-arg block with these.
Conversion is to UTC.

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  getMicrosecondTime
This returns the microsecond timers value - if available.
On some machines, times with this precision may not be available,
on those, the returned value may be rounded towards some internal
clock resolution value.

o  getMillisecondTime
This returns the millisecond timers value.
The range is limited to 0..1fffffff (i.e. the SmallInteger range) to avoid
LargeInteger arithmetic when doing timeouts and delays.
Since this value is wrapping around in regular intervals, this can only be used for
short relative time deltas.
Use the millisecondTimeXXX:-methods to compare and add time deltas - these know about the wrap.

BAD DESIGN:
This should be changed to return some instance of RelativeTime,
and these computations moved there.

Dont use this method in application code since it is an internal (private)
interface. For compatibility with ST-80, use Time millisecondClockValue.


** This method raises an error - it must be redefined in concrete classes **

o  getOSTime
This returns the OS time.
The base of the returned value is not consistent across
different OS's - some return the number of millis since jan, 1st 1970;
others since 1900. The Time classes are prepared for this, and
converts as appropriate (by using my fromOSTime: conversion methods).

Dont use this method in application code since it is an internal (private)
interface. For compatibility with ST-80, use Time>>millisecondClockValue.
or use instances of Time, Date or Timestamp to work with.


** This method raises an error - it must be redefined in concrete classes **

o  maximumMillisecondTimeDelta
this returns the maximum delta supported by millisecondCounter
based methods. The returned value is half the value at which the
timer wraps.

o  millisecondDelay: millis
delay execution for millis milliseconds or until the next event arrives.
All other threads proceed as usual.
Better use a Delay, however, a delay cannot be used in the event handler or scheduler.

o  millisecondTime: msTime1 isAfter: msTime2
return true if msTime1 is after msTime2, false if not.
The two arguments are supposed to be millisecond times
(such as returned getMillisecondTime) which wrap at 16r1FFFFFFF.

This should really be moved to some RelativeTime class.

o  millisecondTimeAdd: msTime1 and: msTime2
Add two millisecond times (such as returned getMillisecondTime).
The returned value is msTime1 + msTime2 where a wrap occurs at:16r1FFFFFFF.

This should really be moved to some RelativeTime class.

o  millisecondTimeDeltaBetween: msTime1 and: msTime2
subtract two millisecond times (such as returned getMillisecondTime)
and return the difference. Since milli-times wrap (at 16r01FFFFFFF),
some special handling is built-in here.
The returned value is msTime1 - msTime2. The returned value is invalid
if the delta is >= 0x10000000.

This should really be moved to some RelativeTime class;
better yet: create a subclass of Integer named LimitedRangeInteger.

o  sleep: numberOfSeconds
cease ANY action for some time. This suspends the whole smalltalk
(unix-) process for some time.
Not really useful since not even low-prio processes and interrupt
handling will run during the sleep.
Use either OperatingSystem>>millisecondDelay: (which makes all
threads sleep, but handles interrupts) or use a Delay (which makes
only the calling thread sleep).

** This method raises an error - it must be redefined in concrete classes **

o  timeInfoClass

o  timeInfoFromSeconds: osSeconds localTime: isLocalTime
return a timeInfo structure containing values for the given OS-second value.
An internal helper

o  timeInfoFromSeconds: osSeconds milliseconds: osMilliSeconds localTime: isLocalTime
return a timeInfo structure containing values for the given OS-second value.
An internal helper

** This method raises an error - it must be redefined in concrete classes **

users & groups
o  getDesktopDirectory
return the name of the users desktop directory.
The fallback here returns the users home directory.

o  getDocumentsDirectory
return your documents directory.
Under windows, thats the real 'Documents' or 'My Documents'.
The fallback here returns the users home directory.

o  getEffectiveGroupID
return the current users (thats you) effective numeric group id.
This is only different from getGroupID, if you have ST/X running
as a setuid program (of which you should think about twice).

o  getEffectiveUserID
return the current users (thats you) effective numeric user id.
This is only different from getUserID, if you have ST/X running
as a setuid program (of which you should think about twice).

o  getFullUserName
return a string with the users full name (thats you) - if available.
If not, return the login name as a fallBack.

o  getFullUserNameFromID: userID
return a string with the users full name - if available.
If not, return the login name as a fallBack.

o  getGroupID
return the current users (thats you) numeric group id

o  getGroupNameFromID: aNumber
return the group-name-string for a given numeric group-id

o  getHomeDirectory
return the name of the users home directory
(i.e. yours)

** This method raises an error - it must be redefined in concrete classes **

o  getLoginName
return a string with the users login name (thats yours)

** This method raises an error - it must be redefined in concrete classes **

o  getUserID
return the current users (thats you) numeric user id

o  getUserNameFromID: aNumber
return the user-name-string for a given numeric user-id.
This is the login name, not the fullName.

o  userInfoOf: aNameOrID
return a dictionary filled with userinfo. The argument can be either
a string with the users name or its numeric id.
Notice, that not all systems provide (all of) this info;
DOS systems return nothing;
non-SYSV4 systems have no age/comment.
Portable applications may want to check the systemType and NOT depend
on all keys to be present in the returned dictionary.
Another notice: on some systems (SYSV4), the gecos field includes multiple
entries (i.e. not just the name), separated by commas. You may want to
extract any substring, up to the first comma to get the real life name.

waiting for events
o  blockingChildProcessWait
return true, if childProcessWait: blocks, if no children are ready.
On those systems, we must be somewhat careful when looking out for
a subprocesses status (to avoid blocking).

o  childProcessWait: blocking pid: pidToWait
get status changes from child processes.
Return an OSProcessStatus or nil, if no process has terminated.
If blocking is true, we wait until a process changed state,
otherwise we return immediately.
Note that win32 needs to know the HANDLE of the process on which
it waits. In case of an error, THIS ALWAYS WAITS and then times out.

** This method raises an error - it must be redefined in concrete classes **

o  isBlockingOn: fd
return the blocking attribute - if set (which is the default)
a read on the fileDescriptor will block until data is available.
If clear, a read operation will immediately return with a value nil.
Also affects write operations, which may perform partial writes when
blocking is off

** This method raises an error - it must be redefined in concrete classes **

o  numAvailableForReadOn: fd
return the number of bytes available for reading, without blocking.

o  readCheck: fd
return true, if a read is possible without blocking.
This is the case if data is available on a filedescriptor
or the read would return an error.
This depends on a working select or FIONREAD to be provided by the OS.

o  readWriteCheck: fd
return true, if filedescriptor can be read or written without blocking.
This is the case if data is available on a filedescriptor
or the read or write would return an error.
This is actually only used with sockets, to wait for a connect to
be finished.

o  selectOn: fd1 and: fd2 withTimeOut: millis

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  selectOn: fd withTimeOut: millis
wait for aFileDesriptor to become ready; timeout after t milliseconds.
Return true, if i/o ok, false if timed-out or interrupted.
With 0 as timeout argument, this can be used to check for availability
of read-data.
Experimental.

o  selectOnAny: fdArray withTimeOut: millis
wait for any fd in fdArray (an Array of integers) to become ready;
timeout after t milliseconds. An empty set will always wait.
Return first ready fd if i/o ok, nil if timed-out or interrupted.
Experimental.

o  selectOnAnyReadable: fdArray withTimeOut: millis
wait for any fd in fdArray (an Array of integers) to become ready for
reading. Timeout after t milliseconds. An empty set will always wait.
A zero timeout-time will immediately return (i.e. poll).
Return first ready fd if i/o ok, nil if timed-out or interrupted.
Experimental.

o  selectOnAnyReadable: readFdArray writable: writeFdArray exception: exceptFdArray readableInto: readableResultFdArray writableInto: writableResultFdArray exceptionInto: exceptionResultFdArray withTimeOut: millis
wait for any fd in readFdArray (an Array of integers) to become ready for reading,
writeFdArray to become ready for writing,
or exceptFdArray to arrive exceptional data (i.e. out-of-band data).
Timeout after t milliseconds or - if the timeout time is 0 - immediately..
Empty fd-sets will always wait. Zero time can be used to poll file-
descriptors (i.e. to check if I/O possible without blocking).
The corresponding filedescriptors which are ready are returned in readableResultFdArray,
writableResultFdArray and exceptionResultFdArray respectively.

Return the (overall) number of selected filedescriptors.
readableResultFdArray, writableResultFdArray and exceptionResultFdArray will
get a nil-value stored into the slot after the last valid fileDescriptor;
Thus, the caller can simply scan these arrays upTo the end or a nil value.

** This method raises an error - it must be redefined in concrete classes **

o  selectOnAnyReadable: readFdArray writable: writeFdArray exception: exceptFdArray withTimeOut: millis
wait for any fd in readFdArray (an Array of integers) to become ready for
reading, writeFdArray to become ready for writing, or exceptFdArray to
arrive exceptional data (i.e. out-of-band data).
Timeout after t milliseconds or, if the timeout time is 0, immediately..
Empty fd-sets will always wait. Zero time can be used to poll file-
descriptors (i.e. to check if I/O possible without blocking).
Return first ready fd if I/O ok, nil if timed-out or interrupted.

** This method raises an error - it must be redefined in concrete classes **

o  setBlocking: aBoolean on: fd
set/clear the blocking attribute - if set (which is the default)
a read on the fileDescriptor will block until data is available.
If cleared, a read operation will immediately return with a value of nil.
Also affects write operations, which may perform partial writes when
blocking is off

** This method raises an error - it must be redefined in concrete classes **

o  writeCheck: fd
return true, if filedescriptor can be written without blocking.
This is the case if data can be written to a filedescriptor
or the write would return an error.


Private classes:

    PrinterInfo
    TimeInfo
    TimeZoneInfo

Examples:


various queries


  Transcript
      showCR:'hello ' , (OperatingSystem getLoginName)


  OperatingSystem isUNIXlike ifTrue:[
      Transcript showCR:'this is some UNIX-like OS'
  ] ifFalse:[
      Transcript showCR:'this OS is not UNIX-like'
  ]


  Transcript
      showCR:'this machine is called ' , OperatingSystem getHostName


  Transcript
      showCR:('this machine is in the '
             , OperatingSystem getDomainName
             , ' domain')


  Transcript
      showCR:('this machine''s CPU is a '
             , OperatingSystem getCPUType
             )


  Transcript showCR:'executing ls command ...'.
  OperatingSystem executeCommand:'ls'.
  Transcript showCR:'... done.'.
locking a file (should be executed on two running smalltalks - not in two threads):


  |f|

  f := 'testFile' asFilename readWriteStream.

  10 timesRepeat:[
      'about to lock ...' printCR.
      [
        OperatingSystem
          lockFD:(f fileDescriptor)
          shared:false
          blocking:false
      ] whileFalse:[
          'process ' print. OperatingSystem getProcessId print. ' is waiting' printCR.
          Delay waitForSeconds:1
      ].
      'LOCKED ...' printCR.
      Delay waitForSeconds:10.
      'unlock ...' printCR.
      (OperatingSystem
          unlockFD:(f fileDescriptor)) printCR.
      Delay waitForSeconds:3.
  ]




ST/X 6.1.1; WebServer 1.620 at exept:8081; Wed, 23 May 2012 07:43:27 GMT