-
Notifications
You must be signed in to change notification settings - Fork 689
add support for mknodat
#751
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
Conversation
src/sys/stat.rs
Outdated
@@ -50,6 +50,19 @@ pub fn mknod<P: ?Sized + NixPath>(path: &P, kind: SFlag, perm: Mode, dev: dev_t) | |||
Errno::result(res).map(drop) | |||
} | |||
|
|||
/// Create a special or ordinary file | |||
/// ([see mknodat(2)](http://man7.org/linux/man-pages/man2/mknodat.2.html)). |
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.
Better to reference POSIX docs than Linux docs
http://pubs.opengroup.org/onlinepubs/9699919799/functions/mknod.html
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.
The POSIX one is not super helpful for end-users. I would rather include no manpage link, then link to the posix one (example: http://man7.org/linux/man-pages/man2/mknodat.2.html#NOTES)
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.
nix is a portable crate, not a Linux crate. The Linux manpage is only useful for Linux users. But the POSIX man page can be relied upon by all nix users.
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.
But POSIX deviate from reality in subtle ways (hence the use of shall
all over the place). Nix is not fully portable anyway, since it only provides a thin layer above systems libc unlike projects like gnulib. So you have to actually look at every manpage of every operating system you care about to be sure, it won't break.
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 would be actually be the more honest documentation: https://www.gnu.org/software/gnulib/manual/gnulib.html#mknodat
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.
That's irrelevant, because nix doesn't bind to gnulib; it binds to the system's C library. The POSIX documentation is the GCD of all supported platforms. While some platforms may deviate, the POSIX docs are still the single most relevant source.
Thanks for changing the man page link. Next, could you try to add a test for |
We would like to write tests/examples for all additions to nix if possible. While having tests that don't require root would be ideal, I think having an example in a doc test that isn't run and a test that requires root would be sufficient coverage. |
I already added the test for FIFO. |
I just read up on @asomers Any thoughts on this? |
Hi, sorry but I have no time on polishing the API further.
(force-push is also possible just in case). |
I close this pull request in case I block somebody else who wants to implement this feature.
|
No description provided.