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
0000833 [1003.1(2013)/Issue7+TC1] System Interfaces Editorial Clarification Requested 2014-04-19 00:09 2014-05-01 16:19
Reporter nsz View Status public  
Assigned To ajosey
Priority normal Resolution Accepted As Marked  
Status Resolved  
Name Szabolcs Nagy
Organization musl libc
User Reference
Section getaddrinfo
Page Number 925
Line Number 31191-31192
Interp Status ---
Final Accepted Text See Note: 0002241.
Summary 0000833: SOCK_* flags in getaddrinfo hints->ai_socktype
Description getaddrinfo description says

  "The ai_socktype field to which argument hints points specifies
   the socket type for the service, as defined in socket."

the "socket type as defined in socket" is unclear now:

it may mean the type argument of socket() (which since 0000411 includes
SOCK_CLOEXEC and SOCK_NONBLOCK flags) or only the socket types without
flags (as defined in XSH 2.10.6).

in other words one might interpret the text so that

    hints.ai_socktype = SOCK_STREAM|SOCK_CLOEXEC;
    getaddrinfo(host, port, &hints, &p)
    sock(p->ai_family, p->ai_socktype, p->ai_protocol);

is idiomatic getaddrinfo usage, instead of

    hints.ai_socktype = SOCK_STREAM;
    getaddrinfo(host, port, &hints, &p)
    sock(p->ai_family, p->ai_socktype|SOCK_CLOEXEC, p->ai_protocol);
Desired Action Clarify ai_socktype with respect ot the new socket type flags.
Tags No tags attached.
Attached Files

- Relationships
child of 0000411Closedajosey 1003.1(2008)/Issue 7 adding atomic FD_CLOEXEC support 

-  Notes
eblake (manager)
2014-04-24 16:34
edited on: 2014-04-24 17:20

During the 24 April 2014 call, it was determined that the intent of 0000411 is that the two new SOCK_ flags are for use only when opening an fd (socket(), socketpair(), accept4()). An application can recover the current state of the flags via fcntl() F_GETFL and F_GETFD - but that state may be different than what was originally passed in when opening the socket if intervening fcntl() F_SETFL or F_SETFD have been used. Therefore, the flags should NOT be used in other interfaces that are referring to a socket type. Thus, getaddrinfo() should fail with EAI_SOCKTYPE if the caller includes either flag in the hints, and getsockopt() with SO_TYPE should return the type with the flags masked out. In the original poster's description, only the second code snippet is valid.

However, we need formal wording to codify this intent on top of the requirements added by 411, so we'll leave this open a bit longer.

Don Cragun (manager)
2014-05-01 16:18

The changes for this issue have been included in the updated fix for 0000411.

- Issue History
Date Modified Username Field Change
2014-04-19 00:09 nsz New Issue
2014-04-19 00:09 nsz Status New => Under Review
2014-04-19 00:09 nsz Assigned To => ajosey
2014-04-19 00:09 nsz Name => Szabolcs Nagy
2014-04-19 00:09 nsz Organization => musl libc
2014-04-19 00:09 nsz Section => getaddrinfo
2014-04-24 15:50 eblake Relationship added related to 0000411
2014-04-24 15:50 geoffclare Project 2008-TC1 => 1003.1(2013)/Issue7+TC1
2014-04-24 15:51 Don Cragun Interp Status => ---
2014-04-24 15:51 Don Cragun Description Updated
2014-04-24 15:59 eblake Tag Attached: issue8
2014-04-24 16:34 eblake Note Added: 0002235
2014-04-24 17:20 eblake Note Edited: 0002235
2014-05-01 14:49 nick Page Number => 925
2014-05-01 14:49 nick Line Number => 31191-31192
2014-05-01 16:18 Don Cragun Final Accepted Text => See Note: 0002241.
2014-05-01 16:18 Don Cragun Note Added: 0002241
2014-05-01 16:18 Don Cragun Status Under Review => Resolved
2014-05-01 16:18 Don Cragun Resolution Open => Accepted As Marked
2014-05-01 16:19 Don Cragun Relationship replaced child of 0000411
2020-05-19 09:42 geoffclare Tag Detached: issue8

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