SUMMARY: Is this a job for a pseudo-device driver?

SUMMARY: Is this a job for a pseudo-device driver?

Post by Kevin Weinri » Wed, 20 Nov 1991 23:21:19



The solution (as so MANY helpful people pointed out) is to

most like what I wound up using:
        % mknod /tmp/fake p
        % swab < /cdrom/real > /tmp/fake &
        % tar xvf /tmp/fake
        <tar runs normally>

Special thanks also to:
Gordon L. Burditt       sneaky.lonestar.org!gordon


 
 
 

SUMMARY: Is this a job for a pseudo-device driver?

Post by Kevin Weinri » Thu, 21 Nov 1991 07:37:41


My struggles aren't over yet.  One last (Yeah, right) snafu.

Page 53 of Sun's "Programming Utilities & Libraries" manual (OS 4.1.1)
says "Unlike ordinary pipes, when the processes terminate, the named pipe
remains available for use by other processes."  Unfortunately,
my named pipe seems to be only good for one use, then I have to
recreate it.  Any ideas what I'm doing wrong?
Here's how I create it:
  /usr/etc/mknod kw.bil p
# swab is my little utility for transposing bytes from a file off the  
# CD-ROM
  swab < /cdrom/image/raster/topo/etopo5b >kw.bil &

Here's how I use it:
  wc kw.bil
The system responds correctly:
     19375   28186 4672082 kw.bil
but then immediately tells me that my named pipe has finished:
  [1]  + Exit 155             swab < /cdrom/image/raster/topo/etopo5b > kw.bil
If I try to run it (wc kw.bil) again, it just sits there, no action
on the CD-ROM, until I kill it.  It's the same story if I use:
  cp kw.bil junk
It works once, then no more.
Am I invoking it wrong?  This is the way a # of folks suggested I do
it.  Or is the manual fibbing?  Did I misunderstand the manual --
does it mean that I can associate something ELSE BESIDES swab with
kw.bil after the first time I invoke it?  What if I just want to
always associate:
  swab < /cdrom/image...  
with kw.bil?  Can I do that?

Thanks for all your past and future help --


 
 
 

SUMMARY: Is this a job for a pseudo-device driver?

Post by Mike Murp » Thu, 21 Nov 1991 09:43:34



>The solution (as so MANY helpful people pointed out) is to

>most like what I wound up using:
>    % mknod /tmp/fake p
>    % swab < /cdrom/real > /tmp/fake &
>    % tar xvf /tmp/fake
>    <tar runs normally>

This is certainly slick, but what's wrong with
        % dd if=/cdrom/real conv=swab|tar xvf -
?
:-)
--

Optigraphics Corporation  9339 Carroll Park Drive  San Diego, CA  92121
The opinion(s) expressed above are  mine  and not those of my employer.
 
 
 

SUMMARY: Is this a job for a pseudo-device driver?

Post by Blair P. Hought » Fri, 22 Nov 1991 10:10:02




>    % mknod /tmp/fake p
>    % swab < /cdrom/real > /tmp/fake &
>    % tar xvf /tmp/fake
>    <tar runs normally>

Chris, what's the diff between that and (as Gary Mills
seems to have pointed out)

    swab < /cdrom/real | tar xvf -

except that the named pipe is (as Kevin realized)
still open after tar's done _and_ liable to scribbling
during the tar?

                                --Blair
                                  "There's a joke about decks
                                   and mops in there, but it'd
                                   bomb with this audience..."

 
 
 

SUMMARY: Is this a job for a pseudo-device driver?

Post by Barry Margol » Fri, 22 Nov 1991 15:10:08





>>        % mknod /tmp/fake p
>>        % swab < /cdrom/real > /tmp/fake &
>>        % tar xvf /tmp/fake
>>        <tar runs normally>

>Chris, what's the diff between that and (as Gary Mills
>seems to have pointed out)

>    swab < /cdrom/real | tar xvf -

Several people have made this remark.  Apparently, you're all forgetting
the original problem: the user is trying to filter input to a program that
only reads from a named file, not standard input (and he's presumably not
using a system with /dev/stdin or /dev/fd).

Context is a wonderful thing....
--
Barry Margolin, Thinking Machines Corp.


{uunet,harvard}!think!barmar

 
 
 

SUMMARY: Is this a job for a pseudo-device driver?

Post by Kevin Weinri » Sat, 23 Nov 1991 03:31:46


Permit me to clarify my original purpose.  As Barry said, I'm using a
program that requires me to input a filename.  I can't use stdin.  I
originally used the tar example because everybody who's used tar is
familiar with using a file-that's-not-a-file in tar (e.g., "tar xf /dev/rst0").
I really don't care about tar at all.  I was a little too brief in my
initial example of how I envisioned this pseudo-device driver working.
Now I know that what I really want is a named pipe.  Sorry for the
confusion.


 
 
 

1. Is this a job for a pseudo-device driver?

(context: I'm working on a Sun SPARCstation - OS 4.1.1.)
I'm using a program that won't let me re-direct I/O to it --
it requires me to specify an input filename.  The trouble is,
the input file I have on my CD-ROM is byte-order-reversed from
what the program wants.  I wrote a little swap program (functions
like swab(3)) to do what I want, but I'd rather not have to create
an intermediate file.  I'd rather specify (to the rather rigid
initial program) a file-that's-not-really-a-file -- that is,
a file that, when read from, will actually run my swap program,
getting its input from the afore-mentioned byte-order-reversed
file.  My vision is that if, for example, /cdrom/file.rev is a
byte-order-reversed tar file, and /dev/swap.file.rev is a
pseudo-file that knows to read from /cdrom/file.rev and output
its bytes in reversed order, I could then say:
   tar xvf /dev/file.rev
and the extraction would proceed properly.

The Big Question: Do I need to convert my swap program into a
'pseudo-device driver', and, if so, how?  I've read the intro and
the 'Pseudo-Device Drivers' chapter in the "Writing Device drivers"
manual, yet haven't been able even to determine if I'm barking
up the right tree, let alone how to do it.

Does anyone have any tips on or examples of this type of project?
The RAM-disk example program in the manual had a whole *three*
comments to explain its black art, so any tips would be welcome.


2. XF86-3.1 Chips&Tech Server

3. STREAMS message from pseudo-device to pseudo-device

4. Welcome to comp.unix.questions [Frequent posting]

5. Pseudo-Device Driver in Solaris 2.x

6. grep for null

7. Help developing a pseudo-device driver ?

8. RH 5.1 Install and LILO can't see Filesystems on Compaq Aero Laptop

9. May 23 10:50:05 mwsbit04 pseudo: [ID 129642 kern.info] pseudo-device: devinfo0

10. SUMMARY: How to change the number of the pseudo devices?

11. Network Pseudo-device question

12. undefined pseudo-device abcd

13. pseudo-device error in messages