Module Styx__Types.Stat
A stat structure contains metadata for a file, such as its owners, permissions, and size. Stat structures are retrieved by Tstat requests and supplied by Twstat requests. In addition, the contents of a directory is a series of adjacent stat structures.
type t
type extension
=
|
ExtSymlink of string
Symlink target
|
ExtBlockDevice of int * int
Block device major, minor number
|
ExtCharDevice of int * int
Character device major, minor number
Stat structures may have 9P2000.u extensions carrying additional data for special files.
val ext_of_iovec : Mode.t -> Iovec.t -> extension option
val ext_write : w:Iovec.writer -> extension -> Iovec.writer
ext_write ~w
writes the extension string tow
. The 9P2000.u protocol extensions use the following encoding for extensions:ExtBlockDevice (0, 1)
is the stringc 0 1
ExtCharDevice (0, 1)
is the stringb 0 1
ExtSymlink target
is the stringtarget
val srv_type : t -> int
This field is unspecified. On Plan 9, it specifies the server type.
val srv_dev : t -> int
This field is unspecified. On Plan 9, it specifies which of a group of servers of the same type is the one responsible for this file.
val mode : t -> int
Permissions and file type information
val atime : t -> int
Last access time, in seconds since the epoch
val mtime : t -> int
Last modification time, in seconds since the epoch
val length : t -> int
Length of the file in bytes
val length64 : t -> int64
Length of the file in bytes. Allocates an int64.
val name : t -> string
File name; "/" if the file is the root directory of the server.
val uid : t -> string
The owner of the file
val gid : t -> string
The file's group
val muid : t -> string
Name of the user who last modified the file.
val n_uid : t -> int
Numeric user id of owner, or -1 if 9P2000.u is not in use.
val n_gid : t -> int
Numeric group id of file, or -1 if 9P2000.u is not in use.
val n_muid : t -> int
Numeric id of last modifier, or -1 if 9P2000.u is not in use.
val of_iovec : Iovec.t -> t
val write : ?qid:Qid.t -> ?mode:Mode.t -> ?atime:int -> ?mtime:int -> ?length:int -> ?name:string -> ?uid:string -> ?gid:string -> ?muid:string -> Iovec.t -> int
write w ...
marshals a stat structure to the start ofiov
with the given field values. Optional arguments that are not provided will be replaced with "don't-touch" values; zero-length strings or integers with all bits set to 1. It returns the number of bytes written.
val write_ext : ?qid:Qid.t -> ?mode:Mode.t -> ?atime:int -> ?mtime:int -> ?length:int -> ?name:string -> ?uid:string -> ?gid:string -> ?muid:string -> ?n_uid:int -> ?n_gid:int -> ?n_muid:int -> ?ext:extension option -> Iovec.t -> int
write_ext w ...
marshals a stat structure intow
with 9P2000 extensions for numeric user IDs and special file metadata.