代码如下:
int call_usermodehelper_test(void)
{
int ret = 0
char *envp[] = {NULL}
char *argv[] = {"/sbin/ifconfig",NULL}
ret = call_usermodehelper(argv[0], argv, envp, UMH_WAIT_PROC)
rt_printf("call_usermodehelper ret = %dn",ret)
return ret
}
但是调用"/sbin/reboot"时却能返回0并且执行重启命令。
int call_usermodehelper_test(void)
{
int ret = 0
char *envp[] = {NULL}
char *argv[] = {"/sbin/reboot",NULL}
ret = call_usermodehelper(argv[0], argv, envp, UMH_WAIT_PROC)
rt_printf("call_usermodehelper ret = %dn",ret)