system(3) Library Functions Manual system(3) system - (libc -lc) #include int system(const char *command); system() fork(2) command execl(3) : execl("/bin/sh", "sh", "-c", command, (char *) NULL); system() . SIGCHLD SIGINT SIGQUIT system(). ( command.) command system() . system() : o command 0 . o -1 errno . o _exit(2) 127. o command. ( .) " " waitpid(2). ( WIFEXITED() WEXITSTATUS() ). system() . system() fork(2). attributes(7). +------------+------------------------------------+--------------------+ || | | +------------+------------------------------------+--------------------+ |system() | | MT-Safe | +------------+------------------------------------+--------------------+ C11, POSIX.1-2008. POSIX.1-2001 C89. system() : fork(2) execl(3) waitpid(2) / command. system() : . _XOPEN_SOURCE ( ) waitpid(2) (WEXITSTATUS() ) . system() SIGINT SIGQUIT. . : while (something) { int ret = system("foo"); if (WIFSIGNALED(ret) && (WTERMSIG(ret) == SIGINT || WTERMSIG(ret) == SIGQUIT)) break; } POSIX.1 pthread_atfork(3) system(). glibc . glibc 2.1.3 /bin/sh command system() 1 . glibc 2.1.3 POSIX.1-2001 chroot(2) ( POSIX.1-2001). 127 system() . system() ( set-user-ID set-group-ID ) . PATH . exec(3) execlp(3) execvp(3) ( PATH ). system() set-user-ID set-group-ID /bin/sh bash 2: bash 2 . ( Debian dash(1) sh.) command . system() . sh(1) . ( -c sh(1).) : system(" -unfortunate-command-name"); sh(1), execve(2), fork(2), sigaction(2), sigprocmask(2), wait(2), exec(3), signal(7) 3 . . : . 6.18 8 2026 system(3)