Subject: Re: read() EINVAL
To: Manuel Bouyer <bouyer@antioche.eu.org>
From: Patrick Welche <prlw1@newn.cam.ac.uk>
List: netbsd-help
Date: 05/21/2003 14:58:12
On Mon, May 19, 2003 at 10:06:32PM +0200, Manuel Bouyer wrote:
> On Sun, May 18, 2003 at 11:11:18PM +0100, Patrick Welche wrote:
> > Any idea how I can get EINVAL from a read() call? The man page suggests
> >
> > [EINVAL] The pointer associated with d was negative.
> >
> > [EINVAL] The total length of the I/O is more than can be expressed
> > by the ssize_t return value.
> >
> > but this is coming from a read of a dvd, with fd=3, requesting 9*2048 bytes.
> > Or maybe I don't understand "pointer associated with". d=3, so >0. What is
> > the pointer associated with fd=3?
>
> In this case I guess you get the EINVAL from the underlying driver.
> Maybe the sector size isn't 2048 ?
> an EINVAL can also be returned in case a command is terminated with
> INVALID REQUEST. Does the kernel print some error message ?
No error messages. This is what debug has to say:
2048 bytes @ blk 1212
command: 0x28,0x0,0x0,0x0,0x1,0x2f,0x0,0x0,0x1,0x0,0x0,0x0-[2048 bytes]
18432 bytes @ blk 1216
command: 0x28,0x0,0x0,0x0,0x1,0x30,0x0,0x0,0x9,0x0,0x0,0x0-[18432 bytes]
65536 bytes @ blk 1636
command: 0x28,0x0,0x0,0x0,0x1,0x99,0x0,0x0,0x20,0x0,0x0,0x0-[65536 bytes]
8192 bytes @ blk 1764
command: 0x28,0x0,0x0,0x0,0x1,0xb9,0x0,0x0,0x4,0x0,0x0,0x0-[8192 bytes]
8192 bytes @ blk 1764
command: 0x28,0x0,0x0,0x0,0x1,0xb9,0x0,0x0,0x4,0x0,0x0,0x0-[8192 bytes]
------------------------------
000: 00 16 c0 00 00 16 c0 bc 00 16 c1 a9 00 16 c2 cc
016: 00 16 c3 c2 00 16 c4 a0 00 16 c5 57 00 16 c6 22
032: 00 16 c6 cd 00 16 c7 ec 00 16 c8 f0 00 16 c9 c2
048: 00 16 ca 7e 00 16 cb 1b 00 16 cc 04 00 16 cc e2
------------------------------
18432 bytes @ blk 7638228
command: 0x1e,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0-[0 bytes]
Now, there's an odd block number..
BTW re doco, scsi(4) mentions options SCSIDEBUG, but I had to look in
scsictl.c to find that you need options SCSIPI_DEBUG, and scsictl(8) doesn't
mention the debug command.. (Time for a patch? Does SCSIDEBUG do anything?)
Cheers,
Patrick