02-05-2008
fifo or named pipe working?
Can someone explain to me the working of fifo() system call using simple C programs so that I can implement them in the UNIX environement?
10 More Discussions You Might Find Interesting
1. Programming
Could someone Help me with this code please?
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include <fcntl.h>
#define SIZE_B 256 /*buffer's size */
#define NUM_ARG 20 /* max number of args for any command */
int... (4 Replies)
Discussion started by: M3xican
4 Replies
2. Filesystems, Disks and Memory
Hello!
How I can increase or decrease predefined pipe buffer size?
System FreeBSD 4.9 and RedHat Linux 9.0
Thanks! (1 Reply)
Discussion started by: Jus
1 Replies
3. UNIX for Advanced & Expert Users
Hello!
How I can increase (or decrease) the predefined pipe buffer size?
Thanks! (1 Reply)
Discussion started by: Jus
1 Replies
4. Shell Programming and Scripting
Hi...Can anyone please guide me on FIFO Pipes in UNIX.I have lerant things like creating fifo pipes,using them for reads and writes etc.I want to know what is the maximum amount of memory that such a pipe may have? Also can anyone guide me on where to get info on this topic from? (1 Reply)
Discussion started by: tej.buch
1 Replies
5. UNIX for Dummies Questions & Answers
Gurus,
I've a File Transaction Server, which communicates with other servers and performs some processing.It uses many Named PIPE's.
By mistake i copied a named PIPE into a text file.
I heard that PIPE files shouldn't be copied.Isn't it?
Since it's a production box, i'm afraid on... (2 Replies)
Discussion started by: Tamil
2 Replies
6. Shell Programming and Scripting
Hi!!
I have a problem reading from a fifo pipe in shell script.
The idea is simple, I have a C program with two pipe files:
An input pipe I use to send commands in shell script to the C program (echo "command" > input.pipe)
An output pipe that I read the result of the command also in... (4 Replies)
Discussion started by: victorin
4 Replies
7. UNIX for Advanced & Expert Users
Hi
This is a exercise question from Unix network programming vol2.
Why the SIGPIPE signal is generated only for writers when readers disappear.
why not it is generated for readers when writer disappears.
I guess, if the writer didn't get any response like the reader gets EOF,
it will... (4 Replies)
Discussion started by: kumaran_5555
4 Replies
8. Programming
Hi guys.
1. how much is the size of pipe?(i mean the buffer size)
2. is this size different in various UNIX derivations?
3. what happens if we write to a full pipe? does it block until get some free space(the other side receive data) or returns an error?
3. FIFO s are physical files on the... (2 Replies)
Discussion started by: majid.merkava
2 Replies
9. Shell Programming and Scripting
I'm trying to read a fifo using awk and comming across some problems. I'm writing to the fifo from multiple processes invoked by GNU Parallel:
mkfifo my_fifo
awk '{ a = a + $2 } END { for (i in a) print i, a }' my_fifo | sort -nk1 > sorted_output
grep -v '^@' massive_file | parallel... (3 Replies)
Discussion started by: nathanhaigh
3 Replies
10. Shell Programming and Scripting
I have created a fifo named pipe in solaris, which writes the content of a file, line by line, into pipe as below:
$ mkfifo namepipe
$ cat books.txt
"how to write unix code"
"how to write oracle code"
$ cat books.txt >> namepipe &
I have a readpipe.sh script which reads the named... (2 Replies)
Discussion started by: naveen mani
2 Replies
LEARN ABOUT DEBIAN
mkfifo
MKFIFO(2) BSD System Calls Manual MKFIFO(2)
NAME
mkfifo, mkfifoat -- make a fifo file
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <sys/types.h>
#include <sys/stat.h>
int
mkfifo(const char *path, mode_t mode);
int
mkfifoat(int fd, const char *path, mode_t mode);
DESCRIPTION
The mkfifo() system call creates a new fifo file with name path. The access permissions are specified by mode and restricted by the umask(2)
of the calling process.
The fifo's owner ID is set to the process's effective user ID. The fifo's group ID is set to that of the parent directory in which it is
created.
The mkfifoat() system call is equivalent to mkfifo() except in the case where path specifies a relative path. In this case the newly created
FIFO is created relative to the directory associated with the file descriptor fd instead of the current working directory. If mkfifoat() is
passed the special value AT_FDCWD in the fd parameter, the current working directory is used and the behavior is identical to a call to
mkfifo().
RETURN VALUES
The mkfifo() function returns the value 0 if successful; otherwise the value -1 is returned and the global variable errno is set to indicate
the error.
ERRORS
The mkfifo() system call will fail and no fifo will be created if:
[ENOTSUP] The kernel has not been configured to support fifo's.
[ENOTDIR] A component of the path prefix is not a directory.
[ENAMETOOLONG] A component of a pathname exceeded 255 characters, or an entire path name exceeded 1023 characters.
[ENOENT] A component of the path prefix does not exist.
[EACCES] A component of the path prefix denies search permission, or write permission is denied on the parent directory of the fifo
to be created.
[ELOOP] Too many symbolic links were encountered in translating the pathname.
[EROFS] The named file would reside on a read-only file system.
[EEXIST] The named file exists.
[EPERM] The parent directory of the named file has its immutable flag set, see the chflags(2) manual page for more information.
[ENOSPC] The directory in which the entry for the new fifo is being placed cannot be extended because there is no space left on the
file system containing the directory.
[ENOSPC] There are no free inodes on the file system on which the fifo is being created.
[EDQUOT] The directory in which the entry for the new fifo is being placed cannot be extended because the user's quota of disk
blocks on the file system containing the directory has been exhausted.
[EDQUOT] The user's quota of inodes on the file system on which the fifo is being created has been exhausted.
[EIO] An I/O error occurred while making the directory entry or allocating the inode.
[EIO] An I/O error occurred while reading from or writing to the file system.
[EFAULT] The path argument points outside the process's allocated address space.
In addition to the errors returned by the mkfifo(), the mkfifoat() may fail if:
[EBADF] The path argument does not specify an absolute path and the fd argument is neither AT_FDCWD nor a valid file descriptor
open for searching.
[ENOTDIR] The path argument is not an absolute path and fd is neither AT_FDCWD nor a file descriptor associated with a directory.
SEE ALSO
chflags(2), chmod(2), mknod(2), stat(2), umask(2)
STANDARDS
The mkfifo() system call is expected to conform to ISO/IEC 9945-1:1990 (``POSIX.1''). The mkfifoat() system call follows The Open Group
Extended API Set 2 specification.
HISTORY
The mkfifoat() system call appeared in FreeBSD 8.0.
BSD
April 10, 2008 BSD