简体   繁体   English

无法导入libc :: funcs

[英]Cannot import libc::funcs

I'm trying to change the UID of the running user. 我正在尝试更改正在运行的用户的UID。 The documentation says that you should use libc::funcs::posix88::unistd::setuid . 文档说,您应该使用libc::funcs::posix88::unistd::setuid

When I try to compile, it prints an error: 当我尝试编译时,它会显示错误:

Could not find `funcs` in `libc`

First of all, it says that it's unstable, meaning you should avoid using it if at all possible. 首先,它表示不稳定,这意味着您应尽可能避免使用它。 Unstable things can disappear or change at any time without warning. 不稳定的事物随时可能消失或改变,而不会发出警告。 In particular, that's for the compiler-internal libc which you're not supposed to touch. 特别是,这是您不应该接触的编译器内部libc

Secondly, that's from Rust 1.4, where the current version is 1.18. 其次,来自Rust 1.4,当前版本为1.18。 With the error you're getting, I assume you're using a different version of Rust to 1.4. 出现错误时,我假设您使用的Rust版本与1.4不同。

If you want to use libc , you should use the libc from the Cargo ecosystem . 如果要使用libc ,则应使用Cargo生态系统中的libc You can then find setuid in its API reference . 然后,您可以在其API参考中找到setuid

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM