I wrote a simple program to have cat pipe its output into less through a FIFO. The write works fine, but the child won't exit after writing to the FIFO. Another program needs to read from the FIFO for it to exit, but the parent (less) must wait for the data to become available to read the FIFO. So essentially, I have a deadlock.
Here's the code:
I just want to know how I can have one program write to a FIFO through its standard output and the other program read from the FIFO through its standard input.
Also, I can't use anonymous pipes, due to losing control over I/O at the exec.
---------- Post updated at 06:11 PM ---------- Previous update was at 06:06 PM ----------
Problem solved. I changed the parent to call wait() after opening the FIFO on standard input.
I have unix sco server. I have created one application for client server communication. On this I have creted some fifos/pipes.
The reader.123 fifo is used by one process for reading and writing. I haven't deleted that fifo. But ls or find command doesn't show it. It is giving error as file or... (1 Reply)
Generally, most people, I guess, go from 5.3 ML4 Directly to TL 7. So they may never run into this issue.
For the rest of us, here is the resolution of my problem in going from ML6 to TL7.
Apparently with the change from ML to TL IBM added a "BuildDate Verification" routine into... (1 Reply)
Hello,
Going through book, "Guide to UNIX Using Linux". I am doing one of the projects that has me writing scripts to join files. Here is my pnumname script and I am extracting the programmers names and numbers from the program file and redirecting the output to the file pnn. I then created a... (0 Replies)
Hi,
This is the script that am trying to execute.
a= sar 1 5 | grep ^A | awk '{print $5}'
echo $a
i am getting output.
99
i get a blank space for echo $a.
Why is the value not getting assigned to a??
Thanks in Advance.
How to use code tags (6 Replies)
Hi
I want to make a script . In this script i want to use input file and this input file consist of three numbers in a line
for example input file is as below:
919876543210 09876543234567876 98764534245678 aircelmms","aircelweb","aircelwap"
096574235625... (2 Replies)
hi All,
I am using the command
find /home/mqm/check/ -mtime +1|wc -l
to get a count of the files older than a day under the check directory. But instead of getting the count of the files under check directory I m getting a count including the check directory itself. Can someone please tell... (0 Replies)
Hi,
I'm new to sh scripting and have the following problem. I have a script to sftp that is now working with ssh key. But i need to change this, i wan't to sftp with a password. I have the following script, tried a lot to make a variabel for the password. But i can't make it work
... (2 Replies)
Hi,
i have a problem with this script:
for i in $(cat list_ip_switch)
do
if
if ; then
echo "found ip"
else
echo "not found ip"
fi
done
cat list_ip_switch
10.155.249.171
10.155.249.172 (3 Replies)
I facing a problem :
I have a Source and Destination directory. The Source directory is linked to SVN and is updated by the Script to Head Revision.
After that i copy the Source to Destination by this command:
cp -r /SOURCE PATH /DESTIUNATION PATH
Now if a delete a file in source and... (5 Replies)
Discussion started by: ankur328
5 Replies
LEARN ABOUT LINUX
mkfifo
MKFIFO(3) Linux Programmer's Manual MKFIFO(3)NAME
mkfifo - make a FIFO special file (a named pipe)
SYNOPSIS
#include <sys/types.h>
#include <sys/stat.h>
int mkfifo(const char *pathname, mode_t mode);
DESCRIPTION
mkfifo() makes a FIFO special file with name pathname. mode specifies the FIFO's permissions. It is modified by the process's umask in
the usual way: the permissions of the created file are (mode & ~umask).
A FIFO special file is similar to a pipe, except that it is created in a different way. Instead of being an anonymous communications chan-
nel, a FIFO special file is entered into the file system by calling mkfifo().
Once you have created a FIFO special file in this way, any process can open it for reading or writing, in the same way as an ordinary file.
However, it has to be open at both ends simultaneously before you can proceed to do any input or output operations on it. Opening a FIFO
for reading normally blocks until some other process opens the same FIFO for writing, and vice versa. See fifo(7) for nonblocking handling
of FIFO special files.
RETURN VALUE
On success mkfifo() returns 0. In the case of an error, -1 is returned (in which case, errno is set appropriately).
ERRORS
EACCES One of the directories in pathname did not allow search (execute) permission.
EEXIST pathname already exists. This includes the case where pathname is a symbolic link, dangling or not.
ENAMETOOLONG
Either the total length of pathname is greater than PATH_MAX, or an individual filename component has a length greater than
NAME_MAX. In the GNU system, there is no imposed limit on overall filename length, but some file systems may place limits on the
length of a component.
ENOENT A directory component in pathname does not exist or is a dangling symbolic link.
ENOSPC The directory or file system has no room for the new file.
ENOTDIR
A component used as a directory in pathname is not, in fact, a directory.
EROFS pathname refers to a read-only file system.
CONFORMING TO
POSIX.1-2001.
SEE ALSO mkfifo(1), close(2), open(2), read(2), stat(2), umask(2), write(2), mkfifoat(3), fifo(7)COLOPHON
This page is part of release 3.27 of the Linux man-pages project. A description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
GNU 2008-06-12 MKFIFO(3)