linux-C-模拟shell-execlp
execlp()
Execute a file
Synopsis:
#include <process.h>int execlp( const char * file, const char * arg0, const char * arg1, … const char * argn, NULL );Arguments:
fileUsed to construct a pathname that identifies the new process image file. If the fileargument contains a slash character, the file argument is used as the pathname for the file. Otherwise, the path prefix for this file is obtained by a search of the directories passed as the environment variable PATH.arg0, …, argnPointers to NULL-terminated character strings. These strings constitute the argument list available to the new process image. Terminate the list terminated with a NULL pointer. The arg0 argument must point to a filename that's associated with the process.
#include<unistd.h> main() { execlp(“ls”,”ls”,”-al”,”/etc/passwd”,(char *)0); }
<div style="font-family: Arial; font-size: 9pt; background-color: white;">waitpid()
wait for process termination
Function
SYNOPSIS DESCRIPTION PARAMETERS RETURN VALUES CONFORMANCE MULTITHREAD SAFETY LEVEL PORTING ISSUES AVAILABILITY SEE ALSO
页:
[1]