Module Styx__Types.Mode

A file's mode describes the type of file and its permissions.

type t = int
type attr =
| DMDIR

The file is a directory, a series of Stat structures

| DMAPPEND

Writes are only allowed to the end of the file

| DMEXCL

Exclusive-use, only one user may open the file at a time

| DMMOUNT

This file serves the 9P protocol through reads and writes

| DMAUTH

This file was established by a Tauth request

| DMTMP

Temporary file. May be lost when server restarts

| DMDEVICE

9P2000.u: special block or character device

| DMNAMEDPIPE

9P2000.u: Named pipe; see mkfifo(1)

| DMSOCKET

9P2000.u: unix socket

| DMSETUID

9P2000.u: file will execute with its owner's privileges

| DMSETGID

9P2000.u: setgid bit; children inherit dir's gid

| DMSTICKY

9P2000.u: only file owner, group, or root can modify

A file's attr describes the type of a file and is stored in the high bits of its mode. The attributes are not mutually exclusive and should be checked with check.

val attr_to_int : attr -> int
val check : t -> attr -> bool

check mode attr is true if mode contains attr.

val set : t -> attr -> t

set mode attr is mode with the attr bit set.

val write : w:Iovec.writer -> t -> Iovec.writer