inux 下system函数原型:
#include
int system(const char *command);
system() executes a command specified in command by calling /bin/sh -c command, and returns after the command has been completed. During execution of the command, SIGCHLD will be blocked, and SIGINT and SIGQUIT will be ignored.
system函数的返回值比较多,且存在相同的值却代表着不同的意思,针对以上问题对源码进行分析。
Libc-2.9 下sysdeps\posi\system.c源码:
点击(此处)折叠或打开
int system (const char *line)
{
return __libc_system (line);
}
int __libc_system (const char *line)/*system函数实际上调用的是do_system函数*/
{
if(line ==NULL)
/* Check that we have a command processor available. It might