7 /* fifo client test program
11 /* fifo_open creates a FIFO, then attempts to open it for writing
12 /* with non-blocking mode enabled. According to the POSIX standard
13 /* the open should succeed.
15 /* Problems are reported to the standard error stream.
19 /* The Secure Mailer license must be distributed with this software.
22 /* IBM T.J. Watson Research
24 /* Yorktown Heights, NY 10598, USA
34 #define FIFO_PATH "test-fifo"
35 #define perrorexit(s) { perror(s); exit(1); }
37 static void cleanup(void)
39 printf("Removing fifo %s...\n", FIFO_PATH
);
40 if (unlink(FIFO_PATH
))
45 static void stuck(int unused_sig
)
47 printf("Non-blocking, write-only open of FIFO blocked\n");
52 int main(int unused_argc
, char **unused_argv
)
54 (void) unlink(FIFO_PATH
);
55 printf("Creating fifo %s...\n", FIFO_PATH
);
56 if (mkfifo(FIFO_PATH
, 0600) < 0)
58 signal(SIGALRM
, stuck
);
60 printf("Opening fifo %s, non-blocking, write-only mode...\n", FIFO_PATH
);
61 if (open(FIFO_PATH
, O_WRONLY
| O_NONBLOCK
, 0) < 0) {
66 printf("Non-blocking, write-only open of FIFO succeeded\n");