in reply to Re^4: named pipe and "Text file busy"
in thread named pipe and "Text file busy"
Here's the small C program to write to the FIFO I used:
Is this how you are opening the file? When I run this program without the tail -f in the other window, I get ERRNO 6, "Device not configured", not "Text file busy". If I use open without the O_NONBLOCK the program hangs in the open as we both expect.#include <stdio.h> #include <errno.h> #include <fcntl.h> #include <string.h> int main(void) { char buf[100]; int fd = open("file.fifo", O_NONBLOCK|O_WRONLY); if (fd < 0) { fprintf(stderr, "error (%d): %s\n", errno, strerror(er +rno)); return 1; } sprintf(buf, "%s\n", "a new line"); int bytes = write(fd, buf, strlen(buf) + 1); printf("wrote %d bytes", bytes); close(fd); return 0; }
---
echo S 1 [ Y V U | perl -ane 'print reverse map { $_ = chr(ord($_)-1) } @F;'
Warning: Any code posted by tuxz0r is untested, unless otherwise stated, and is used at your own risk.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: named pipe and "Text file busy"
by finpro (Novice) on Nov 26, 2007 at 13:36 UTC | |
by tuxz0r (Pilgrim) on Nov 26, 2007 at 20:44 UTC |