Re: funny inconsistency in error returns

Rogier Wolff (R.E.Wolff@BitWizard.nl)
Mon, 22 Feb 1999 12:53:19 +0100 (MET)


Andreas Schwab wrote:
> Andries.Brouwer@cwi.nl writes:
>
> |> I see ENXIO upon open("/dev/hdd"), and ENODEV upon open("/dev/hde");
> |> It is clear why this happens
> |> (hde has major 33, and blkdev_open does not know it and returns -ENODEV;
> |> hdd has major 22, known since hdc exists, and ide_open returns -ENXIO).
> |> Both error numbers are OK, but the inconsistency is a microscopic flaw.
> |> Maybe ide_open() should also return ENODEV.
>
> I think both should be using ENXIO. From the glibc docs:
>
> - Macro: int ENXIO
> No such device or address. The system tried to use the device
> represented by a file you specified, and it couldn't find the
> device. This can mean that the device file was installed
> incorrectly, or that the physical device is missing or not
> correctly attached to the computer.
>
> - Macro: int ENODEV
> The wrong type of device was given to a function that expects a
> particular sort of device.

Intuitively I'd have said that ENODEV would also be for the "this
device doesn't exist" case. I just checked, but sunos 4.x, HPUX 9 and
Irix 5.x (Jees, what an old bunch) all agree with the above
explanation. They also copied the manpage around litterally.

Roger.

-- 
** R.E.Wolff@BitWizard.nl ** http://www.BitWizard.nl/ ** +31-15-2137555 **
*-- BitWizard writes Linux device drivers for any device you may have! --*
*   Never blow in a cat's ear because if you do, usually after three or  *
*   four times, they will bite your lips!  And they don't let go for at  *
*   least a minute. -- Lisa Coburn, age 9

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/