linux - Why does call_usermodehelper fail most of the times? -
from kernel module, trying use call_usermodehelper function execute executable sha1 takes file argument , writes sha1 hash sum of file file (named output). executable works perfectly.
int result=-1; name = "/home/file" char *hargv[] = {"/home/sha1", name,null }; char *henvp[] = {"home=/", "path=/sbin:/usr/sbin:/bin:/usr/bin", null }; result = call_usermodehelper("/home/sha1", hargv, henvp, 1); but of times call_usermodehelper returns -14 , fails execute executable. reason?
sometimes works, output file created locked (unlike happens when sha1 run directly) , have run chown before can use properly. how can prevented?
is there anyway operation without call_usermodehelper?
the last argument call_usermodehelper sort of enumeration:
#define umh_no_wait 0 /* don't wait @ */ #define umh_wait_exec 1 /* wait exec, not process */ #define umh_wait_proc 2 /* wait process complete */ #define umh_killable 4 /* wait exec/proc killable */ as can see, wait=1 function waits while exec performed, doesn't wait process.
if no other constraints, value umh_wait_proc gives more stable results.
Comments
Post a Comment