Skip to content

Commit 4aafa45

Browse files
authored
Merge branch 'master' into capi-multiple-backends
2 parents 8a2a429 + 22dcbcc commit 4aafa45

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

lib/wasi/src/state/mod.rs

+15-1
Original file line numberDiff line numberDiff line change
@@ -122,16 +122,30 @@ pub struct Fd {
122122
pub rights_inheriting: __wasi_rights_t,
123123
pub flags: __wasi_fdflags_t,
124124
pub offset: u64,
125-
/// Used when reopening the file on the host system
125+
/// Flags that determine how the [`Fd`] can be used.
126+
///
127+
/// Used when reopening a [`HostFile`] during [`WasiState`] deserialization.
126128
pub open_flags: u16,
127129
pub inode: Inode,
128130
}
129131

130132
impl Fd {
133+
/// This [`Fd`] can be used with read system calls.
131134
pub const READ: u16 = 1;
135+
/// This [`Fd`] can be used with write system calls.
132136
pub const WRITE: u16 = 2;
137+
/// This [`Fd`] can append in write system calls. Note that the append
138+
/// permission implies the write permission.
133139
pub const APPEND: u16 = 4;
140+
/// This [`Fd`] will delete everything before writing. Note that truncate
141+
/// permissions require the write permission.
142+
///
143+
/// This permission is currently unused when deserializing [`WasiState`].
134144
pub const TRUNCATE: u16 = 8;
145+
/// This [`Fd`] may create a file before writing to it. Note that create
146+
/// permissions require write permissions.
147+
///
148+
/// This permission is currently unused when deserializing [`WasiState`].
135149
pub const CREATE: u16 = 16;
136150
}
137151

0 commit comments

Comments
 (0)