Austin Group Defect Tracker

Aardvark Mark IV


Viewing Issue Simple Details Jump to Notes ] Issue History ] Print ]
ID Category Severity Type Date Submitted Last Update
0000943 [1003.1(2013)/Issue7+TC1] System Interfaces Comment Omission 2015-05-01 08:14 2019-06-10 08:54
Reporter EdSchouten View Status public  
Assigned To ajosey
Priority normal Resolution Accepted As Marked  
Status Closed  
Name Ed Schouten
Organization Nuxi
User Reference
Section open() and openat()
Page Number 1395
Line Number 46152
Interp Status Approved
Final Accepted Text See Note: 0002710.
Summary 0000943: open() and openat() fail to describe what happens when opening a socket
Description When I take a look at various operating systems, I observe the following:

NetBSD:

$ ls -l /var/run/log
srw-rw-rw- 1 root wheel 0 May 1 10:01 /var/run/log
$ cat /var/run/log
cat: /var/run/log: Operation not supported

FreeBSD:

$ ls -l /var/run/log
srw-rw-rw- 1 root wheel 0 Mar 15 15:32 /var/run/log=
$ cat /var/run/log
cat: /var/run/log: Protocol wrong type for socket

Linux:

$ ls -l /var/run/acpid.socket
srw-rw-rw- 1 root root 0 mei 1 09:58 /var/run/acpid.socket=
$ cat /var/run/acpid.socket
cat: /var/run/acpid.socket: No such device or address

Three different systems, three different error codes. If I look at the description of open() and openat(), it seems that there's also no error code reserved for this situation.
Desired Action Pick a relevant error code and have it documented, so that operating systems can come up with a uniform way of dealing with this condition.
Tags tc2-2008
Attached Files

- Relationships

-  Notes
(0002645)
geoffclare (manager)
2015-05-01 08:38

It could be argued that the standard already requires EOPNOTSUPP for this, as XSH 2.3 describes this error as "Operation not supported on socket" and says in the introductory paragraphs "Implementations shall not generate a different error number from one required by this volume of POSIX.1-2008 for an error condition described in this volume of POSIX.1-2008".

In this case, it would be just an editorial oversight that EOPNOTSUPP is not listed for open().

Solaris and HP-UX both give EOPNOTSUPP (which I assume is what the reported NetBSD error text corresponds to).
(0002646)
jilles (reporter)
2015-05-01 15:36

FreeBSD's [EPROTOTYPE] error is caused by an extension in cat, where catting a socket causes cat to connect to it (as a stream socket) and receives from it until the connection is closed. Trying to open a socket using open() fails with [EOPNOTSUPP] as in NetBSD.
(0002653)
joerg (reporter)
2015-05-06 14:13

How do you get EOPNOTSUPP? It is in the man page...

If you create a socket with mknod(), Solaris allows to open
this socket and returns EIO for a read() attempt.

EOPNOTSUPP seems to be the open() error for (still) actice sockets
that have been created in the filesystem namespace using a socket()
call.
(0002655)
geoffclare (manager)
2015-05-06 15:27

If there is a way to create a socket in the file system for which open() succeeds, then we should add EOPNOTSUPP as a "may fail" error instead of "shall fail".

However, I tried creating a socket using mknod() on Solaris 11.1 and got EOPNOTSUPP when trying to open it:

# truss ./a.out 2>&1 | grep mknod
mknod("/tmp/mysock2", 0140600, 0x00000000) = 0
# ls -l /tmp/mysock2
srw------- 1 root root 0 May 6 16:22 /tmp/mysock2
# truss cat /tmp/mysock2 2>&1 | grep mysock
open64("/tmp/mysock2", O_RDONLY) Err#122 EOPNOTSUPP
(0002656)
joerg (reporter)
2015-05-06 15:34
edited on: 2015-05-06 15:36

Then the result seems to depend on the filesystem type.

The open() call fails for "tmpfs" and "ufs" (did not yet test ZFS),
but it succeeds on "lofs" as my first test has been made on /home/uname/*

My previous assumption about the status (active or not) seems to be wrong.

(0002710)
Don Cragun (manager)
2015-06-11 16:39

Interpretation response
------------------------
The standard clearly states that errno must be set to EOPNOTSUPP if an attempt is made to perform an operation on a socket that is not supported, and conforming implementations must conform to this.

Rationale:
-------------
The standard requires EOPNOTSUPP if open() fails to open a socket, as XSH 2.3 describes this error as "Operation not supported on socket" and says in the introductory paragraphs "Implementations shall not generate a different error number from one required by this volume of POSIX.1-2008 for an error condition described in this volume of POSIX.1-2008".

Notes to the Editor (not part of this interpretation):
-------------------------------------------------------
On page 1395 line 46152 insert before [ETXTBSY]:

    [EOPNOTSUPP] The path argument names a socket.
(0002724)
ajosey (manager)
2015-06-19 07:07

Interpretation Proposed: June 19 2015
(0002820)
ajosey (manager)
2015-09-07 11:33

Interpretation approved: 7 Sep 2015

- Issue History
Date Modified Username Field Change
2015-05-01 08:14 EdSchouten New Issue
2015-05-01 08:14 EdSchouten Status New => Under Review
2015-05-01 08:14 EdSchouten Assigned To => ajosey
2015-05-01 08:14 EdSchouten Name => Ed Schouten
2015-05-01 08:14 EdSchouten Organization => Nuxi
2015-05-01 08:14 EdSchouten Section => open() and openat()
2015-05-01 08:14 EdSchouten Page Number => unknown
2015-05-01 08:14 EdSchouten Line Number => unknown
2015-05-01 08:38 geoffclare Note Added: 0002645
2015-05-01 15:36 jilles Note Added: 0002646
2015-05-06 14:13 joerg Note Added: 0002653
2015-05-06 15:27 geoffclare Note Added: 0002655
2015-05-06 15:34 joerg Note Added: 0002656
2015-05-06 15:36 joerg Note Edited: 0002656
2015-05-06 15:36 joerg Note Edited: 0002656
2015-06-11 16:34 geoffclare Project 1003.1(2008)/Issue 7 => 1003.1(2013)/Issue7+TC1
2015-06-11 16:39 Don Cragun Note Added: 0002710
2015-06-11 16:42 Don Cragun Page Number unknown => 1395
2015-06-11 16:42 Don Cragun Line Number unknown => 46152
2015-06-11 16:42 Don Cragun Interp Status => Pending
2015-06-11 16:42 Don Cragun Final Accepted Text => See Note: 0002710.
2015-06-11 16:42 Don Cragun Status Under Review => Interpretation Required
2015-06-11 16:42 Don Cragun Resolution Open => Accepted As Marked
2015-06-11 16:42 Don Cragun Tag Attached: tc2-2008
2015-06-19 07:07 ajosey Interp Status Pending => Proposed
2015-06-19 07:07 ajosey Note Added: 0002724
2015-09-07 11:33 ajosey Interp Status Proposed => Approved
2015-09-07 11:33 ajosey Note Added: 0002820
2019-06-10 08:54 agadmin Status Interpretation Required => Closed


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker