[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 05/24] Introduce locking functions for block device setup on NetBSD



Manuel Bouyer writes ("Re: [PATCH 05/24] Introduce locking functions for block 
device setup on NetBSD"):
> Yes, at last the stat call will need to be patched.
> But it seems to rely on a linux-specific behavoir, which is that
> /dev/stdin points to the real file on redirection:
> >ls -l /dev/stdin /proc/self/fd/0 < /etc/passwd
> lrwxrwxrwx 1 root   root      15 Apr 30  2019 /dev/stdin -> /proc/self/fd/0
> lr-x------ 1 bouyer ita-iatos 64 Jan 20 16:54 /proc/self/fd/0 -> /etc/passwd
> 
> On NetBSD (and I guess other BSDs) this won't work, as /dev/stdin is a
> specific device:
> >ls -l /dev/stdin 
> crw-rw-rw-  1 root  wheel  22, 0 Nov 15  2007 /dev/stdin
> 
> so stat -L will always return the same data. We can't use the same
> protocol.

Ah.

The manpage I am looking at says:

     If no argument is given, stat displays information about the
     file descriptor for standard input.

Here NetBSD has a better command line API than Linux - Linux requires
pratting about with /dev/stdin and NetBSD doesn't.  So I think
where on Linux we have
   stat .... /dev/stdin
on NetBsd we can simply have
   stat ....
with no filename argument.

I think NetBSD's stat(1) also takes different argumnts to specify the
format.  NetBSD uses -f, whereas Linux uses -c.  So the exact rune
will have to be different.

Ian.



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.