stat, fstat, fwstat, wstat - get and put file status — Inferno 1ed
stat, fstat, fwstat, wstat - get and put file status
include "sys.m"; sys:= load Sys Sys->PATH; fstat: fn(fd: ref FD) : (int, Dir); fwstat: fn(fd: ref FD; d: Dir) : int; stat: fn(name: string) : (int, Dir); wstat: fn(name: string, d: Dir): int;
Description
stat (name, d) and fstat (fd, d)
Given a file's name, or an open file descriptor fd, these routines return information about the file into the Dir member of the returned tuple. The int member will be zero for success and -1 for failure.
wstat (name, d) and fwstat (fd, d)
The wstat and fwstat functions apply the file attributes of d to the file. Only certain attributes can be modified. See the section Modifying File Attributes . Both functions return zero for success and -1 for failure.
The Dir Abstract Data Type
File status is managed via the Dir abstract data type:
Qid: adt
{
path: int;
vers: int;
};
Dir: adt
{
name: string;
uid: string;
gid: string;
qid: Qid;
mode: int;
atime: int;
mtime: int;
length: int;
dtype: int;
dev: int;
};
File Mode Bits
Modifying File Attributes
Only some of the fields may be changed by wstat calls.|
Limbo System Module
|
|
dirread - read directory
|
|
open, create - open/create a file for reading or writing
|
|
stat, wstat - inquire or change file attributes in Chapter 3
|
Notes
The following behaviors apply when Inferno is hosted on Windows-based systems.
FAT File system (Win95 and Windows-NT)
The values of uid and gid are Everyone.Files and directories always have read and execute permission. They cannot be changed. Files without write permission cannot be removed.
NTFS File system (Windows-NT)
Permissions for read, write, and execute operate as described above.The uid attribute is supported.
The gid attribute is interpreted always to mean the special group InfernoGroup, even if the underlying Windows system maintains other groups for the file. Special group Everyone is used to represent 'other' for permissions.
infernosupport@lucent.com Copyright © 1996,Lucent Technologies, Inc. All rights reserved.