Modula-2 || Compiler & Tools || Library || Search Engine


Ulm's Modula-2 Library:
SysStat


NAME

SysStat - examine file status

SYNOPSIS

FROM SystemTypes IMPORT TIME, OFF;


TYPE StatBuf = RECORD dev: CARDINAL; ino: CARDINAL; mode: BITSET; nlink: CARDINAL; uid: CARDINAL; gid: CARDINAL; rdev: CARDINAL; size: OFF; atime: TIME; spare1 : CARDINAL; mtime: TIME; spare2 : CARDINAL; ctime: TIME; spare3 : CARDINAL; blksize : CARDINAL; blocks : CARDINAL; spare4 : ARRAY[0..1] OF CARDINAL; END; CONST (* bit masks for mode; bits 0..15 used *) FileType = { 0..3 }; (* IF Ifxxx = mode * FileType *) IfDir = { 1 }; (* directory *) IfChr = { 2 }; (* character special *) IfBlk = { 1..2 }; (* block special *) IfReg = { 0 }; (* regular *) IfLnk = { 0,2 }; (* symbolic link *) IfSock = { 0..1 }; (* socket *) IfFifo = { 3 }; (* fifo *) (* IF Isxxx <= mode THEN *) IsUid = { 4 }; (* set user id on execution *) IsGid = { 5 }; (* set group id on execution *) IsVtx = { 6 }; (* save swapped text even after use *) (* permissions on file: IF ... <= mode *) OwnerRead = { 7 }; (* read permission, owner *) OwnerWrite = { 8 }; (* write permission, owner *) OwnerExec = { 9 }; (* execute/search permission, owner *) GroupRead = { 10 }; GroupWrite = { 11 }; GroupExec = { 12 }; WorldRead = { 13 }; WorldWrite = { 14 }; WorldExec = { 15 };

PROCEDURE Stat(file: ARRAY OF CHAR; VAR buf: StatBuf) : BOOLEAN; PROCEDURE Fstat(fd: CARDINAL; VAR buf: StatBuf) : BOOLEAN;

DESCRIPTION

Stat returns the status of the file designated by file into the buffer buf. Fstat works similar but accepts a file descriptor fd instead.

DIAGNOSTICS

On failure, FALSE is returned and Errno.errno is set.

SEE ALSO

stat(2)

BUGS

The current version does not support the latest file type (namely doors) which has been introduced in Solaris 2.5.
Edited by: borchert, last change: 1997/02/26, revision: 1.1, converted to HTML: 1997/04/28

Modula-2 || Compiler & Tools || Library || Search Engine