Copyright ©1993-1998 by Axel T. Schreiner.  All Rights Reserved.



4
Styx



Resources are represented as file systems, i.e., there is a standard set of operations that a server must implement. For devices, i.e., servers in the Inferno kernel, these are functions.

User servers also represent their resources as file systems; however, in this case the operations are implemented as remote procedure calls using the Styx protocol.

Styx messages are transported over a bidirectional, robust, connected circuit. The client transmits a T-message, the server responds with an R-message of the same type or with Rerror. Both messages together form a transaction. Styx preserves a state on both ends of the circuit.

Each message contains a tag, that the client invents uniquely for the T-message within the unfinished transactions and that matches T- to R-message. Styx is not necessarily synchronous; therefore, the tags are required.

The server identifies each of its objects with a permanently unique qid composed from a path and a version. The client invents an fid which is used for access; after clunk a fid can be reintroduced for another object.

Tnop 0xffff
Rnop 0xffff client inquires if it can communicate with the server.

Tflush tag oldtag
Rflush tag client instructs server not to reply to oldtag anymore. Client then ignores oldtag and will certainly receive Rflush for tag.
Rerror tag text server instructs client that it cannot reply to tag.

Tattach tag fid uid aname
Rattach tag fid qid client wants to access as uid root aname using fid. Server agrees; qid is server's object accessed by fid.

Tclone tag fid newfid
Rclone tag fid client wants newfid to be equivalent to fid.



Tclunk tag fid
Rclunk tag fid client wants to invalidate fid. It may subsequently be reintroduced with Tclone or Tattach.

Tremove tag fid
Rremove tag fid client wants to have object referenced by fid destroyed; fid is subsequently invalid as per clunk.

Twalk tag fid name
Rwalk tag fid qid client searches directory fid for name. If successful fid then references name and server's object for fid is qid.

Topen tag fid mode
Ropen tag fid qid client wants to access fid as per mode. Server agrees.

Tcreate tag fid name perm mode
Rcreate tag fid qid client wants to create in directory fid with name and protection perm a new object and access it as per mode. If successful fid then references name and server's object for fid is qid. Directories are flagged in perm.

Tread tag fid offset count
Rread tag fid count pad data
client wants to receive from fid beginning at offset at most count bytes. Up to 8 KB can be requested; fewer bytes may be returned. For directories entries with 116 bytes are returned formatted as per Rstat.

Twrite tag fid offset count pad data
Rwrite tag fid count client wants to write into file fid beginning at offset (or at the end if append) count bytes. The result should be the same number.

Tstat tag fid
Rstat tag fid name uid gid qid mode atime mtime length type dev
client receives information about fid. Beginning with name it is 116 bytes.

Twstat tag fid name uid gid qid mode atime mtime length type dev
Rwstat tag fid client changes some informations about fid - especially name and parts of mode, but definitely not uid, and usually not gid.

The kernel maps system calls like chdir() into sequences of function calls to devices in the kernel. One such device is #M, which converts the function calls into remote function calls with Styx to local or remote user processes (servers).

15/Mar/1998