Bug 732305 - ioctl on invalid I_ATMARK is not POSIX compliant anymore
Summary: ioctl on invalid I_ATMARK is not POSIX compliant anymore
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: kernel
Version: 15
Hardware: x86_64
OS: Linux
unspecified
low
Target Milestone: ---
Assignee: Kernel Maintainer List
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-08-21 19:55 UTC by Vittorio
Modified: 2011-08-30 12:55 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-08-30 12:55:41 UTC


Attachments (Terms of Use)

Description Vittorio 2011-08-21 19:55:39 UTC
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:

Comment 1 Vittorio 2011-08-21 19:58:21 UTC
Until 2.6.38.8-35 ioctl gave the correct errno. 
This is running sockioctl01 from ltp-full-20110606.

Comment 2 Josh Boyer 2011-08-21 21:02:06 UTC
You should file this upstream.

Comment 3 Chuck Ebbert 2011-08-22 15:46:57 UTC
(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.


Note You need to log in before you can comment on or make changes to this bug.