macro_rules! syscall {
($fn: ident @FD ( $($arg: expr),* $(,)* ) ) => { ... };
($fn: ident @NON_FD ( $($arg: expr),* $(,)* ) ) => { ... };
($fn: ident @RAW ( $($arg: expr),* $(,)* ) ) => { ... };
}
Expand description
Do syscall and return Result<T, std::io::Error>
If use syscall@FD or syscall@NON_FD, the return value is wrapped in MaybeFd. The MaybeFd
is
designed to close the fd when it is dropped.
If use syscall@RAW, the return value is raw value. The requirement to explicitly add @RAW is to
avoid misuse.