[comp.os.minix] Problems with the read system call and vol.c

rtregn@immd3.informatik.uni-erlangen.de (Robert Regn) (09/16/88)

I have  gotten a strange behavior of the read system call ruuning the command

tar c . - |vol 360 /dev/fd0  &
(the & because  i don't want to waste a lot of time)

But I saw that the vol runs without waiting for a return when a floppy is to
change. I don't had typed anything since the command !

Printing the return value of 	'read(tty,   ... ' I get -1;
and using perror  'no such  process' !!!
This error can't occur in read.

Is the bug in the system or in my configuration ??
Please try  the command, too.

A little bug in vol.c (you see it only if you need more then 9 disks):


120c120
< 	out[2] = '0' + (n/10);
---
> 	out[0] = '0' + (n/10);

					Robert Regn
					rtregn.faui32.uucp

brucee@runx.ips.oz (Bruce Evans) (09/23/88)

Robert Regn writes

>I have  gotten a strange behavior of the read system call ruuning the command
>tar c . - |vol 360 /dev/fd0  &
>[...]
>Printing the return value of 	'read(tty,   ... ' I get -1;
>and using perror  'no such  process' !!!
>This error can't occur in read.

It is a bug or misfeature. When two processes try to read the same terminal
(the first one having been suspended), the second one fails. The error code
is supposed to be private to FS but goes all the way back to the user process
where it is misinterpreted. This _is_ a bug. Much the same problems affect
writes to terminals.

The right way to fix this is to handle suspensions more in FS than in the
drivers, keeping _all_ the i/o parameters in fproc, and queueing up i/o to
character devices using a chain pointer in fproc.

Bruce Evans
Internet: brucee@runx.ips.oz.au    UUCP: uunet!runx.ips.oz.au!brucee