stat

getting file system information

Miscellaneous Information


DESCRIPTION

The file system maintains information about files. Following is a description of how MKS Toolkit gets the information it needs about a file.

Information about a file is made available by a system call named stat(), which fills a structure of integer fields.

The following values are available for MKS Toolkit:
dev

Disk device number.

ino

Set to 3 unless this is a root directory;

mode

Encoded description of file type and file access permissions

nlink

Always the value 1.

uid

Numeric value of owner of file.

gid

Numeric value of file's primary group owner.

rdev

Always 0

size

File size in bytes. Directories normally have size 0.

mtime

Time of file's last modification.

atime

Time of file's last access.

ctime

Time of file's creation.

The mode field encodes the file type (for example, regular file, directory), the file access permissions (for example, read, write, execute) and several file attributes (for example, read_only, hidden, system).

On UNIX systems the mode permission bits are encoded as shown in Table 1. Values can be OR-ed together to get an octal value for these three bits. These three bits are replicated three times; for the owner, group, and world permissions of this file. Thus, for example, the mode
0720 (octal)
provides permission to read, write, or execute a file by its owner, allows others in the same group to write the file, and prevents anyone else from accessing this file.

If this same permission was applied to a directory, then the owner could read, search, and add or delete files under the directory, and users in the same group could add or delete files, while anyone else could not do anything with this directory.

Regarding modes, the ls and chmod commands try to mirror the same capabilities as are available under UNIX systems. You can specify modes with the octal notation shown earlier, or by concatenating the indicated mode specifiers. For example, the octal mode 0720 could also be given as:
-rwx-w----
in the output of the ls command, and specified as
u=rwx,g=w
for the chmod command.

Bit Value Specifier File Directory
0 1 x executable can search directory
1 2 w write access can modify (delete/add files)
2 4 r read access read access

Table 1: Mode Permission Bits


SEE ALSO

Commands:
chmod, ls


Updated MKS Toolkit [3khat16.ico]HP3000 [3khat16.ico]3kMail [archive16.gif]