[comp.unix.questions] mknod for BSD 4.3

quang@CSUFRES.CSUFRESNO.EDU (Quang Ngo) (04/22/91)

The man page section 2 says that only super-user can access mknod().  Is 
there any other funtion that does what mknod() does?  Our system doesn't
have fifo().  /etc/mknod is not accessable by users. Too bad, I can't
even do a system("/etc/mknod ....") call.

Any suggestions?

-Quang (quang@csufres.CSUFresno.EDU)

jik@athena.mit.edu (Jonathan I. Kamens) (04/22/91)

  Are you trying to use mknod to create a named pipe or fifo?

  If so, then that's yur problem.  BSD 4.3 does not support them.  The
"mknod" program under BSD 4.3 can only be used to make special
devices, not named pipes or fifos.

Jonathan Kamens			              USnail:
MIT Project Athena				11 Ashford Terrace
jik@Athena.MIT.EDU				Allston, MA  02134
Office: 617-253-8085			      Home: 617-782-0710

jmason@gpu.utcs.utoronto.ca (Jamie Mason) (04/22/91)

In article <9104220651.AA13912@csufres.CSUFresno.EDU> quang@CSUFRES.CSUFRESNO.EDU (Quang Ngo) writes:
>The man page section 2 says that only super-user can access mknod().  Is 
>there any other funtion that does what mknod() does?  Our system doesn't
>have fifo().  /etc/mknod is not accessable by users. Too bad, I can't
>even do a system("/etc/mknod ....") call.

	I would be very surprised if the manual is correct, then.  On 
systems with named pipes, mknod() is not usually a root-only call.  
Rather, you can call mknod(), but mknod() will return EACESS if you try
to make a device with it.  This is from the MKNOD(2) man page of 
SunOS 4.1.1:

     mknod() may be invoked only by the super-user for file types
     other than FIFO special.


	SunOS is of the BSD flavour -- so I would expect that 4.3BSD
would act in basically the same way.  Why not try an mknod() call and
see if you get your named pipe?

	As for /usr/etc/mknod, that is just local policy, isn't it?  Even
if it *were* acessible to all users, I doubt it would be suid root,
therefore whether you use that, or a program of your own creation, is
irrelevant.  mknod(8) (the program) is just a stupid thing wrapper around
mknod(2) (the system call).

Jamie  ...  Segmentation fault (core dumped)
Written On  Monday, April 22, 1991  at  03:50:16am EDT

guy@auspex.auspex.com (Guy Harris) (04/24/91)

>	SunOS is of the BSD flavour

SunOS is actually more like Neapolitan. :-)  (Actually, the version of
that joke that I saw described AIX in those terms, but....)

I.e., it's of *several* flavors; it has some BSD stuff, some S5 stuff,
and some SunOS stuff.  ("Neapolitan" being a term used, at least in the
US, to refer to ice cream with vanilla, chocolate, and strawberry
regions.)

>-- so I would expect that 4.3BSD would act in basically the same way.

Nope.  The fact that "mknod()" makes FIFOs comes from the S5 chunk of
the ice cream bar, not the 4.3BSD chunk.