| ▲ | kibwen 3 hours ago | ||||||||||||||||
They're not missing, Rust just ships them (including openat) as part of the first-party libc crate rather than exposing them directly from libstd. You'll find all the other libc syscalls there as well: https://docs.rs/libc/0.2.186/libc/ . I agree that Rust's stdlib could use some higher-level helper functions to help head off TOCTOU, but it's not as simple as just exposing `openat`, which, in addition to being platform-specific as you say, is also error-prone in its own right. | |||||||||||||||||
| ▲ | nh2 2 hours ago | parent | next [-] | ||||||||||||||||
But those are all unsafe, taking raw strings. Why can I easily use "*at" functions from Python's stdlib, but not Rust's? They are much safer against path traversal and symlink attacks. Working safely with files should not require *const c_char. This should be fixed . | |||||||||||||||||
| |||||||||||||||||
| ▲ | bonzini an hour ago | parent | prev [-] | ||||||||||||||||
The correct comparison is to rustix, not libc, and rustix is not first-party. And even then the rustix API does not encapsulate the operations into structs the same way std::fs and std::io do. | |||||||||||||||||
| |||||||||||||||||