Description of problem: I just installed kernel-2.6.40.3-0.fc15.x86_64.rpm and I found that ioctl on an invalid I_ATMARK now sets errno to ENOTTY. This is not POSIX compliant, man 3 ioctl says that EINVAL (Invalid argument) should be put in errno if the I_ATMARK command fails. Instead now ENOTTY (Inappropriate ioctl for device) is given as errno. Version-Release number of selected component (if applicable): How reproducible: #include <stdio.h> #include <linux/sockios.h> #include <sys/socket.h> #include <sys/ioctl.h> #include <errno.h> int main() { int n, s, optval; s=socket(PF_INET,SOCK_DGRAM,0); if( s == -1 ) perror("errno from socket:"); n=ioctl(s,SIOCATMARK,&optval); perror("errno from ioctl"); if( errno != EINVAL) printf("n=%d errno=%d\n",n,errno); return 0; } Steps to Reproduce: 1. Compile 2. Run 3. Actual results: Inappropriate ioctl for device Expected results: Invalid argument (EINVAL) Additional info:
Until 2.6.38.8-35 ioctl gave the correct errno. This is running sockioctl01 from ltp-full-20110606.
You should file this upstream.
(In reply to comment #3) > This is not POSIX compliant, man 3 ioctl says that EINVAL (Invalid argument) > should be put in errno if the I_ATMARK command fails. I_ATMARK is for POSIX STREAMS devices and is not the same as SIOCATMARK, which takes no arguments. In any case I'm pretty sure ENOTTY is correct if you're trying to use it on a datagram socket.