We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fifo
When all ends of fifo are closed, data should be discarded. Reproduction:
#include <stdio.h> #include <fcntl.h> #include <unistd.h> #include <stdlib.h> #include <string.h> #include <sys/stat.h> #include <errno.h> int main(void) { int fd_w, fd_r; ssize_t ret; char *msg = "abcdefghifjklm"; if (mkfifo("fifo", 0666) < 0) { perror("mkfifo"); exit(EXIT_FAILURE); } if ((fd_r = open("fifo", O_RDONLY | O_NONBLOCK)) < 0) { perror("open"); exit(EXIT_FAILURE); } if ((fd_w = open("fifo", O_WRONLY)) < 0) { perror("open"); exit(EXIT_FAILURE); } if (write(fd_w, msg, strlen(msg)) != strlen(msg)) { perror("write"); exit(EXIT_FAILURE); } close(fd_r); close(fd_w); if ((fd_r = open("fifo", O_RDONLY | O_NONBLOCK)) < 0) { perror("open"); exit(EXIT_FAILURE); } if ((fd_w = open("fifo", O_WRONLY)) < 0) { perror("open"); exit(EXIT_FAILURE); } if ((ret = read(fd_r, msg, strlen(msg))) < 0) { perror("read"); exit(EXIT_FAILURE); } printf("read: %zd\n", ret); printf("errno: %d\n", errno); return 0; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
When all ends of fifo are closed, data should be discarded.
Reproduction:
The text was updated successfully, but these errors were encountered: