当前位置: 技术问答>linux和unix
新看APUE,关于进程方面的问题,求大家指教...
来源: 互联网 发布时间:2015-10-07
本文导语: 首先是关于FORK的: #include #include "ourhdr.h" int glob = 6; /* external variable in initialized data */ char buf[] = "a write to stdoutn"; int main(void) { int var; /* automatic variable on the stack */ pid_t pid; var = 88; if (write(STDOUT_...
首先是关于FORK的:
#include
#include "ourhdr.h"
int glob = 6; /* external variable in initialized data */
char buf[] = "a write to stdoutn";
int
main(void)
{
int var; /* automatic variable on the stack */
pid_t pid;
var = 88;
if (write(STDOUT_FILENO, buf, sizeof(buf)-1) != sizeof(buf)-1)
err_sys("write error");
printf("before forkn"); /* we don't flush stdout */
if ( (pid = fork())
#include
#include "ourhdr.h"
int glob = 6; /* external variable in initialized data */
char buf[] = "a write to stdoutn";
int
main(void)
{
int var; /* automatic variable on the stack */
pid_t pid;
var = 88;
if (write(STDOUT_FILENO, buf, sizeof(buf)-1) != sizeof(buf)-1)
err_sys("write error");
printf("before forkn"); /* we don't flush stdout */
if ( (pid = fork())