我正在为嵌入式设备编写网络配置系统,它使用 ioctl 调用。
在启动系统时,我需要检查 future 调用的权限。
是否可以检查足够的权限或没有足够的权限来调用ioctl(ID)
而不调用该ioctl?
最佳答案
我不知道这是否能回答您的问题,但您是否了解过功能?
if (!CAP_IS_SUPPORTED(CAP_NET_ADMIN)){
EXIT_FAIL("Capability CAP_NET_ADMIN is not supported\n");
}
摘自人:
...
CAP_NET_ADMIN
Perform various network-related operations:
* interface configuration;
* administration of IP firewall, masquerading, and accounting
* modify routing tables;
* bind to any address for transparent proxying;
* set type-of-service (TOS)
* clear driver statistics;
* set promiscuous mode;
* enabling multicasting;
...
跳此帮助
关于c++ - 可以检查 ioctl 的权限,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24553885/