Skip to contentSkip to conversation

ENOTTY from ext3 code?

DISCUSSION Pavel Machek 6 participants 6 messages Feb 19, 2002

lore
Share & tools
lore
#0 lore raw

Hi!

ext3/ioctl.c:

...

	return -ENOTTY;

Does it really make sense to return "not a typewriter" from ext3 ioctl?
Pavel

Signature · 2 lines
(about SSSCA) "I don't say this lightly.  However, I really think that the U.S.
no longer is classifiable as a democracy, but rather as a plutocracy." --hpa
#1 lore raw
Quoted 9 lines · Pavel Machek

Hi!

ext3/ioctl.c:

...

	return -ENOTTY;

Does it really make sense to return "not a typewriter" from ext3 ioctl?

s/typewriter/teletype/ and ext3 indeed is not one (and thus shouldn't _have_ ioctl() in the first place). Seriously, -ENOTTY is normal error for "I don't know anything about that ioctl".

#2 lore raw
In reply to Pavel Machek
Quoted 9 lines · Pavel Machek

Hi!

ext3/ioctl.c:

...

	return -ENOTTY;

Does it really make sense to return "not a typewriter" from ext3 ioctl?

But yes! The de-facto return code for a file-system ioctl() that is undefined, i.e., wrong parameter, is ENOTTY. This is because it really means "Not a terminal". Terminals have the most ioctls.

Cheers,
Dick Johnson

Penguin : Linux version 2.4.1 on an i686 machine (797.90 BogoMips).

        111,111,111 * 111,111,111 = 12,345,678,987,654,321
#3 lore raw
In reply to Pavel Machek
Quoted 10 lines · Pavel Machek

Hi!

ext3/ioctl.c:

...

        return -ENOTTY;

Does it really make sense to return "not a typewriter" from ext3 ioctl?

ERRORS
...

ENOTTY d is not associated with a character special
device.

ENOTTY The specified request does not apply to the kind of
object that the descriptor d references.

Lots and lots of ioctls return ENOTTY when passed a request which they don't understand. There's probably a great reason for this, but I can't immediately think what it might be.

-

#4 lore raw
In reply to Pavel Machek
Quoted 12 lines · Andrew Morton
Quoted 7 lines · Pavel Machek

ext3/ioctl.c:

...

        return -ENOTTY;

Does it really make sense to return "not a typewriter" from ext3 ioctl?

ERRORS
...

Quoted 6 lines

ENOTTY The specified request does not apply to the kind of
object that the descriptor d references.

Lots and lots of ioctls return ENOTTY when passed a request which they don't understand. There's probably a great reason for this, but I can't immediately think what it might be.

Well, returning ENOTTY for unknown ioctls instead of EINVAL allows you to distinguish between 'I have no idea what you are asking of me' and 'you passed me the incorrect parameter to this request' in the caller.

Cheers, Andreas
--
Andreas Dilger
http://sourceforge.net/projects/ext2resize/
http://www-mddsp.enel.ucalgary.ca/People/adilger/

#5 lore raw
In reply to Pavel Machek
Quoted 7 lines · Pavel Machek

ext3/ioctl.c:

...

	return -ENOTTY;

Does it really make sense to return "not a typewriter" from ext3 ioctl?

I suppose you know the definition of ENOTTY?

Quoting POSIX:
[ENOTTY] Inappropriate I/O control operation.