View Issue Details

IDProjectCategoryView StatusLast Update
00008331003.1(2013)/Issue7+TC1System Interfacespublic2014-05-01 16:19
Reporternsz Assigned Toajosey  
PrioritynormalSeverityEditorialTypeClarification Requested
Status ResolvedResolutionAccepted As Marked 
NameSzabolcs Nagy
Organizationmusl libc
User Reference
Sectiongetaddrinfo
Page Number925
Line Number31191-31192
Interp Status---
Final Accepted TextSee 0000833:0002241.
Summary0000833: SOCK_* flags in getaddrinfo hints->ai_socktype
Descriptiongetaddrinfo 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 ActionClarify ai_socktype with respect ot the new socket type flags.
TagsNo tags attached.

Relationships

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

Activities

eblake

2014-04-24 16:34

manager   bugnote:0002235

Last edited: 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

2014-05-01 16:18

manager   bugnote:0002241

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 0000833: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