ASF Bugzilla – Attachment 18949 Details for
Bug 40651
Orphaned piped logger process after graceful restart
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
Small test program for dup2
dup2_test.c (text/plain), 808 bytes, created by
Ruediger Pluem
on 2006-10-02 02:43:12 UTC
(
hide
)
Description:
Small test program for dup2
Filename:
MIME Type:
Creator:
Ruediger Pluem
Created:
2006-10-02 02:43:12 UTC
Size:
808 bytes
patch
obsolete
> >#include <stdio.h> >#include <sys/types.h> >#include <sys/wait.h> >#include <unistd.h> >#include <stdlib.h> >#include <string.h> > >#define BUFSIZE 1024 > >int main(int argc, char *argv[]) >{ > int pipefds[2]; > pid_t pid; > char *buf; > > buf = malloc(BUFSIZE); > pipe(pipefds); > if ((pid = fork()) != 0) { > /* Parent */ > int status; > > strcpy(buf, "Hello World!\n"); > close(pipefds[0]); > dup2(pipefds[1], 2); > write(pipefds[1], buf, strlen(buf)+1); > close(pipefds[1]); > pipe(pipefds); > dup2(pipefds[1], 2); > waitpid(pid, &status, 0); > } > else { > /* Child */ > close(pipefds[1]); > read(pipefds[0], buf, BUFSIZE); > printf("Child: %s", buf); > read(pipefds[0], buf, BUFSIZE); > } > return 0; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 40651
:
18944
|
18945
|
18946
|
18947
| 18949 |
18950
|
18952
|
18954