摘要: 声明:转载注明出处! 注: 1、 PID文件 the pid files contains the process id (a number) of a given program. For example, Apache HTTPD may write it's main process number to a pid file - which is a regular text file,... 阅读全文
posted @ 2012-09-25 21:23 helloweworld 阅读(339) 评论(0) 推荐(0) 编辑
摘要: 头文件:#include <unistd.h>int dup(int fd);int dup(int fd1,int fd2);功能:复制一个现存的文件描述符,返回新的文件描述符。返回值,成功返回新的文件描述符,出错返回-1.由dup返回的新文件描述符一定是当前可用文件描述中的最小数值。用dup2则可以用fd2参数指定新的描述符数值。如果fd2已经打开,则先关闭。若fd1=fd2,则dup2返回fd2,而不关闭它。通常使用这两个系统调用来重定向一个打开的文件描述符。 阅读全文
posted @ 2012-09-25 11:04 helloweworld 阅读(301) 评论(0) 推荐(0) 编辑
摘要: 头文件:#include<unistd.h>#include<sys/types.h>原型:pid_t fork( void);返回值:若成功调用一次则返回两个值,子进程返回0,父进程返回子进程ID;否则,出错返回-1.功能:一个现有进程可以调用fork函数创建一个新进程。由fork创建的新进程被称为子进程(child process)。fork函数被调用一次但返回两次。两次返回的唯一区别是子进程中返回0值而父进程中返回子进程ID。举例1234567891011121314151617181920212223#include<sys/types.h>//对于 阅读全文
posted @ 2012-09-25 10:57 helloweworld 阅读(336) 评论(0) 推荐(0) 编辑