Oberon || Library || Module Index || Search Engine || Definition || Module
CONST type = {16..19}; CONST prot = {23..31};
(* file types *) CONST reg = {16}; (* regular *) CONST dir = {17}; (* directory *) CONST chr = {18}; (* character special *) CONST fifo = {19}; (* fifo *) CONST blk = {17..18}; (* block special *) CONST symlink = {16, 18}; (* symbolic link *) CONST socket = {16, 17}; (* socket *) CONST door = {16, 17, 19}; (* door *)
(* special *) CONST setuid = 20; (* set user id on execution *) CONST setgid = 21; (* set group id on execution *) CONST savetext = 22; (* save swapped text even after use *)
(* protection *) CONST uread = 23; (* read permission owner *) CONST uwrite = 24; (* write permission owner *) CONST uexec = 25; (* execute/search permission owner *) CONST gread = 26; (* read permission group *) CONST gwrite = 27; (* write permission group *) CONST gexec = 28; (* execute/search permission group *) CONST oread = 29; (* read permission other *) CONST owrite = 30; (* write permission other *) CONST oexec = 31; (* execute/search permission other *)
CONST owner = {23..25}; CONST group = {26..28}; CONST other = {29..31}; CONST read = {23, 26, 29}; CONST write = {24, 27, 30}; CONST exec = {25, 28, 31}; CONST rwx = {23..31};
TYPE StatRec = RECORD device: SysTypes.Device; (* ID of device containing a directory entry for this file *) inode: SysTypes.Inode; (* inode number *) mode: SET; (* file mode; see mknod(2) *) nlinks: INTEGER; (* number of links *) uid: INTEGER; (* user id of the file's owner *) gid: INTEGER; (* group id of the file's group *) rdev: SysTypes.Device; (* ID of device this entry is defined only for character special or block special files *) size: SysTypes.Offset; (* file size in bytes *) atime: SysTypes.Time; (* time of last access *) mtime: SysTypes.Time; (* time of last data modification *) ctime: SysTypes.Time; (* time of last file status change *) blksize: LONGINT; (* preferred blocksize *) blocks: LONGINT; (* # of blocks allocated *) END;
PROCEDURE Stat(path: ARRAY OF CHAR; VAR buf: StatRec; errors: RelatedEvents.Object) : BOOLEAN; PROCEDURE Lstat(path: ARRAY OF CHAR; VAR buf: StatRec; errors: RelatedEvents.Object) : BOOLEAN; PROCEDURE Fstat(fd: SysTypes.File; VAR buf: StatRec; errors: RelatedEvents.Object) : BOOLEAN;
The protection bits are defined for Oberon in a convenient manner. The low-order 2-byte-word of mode determines the type and protection of the file. type specifies the mask for the file type and prot the mask for the protection.
Possible file types are:
The file protection includes some special bits:
Additional masks are given for owner, group, other, read, write, exec, and rwx. owner includes all bits dedicated to the owner, read includes bits for reading (owner, group, and others), rwx contains all regular protection bits. Example for "rw-r--r--": (SysStat.read+SysStat.write)*SysStat.owner + SysStat.read*(SysStat.group+SysStat.other).
Oberon || Library || Module Index || Search Engine || Definition || Module