-
Notifications
You must be signed in to change notification settings - Fork 672
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: I/O safety for unistd.rs #2440
Changes from 5 commits
e6e777b
1aa9489
45b552b
edcb0dd
4423ddd
3d1a939
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Module unistd now adopts I/O safety. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,7 +73,7 @@ impl IntoRawFd for PtyMaster { | |
|
||
impl io::Read for PtyMaster { | ||
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { | ||
unistd::read(self.0.as_raw_fd(), buf).map_err(io::Error::from) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This But this implementation would definitely make our interface more rusty, so I am not quite against it, though I think we should be consistent, i.e., if one wrapper type has this trait implemented, we should do this to all the wrapper types. |
||
unistd::read(&self.0, buf).map_err(io::Error::from) | ||
} | ||
} | ||
|
||
|
@@ -88,7 +88,7 @@ impl io::Write for PtyMaster { | |
|
||
impl io::Read for &PtyMaster { | ||
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { | ||
unistd::read(self.0.as_raw_fd(), buf).map_err(io::Error::from) | ||
unistd::read(&self.0, buf).map_err(io::Error::from) | ||
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be removed when we add I/O safety to module
fanotify
.