Named pipe with mknod

Named pipe with mknod

Post by gor.. » Tue, 01 Oct 1996 04:00:00



Compile the program below and run it. On FreeBSD it produces:
mknod: Invalid argument

Why ??
I thought this should run on FreeBSD without using mkfifo.

################################################################################

#include <stdio.h>
#include <unistd.h>
#include <sys/stat.h>

main()
{

  if ( (mknod("fifo", S_IFIFO|0666, 0))==-1 )
    perror("mknod");

Quote:}

 
 
 

Named pipe with mknod

Post by Terry Lamber » Tue, 01 Oct 1996 04:00:00


] Compile the program below and run it. On FreeBSD it produces:
] mknod: Invalid argument
]
] Why ??
] I thought this should run on FreeBSD without using mkfifo.

]   if ( (mknod("fifo", S_IFIFO|0666, 0))==-1 )
]     perror("mknod");

Because mknod() can't make FIFO's.

For Linux and IBCS2 compatability, the system call, when called
from those binaries, *will* make a FIFO.

This is a generic BSD'ism, and has been around forever (since
back when FIFO's weren't unified with an FS switch).  It should
probably be changed to conform with reality, and the mkfifo()
call should be legacied into libcompat as a call to mknod.  This
is one of the *few* occasions where "BSD flavor" is sour.

                                        Terry Lambert

---
Any opinions in this posting are my own and not those of my present
or previous employers.

 
 
 

Named pipe with mknod

Post by J Wuns » Tue, 01 Oct 1996 04:00:00



> Compile the program below and run it. On FreeBSD it produces:
> mknod: Invalid argument

     [EINVAL]      The pathname contains a character with the high-order bit
                   set.

Well, this doesn't seem to be your answer either. :-)

Quote:> Why ??
> I thought this should run on FreeBSD without using mkfifo.

No.  UTSL.  You can easily see that the kernel will only allow VCHR
and VBLK nodes.  (Plus all IFMT bits set, the comment says that
badsect uses this to flag bad sectors.  Legacy.)

--
cheers, J"org


Never trust an operating system you don't have sources for. ;-)

 
 
 

Named pipe with mknod

Post by Bruce Eva » Wed, 02 Oct 1996 04:00:00




>Compile the program below and run it. On FreeBSD it produces:
>mknod: Invalid argument

>Why ??
>I thought this should run on FreeBSD without using mkfifo.

FreeBSD supports the POSIX syscall mkfifo().  There is no reason to
use mknod() to create named pipes except for backwards compatibility,
and since old BSDs didn't support named pipes there is nothing to be
backwards compatible with.  There is no reason to support creating named
pipes using mknod() since anything that uses it must be misconfigured.
--

 
 
 

Named pipe with mknod

Post by Frederic G. MARA » Wed, 02 Oct 1996 04:00:00



>FreeBSD supports the POSIX syscall mkfifo().  There is no reason to
>use mknod() to create named pipes except for backwards compatibility,
>and since old BSDs didn't support named pipes there is nothing to be
>backwards compatible with.  

There is one compatiblity reason: the command-line (not syscall) for
System V mknod includes the "p" argument for creating a named pipe. It
is therefore more easy to remember than a specific syscall.

Granted, the gain is minimal, but not null.

 
 
 

Named pipe with mknod

Post by J Wuns » Sun, 06 Oct 1996 04:00:00



Quote:> There is one compatiblity reason: the command-line (not syscall) for
> System V mknod includes the "p" argument for creating a named pipe. It
> is therefore more easy to remember than a specific syscall.

But that's only (fully) true for SVR3.  With SVR4, there's the same
mkfifo command available, and it's usually less hidden than the mknod
command.  (SVR3 mknod was often /etc/mknod, so you wouldn't find that
command on BSD at all, either.)

--
cheers, J"org


Never trust an operating system you don't have sources for. ;-)

 
 
 

1. named pipes with mknod

I am having trouble creating named pipes with mknod.  I would like to
enable my .plan file to do conditional operations for an informational
application that I have in mind.  I would be appreciative if someone
could post or e-mail me an example of linking an executable to a .plan
finger file.

Thank you,

Kevin Huber
CPE Student

2. linksys 10/100 56k pcmcia card probs

3. named pipes using mknod

4. Request for help

5. Named pipes and mknod...

6. hp-ux 11i: named error message

7. Any compatibility between Unix Named Pipes and NT Named Pipes??

8. Kernel (2.4.2) BUG? using NVIDIA_kernel 1.0.1251

9. NFS mknod pipe failure: OpenBSD server, SunOS client

10. help: mknod and pipe file

11. Help needed pipes and named pipes

12. exit status of the command in pipe from shell & named pipe

13. Regular pipe vs. Named Pipe