1 /* Pipe FD related functions. */
9 #include <sys/eventfd.h>
27 for (i
= 0; i
< MAX_PIPE_FDS
; i
+=2) {
28 if (pipe(pipes
) < 0) {
29 perror("pipe fail.\n");
32 shm
->pipe_fds
[i
] = pipes
[0];
33 shm
->pipe_fds
[i
+1] = pipes
[1];
35 output(2, "fd[%d] = pipe\n", shm
->pipe_fds
[i
]);
36 output(2, "fd[%d] = pipe\n", shm
->pipe_fds
[i
+1]);
40 int rand_pipe_fd(void)
42 return shm
->pipe_fds
[rand() % MAX_PIPE_FDS
];