next up previous
Next: LibSim Up: simlib Previous: UnixCmdLineClass

UnixUtil


     NAME
	  unixutil - interfase to unix process management and error
	  messages

     DESCRIPTION
	  Interface to basic Unix process control and error handling,
	  System and PError.

     AUTHOR
	  Boris	Magnusson, Lund	University.

     EXAMPLE
	     external class UnixUtil;
	     ref(UnixUtil) guru;
	     integer laststatus, exit;
	     guru:-new UnixUtil; ! -- One object will always do	--;
	     ! -- do some system operation --;
	     exit:=guru.system(	ls");"
	     if	exit<0 then
	     begin
	       laststatus:=guru.geterrno;
	       guru.Perror(laststatus);
	     end;

     DETAILED INTERFACE
	     class UnixUtil;
	  This	class  is  intended  to	 give  support	Unix   systems
	  programming  in  Simula.  Currently it contains a routine to
	  execute sub-processes, to get	the latest system call	status
	  ("errno") and	the predefined Unix system-error constants.

	  Supers: -
	  Kind:	Instantiable
	  Init:	-
	  Sequencing: (System/GetErrNo/PError/E-constants)*

     OPERATIONS
     System
	     integer procedure System(Cmd);
	     text cmd; ! Shell command to execute inculding options
	     like  ls -ls";"
	  Start	a shell	and perform the	command	cmd.  Wait  until  the
	  command  is  completed  (if  system  call  is	 interrupted).
	  Return the exit code from the	command.

     GetErrNo
	     integer procedure GetErrNo;
	  Returns the status (errno) from last issued unix  call.  See
	  constants for	the meaning of the error codes.

     PError
	     procedure PError(msg);
	     value msg;	text msg; ! Text, often	identifing the
	     complaining program.;
	  Print	the message followed  by  a  decription	 of  the  last
	  generated error.

     UNIX ERROR	CONSTANTS
     Basic errors
	     integer
	     EPERM     =1,     !- Not owner -;
	     ENOENT    =2,	 !- No such file or directory -;
	     ESRCH     =3,     !- No such process -;
	     EINTR     =4,     !- Interrupted system call -;
	     EIO       =5,	 !- I/O	error -;
	     ENXIO     =6,     !- No such device	or address -;
	     E2BIG     =7,	 !- Arg list too long -;
	     ENOEXEC   =8,	 !- Exec format	error -;
	     EBADF     =9,     !- Bad file number -;
	     ECHILD    =10,	 !- No children	-;
	     EAGAIN    =11,	 !- No more processes -;
	     ENOMEM    =12,	 !- Not	enough core -;
	     EACCES    =13,	 !- Permission denied -;
	     EFAULT    =14,	 !- Bad	address	-;
	     ENOTBLK   =15,	 !- Block device required -;
	     EBUSY     =16,    !- Mount device busy -;
	     EEXIST    =17,	 !- File exists	-;
	     EXDEV     =18,    !- Cross-device link -;
	     ENODEV    =19,	 !- No such device -;
	     ENOTDIR   =20,	 !- Not	a directory-;
	     EISDIR    =21,	 !- Is a directory -;
	     EINVAL    =22,	 !- Invalid argument -;
	     ENFILE    =23,	 !- File table overflow	-;
	     EMFILE    =24,	 !- Too	many open files	-;
	     ENOTTY    =25,	 !- Not	a typewriter -;
	     ETXTBSY   =26,	 !- Text file busy -;
	     EFBIG     =27,    !- File too large	-;
	     ENOSPC    =28,	 !- No space left on device -;
	     ESPIPE    =29,	 !- Illegal seek -;
	     EROFS     =30,    !- Read-only file	system -;
	     EMLINK    =31,	 !- Too	many links -;
	     EPIPE     =32,    !- Broken	pipe -;

     Math software errors
	     EDOM      =33,	 !- Argument too large -;
	     ERANGE    =34,	 !- Result too large -;

     Non-blocking and interrupt	i/o errors
	     EWOULDBLOCK    =35, !- Operation would block -;
	     EINPROGRESS    =36, !- Operation now in progress -;
	     EALREADY	    =37, !- Operation already in progress -;

     IPC/network software errors
	     - Argument	errors -;
	     ENOTSOCK       =38, !- Socket operation on	non-socket -;
	     EDESTADDRREQ   =39, !- Destination	address	required -;
	     EMSGSIZE       =40, !- Message too	long -;
	     EPROTOTYPE     =41, !- Protocol wrong type	for socket -;
	     ENOPROTOOPT    =42, !- Protocol not available -;
	     EPROTONOSUPPORT=43, !-Protocol not	supported -;
	     ESOCKTNOSUPPORT=44, !- Socket type not supported -;
	     EOPNOTSUPP	    =45, !- Operation not supported on socket-;
	     EPFNOSUPPORT   =46, !- Protocol family not	supported -;
	     EAFNOSUPPORT   =47, !- Address family not supported byprotocol family -;
	     EADDRINUSE	    =48, !- Address already in use -;
	     EADDRNOTAVAIL  =49, !- Can't assign requested address -- Operational errors -;
	     ENETDOWN	    =50, !- Network is down -;
	     ENETUNREACH    =51, !- Network is unreachable -;
	     ENETRESET      =52, !- Network dropped connection on reset -;
	     ECONNABORTED   =53, !- Software caused connection abort-;
	     ECONNRESET	    =54, !- Connection reset by	peer -;
	     ENOBUFS	    =55, !- No buffer space available -;
	     EISCONN	    =56, !- Socket is already connected	-;
	     ENOTCONN	    =57, !- Socket is not connected -;
	     ESHUTDOWN      =58, !- Can't send after	socket shutdown	-;
	     ETOOMANYREFS   =59, !- Too	many references: can't splice-;
	     ETIMEDOUT      =60, !- Connection timed	out -;
	     ECONNREFUSED   =61, !- Connection refused -;

     Mixed errors
	     - Others;
	     ELOOP	    =62, !- Too many levels of symboliclinks -;
	     ENAMETOOLONG   =63, !- File name too long -- Should be rearranged -;
	     EHOSTDOWN      =64, !- Host is down -;
	     EHOSTUNREACH   =65, !- No route to	host -;
	     ENOTEMPTY      =66, !- Directory not empty -- Quotas &	mush -;
	     EPROCLIM	    =67, !- Too	many processes -;
	     EUSERS	    =68, !- Too	many users -;
	     EDQUOT	    =69, !- Disc quota exceeded	-
	     - Network File System -;
	     ESTALE	    =70, !- Stale NFS file handle -;
	     EREMOTE	    =71, !- Too	many levels of remote in path
	     -
	     - Streams -;
	     ENOSTR	    =72, !- Device is not a stream -;
	     ETIME          =73, !- Timer expired -;
	     ENOSR          =74, !- Out of	streams	resources -;
	     ENOMSG	    =75, !- No message of desired type -;
	     EBADMSG	    =76, !- Trying to read unreadable message
	     -
	     - SystemV IPC -;
	     EIDRM		 =77, !- Identifier removed -
	     - SystemV Record Locking -;
	     EDEADLK		 =78, !- Deadlock condition. -;
	     ENOLCK		 =79, !- No record locks available. -
	     - RFS -;
	     ENONET		 =80, !- Machine is not	on the network
	     -;
	     ERREMOTE	         =81, !- Object is remote -;
	     ENOLINK		 =82, !- the link has been severed -;
	     EADV		 =83, !- advertise error -;
	     ESRMNT		 =84, !- srmount error -;
	     ECOMM		 =85, !- Communication error on	send
	     -;
	     EPROTO		 =86, !- Protocol error	-;
	     EMULTIHOP	         =87, !- multihop attempted -;
	     EDOTDOT		 =88, !- Cross mount point (not	an
	     error) -;
	     EREMCHG		 =89, !- Remote	address	changed	-
	     - POSIX -;
	     ENOSYS		 =90; !- function not implemented -;