Linux考试复习.ppt

7.3 进 程 控 制 7.3.1 有关进程控制的系统调用 常用的有关进程控制的系统调用有:fork,exec,wait,exit,getpid,sleep,nice等 例如: #include unistd.h #include sys/types.h pid_t fork(void); #include unistd.h #include sys/types.h pid_t getpid(void); pid_t getppid(void); 7.3.2 应用示例 /*proc1.c演示有关进程操作*/ #include unistd.h #include sys/types.h #include stdio.h #include errno.h int main(int argc,char **argv) { pid_t pid,old_ppid,new_ppid; pid_t child,parent; parent=getpid(); /*获得本进程的PID*/ if((child=fork())0){ fprintf(stderr,%s:fork of child failed:%s\n,argv[0],strerror(errno));

您可能关注的文档

文档评论(0)

1亿VIP精品文档

相关文档