call_usermodehelper / call_usermodehelperpipe使用 [英] call_usermodehelper / call_usermodehelperpipe usage
问题描述
我已经按照从内核调用用户的应用程序这个伟大的文档:<一href=\"http://www.ibm.com/developerworks/linux/library/l-user-space-apps/index.html\">http://www.ibm.com/developerworks/linux/library/l-user-space-apps/index.html
I've followed this great document on invoking user apps from the kernel: http://www.ibm.com/developerworks/linux/library/l-user-space-apps/index.html
但我现在如何从已运行的应用程序的输出感兴趣。我试图传递重定向操作符写输出到文件..例如:
But I'm now interested in how to get the output from the apps that have been run. I tried passing in redirection operators to write the output to a file.. Eg:
char *argv[] = { "/usr/bin/ls", ">>", "/tmp/list", NULL};
call_usermodehelper(argv[0], argv, envp, UMH_WAIT_PROC);
没有这样的运气。我碰到 call_usermodehelperpipe
并想知道这将是我后,但我一直没能掌握如何使用它,或者找到像上述之一的任何文件就可以了。
No such luck. I came across call_usermodehelperpipe
and wondered if that would be what I'm after, but I haven't been able to grasp how to use it or find any documents like the above one on it.
先谢谢您的建议/帮助!
Thanks in advance for suggestions / help!
推荐答案
&GT;&GT;
不是 LS参数
,它是从外壳的东西。它可以通过解析 / bin / sh的-cLS&GT;&GT;的/ tmp /列表
(带壳)。在C语言中,是这样的:
>>
is not an argument for ls
, it is something from the shell. It can be parsed using/bin/sh -c "ls >> /tmp/list"
(in shell). In C, this is:
char *argv[] = { "/bin/bash", "-c", "/bin/ls >> /tmp/list", NULL};
这篇关于call_usermodehelper / call_usermodehelperpipe使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!