Messages in this thread |  | | | Date | Wed, 27 Apr 2011 16:22:24 +0800 | | From | Lifeng Sun <> | | Subject | Re: [PATCH] Applying inappropriate ioctl operation on socket should return ENOTTY |
| |
On 08:57 Wed 04/27/11 Apr, Eric Dumazet wrote: > You quote manpage for a library call, not a system call.
okay, let me quote the one for ioctl system call:
man 2 ioctl
int ioctl(int d, int request, ...);
ERRORS EBADF d is not a valid descriptor. EFAULT argp references an inaccessible memory area. EINVAL Request or argp is not valid. 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.
we see ENOTTY and EFAULT refine EVINAL and it should return ENOTTY or EFAULT whenever possible rather than EINVAL, otherwise we could always return EBADF or EINVAL.
Regarding to isatty, well, it's only a library call, isn't it? :-) If you insist on the significance of the manpage of isatty, there are also a lot of ioctl operations return ENOTTY, if not less than those return EINVAL, for inappropriated command and eventually violate the ERRORS section of the manpage. Certainly we could complain to c library maintainers.
> If you feel your glibc doesnt implement well this, please complain to > glibc maintainer.
--
|  |