View Issue Details

IDProjectCategoryView StatusLast Update
00005931003.1(2008)/Issue 7System Interfacespublic2024-06-11 08:52
Reportereblake Assigned Toajosey  
PrioritynormalSeverityObjectionTypeOmission
Status ClosedResolutionAccepted As Marked 
NameEric Blake
OrganizationRed Hat
User Referenceebb.posix_typed_mem_open
Sectionposix_typed_mem_open
Page Number1515
Line Number48874
Interp StatusApproved
Final Accepted Text0000593:0001319
Summary0000593: posix_typed_mem_open requires the use of <fcntl.h>
DescriptionThe posix_typed_mem_open interface is not usable without one of three O_* access modes from <fcntl.h> (line 48932). However, the <sys/mman.h> header is not required to define these constants, nor is it permitted to include symbols from <fcntl.h>. Furthermore, there is no portable historical value for these constants to allow programs to skip using the symbolic names (that is, O_RDONLY is 0 on some platforms and 1 elsewhere). Therefore, proper use of this interface requires inclusion of <fcntl.h>.

Similar analysis applies to mq_open, sem_open, and shm_open, although at least <mqueue.h> and <semaphore.h> already permit optional inclusion of <fcntl.h>. Also, sem_open can be used without O_* constants, and therefore is a candidate for the <OH> shading of 0000591.

The desired action presents three possible solutions; solutions one and two are adequate for TC2 of Issue 7, whereas solution three would be a new requirement that existing implementations do not meet (I specifically tested that glibc does NOT expose O_RDONLY in <sys/mman.h>), and therefore would need to be delayed to Issue 8. If the Austin Group decides to go with one of the first two solutions in the TC2 timeframe, it may still be worth cloning this bug to allow Issue 8 to go with solution three.
Desired ActionSolution One: Mention the dependencies.

After line 43622 (XSH mq_open SYNOPSIS), insert this line with MSG shading:
<MSG>#include <fcntl.h></MSG>

At line 43645 (XSH mq_open DESCRIPTION), change:
values from the following list.

to:
values from the following list, defined in the <fcntl.h> header.

After line 48874 (XSH posix_typed_mem_open SYNOPSIS), insert this line with TYM shading:
<TYM>#include <fcntl.h></TYM>

After line 58074 (XSH sem_open SYNOPSIS), insert this line with OH shading:
<OH>#include <fcntl.h></OH>

At line 58084 (XSH sem_open DESCRIPTION), change:
The following flag bits may be set in oflag:

to:
The following flag bits, defined in <fcntl.h>, may be set in oflag:

After line 60319 (XSH shm_open SYNOPSIS), insert this line with SHM shading:
<SHM>#include <fcntl.h></SHM>



Solution Two: Mention the dependencies, and permit but not require <sys/mman.h> to provide them. All changes in Solution One, plus these additional changes:

After line 12468 (XBD <sys/mman.h> DESCRIPTION), insert the following paragraph, with TYM or SHM shading:
<TYM|SHM>Inclusion of the <sys/mman.h> header may make visible all symbols from the <fcntl.h> header.</TYM|SHM>



Solution Three: Require <mqueue.h>, <semaphore.h>, and <sys/mman.h> to be self-contained:

After line 9854 (XBD <mqueue.h> DESCRIPTION), insert the following paragraph:
The <mqueue.h> header shall define O_RDONLY, O_WRONLY, O_RDWR, O_CREAT, O_EXCL, and O_NONBLOCK as described in <fcntl.h>.

After line 10879 (XBD <semaphore.h> DESCRIPTION), insert the following paragraph:
The <semaphore.h> header shall define O_CREAT and O_EXCL as described in <fcntl.h>.

After line 12468 (XBD <sys/mman.h> DESCRIPTION), insert the following paragraph, with TYM and SHM shading as marked:
The <sys/mman.h> header shall define <TYM|SHM>O_RDONLY, O_RDWR</TYM|SHM>, <TYM>O_WRONLY</TYM>, <SHM>O_CREAT, O_EXCL, and O_TRUNC</SHM> as described in <fcntl.h>.

After line 12485 (XBD <sys/mman.h> DESCRIPTION), insert the following paragraph:
<TYM|SHM>Inclusion of the <sys/mman.h> header may make visible all symbols from the <fcntl.h> header.</TYM|SHM>

At line 43645 (XSH mq_open DESCRIPTION), change:
values from the following list.

to:
values from the following list, defined in the <mqueue.h> header.

At line 48934 (XSH posix_typed_mem_open DESCRIPTION), change:
defined in the <fcntl.h> header

to:
defined in the <sys/mman.h> header

At line 58084 (XSH sem_open DESCRIPTION), change:
The following flag bits may be set in oflag:

to:
The following flag bits, defined in <semaphore.h>, may be set in oflag:

At line 60341 (XSH shm_open DESCRIPTION), change:
defined in the <fcntl.h> header

to:
defined in the <sys/mman.h> header
Tagsissue8

Relationships

related to 0000591 Closedajosey 1003.1(2008)/Issue 7 No reason for OH margins in the synopses of open and creat 
related to 0000411 Closedajosey 1003.1(2008)/Issue 7 adding atomic FD_CLOEXEC support 
related to 0000598 Closedajosey 1003.1(2008)/Issue 7 OH shading and new interfaces 
related to 0001350 Closed Issue 8 drafts O_* constants needed in <stdlib.h> for mkostemp() 

Activities

eblake

2012-07-13 04:21

manager   bugnote:0001307

The addition of O_CLOEXEC support in 0000411 will also impact solution 3.

Also note that posix_openpt() uses O_RDWR and O_NOCTTY, but already requires the inclusion of <fcntl.h>, giving precedence to solution 1. Furthermore, <stdlib.h> (for posix_openpt) currently does not permit inclusion of <fcntl.h> (line 12042) and therefore does not give precedence to solution 2.

eblake

2012-08-08 12:39

manager   bugnote:0001319

Last edited: 2012-08-08 15:47

Interpretation response
------------------------
The standard states that <sys/mman.h> may not expose O_* constants, and conforming implementations must conform to this by also including <fcntl.h>. However, concerns have been raised about this which are being referred to the sponsor.

Rationale:
-------------
There is a desire to make headers self-contained for proper use of an interface.

Notes to the Editor (not part of this interpretation):
-------------------------------------------------------
Make the following edits (assuming that the edits in 0000411 will also be made):

After line 9854 (XBD <mqueue.h> DESCRIPTION), insert the following paragraph:
The <mqueue.h> header shall define O_RDONLY, O_WRONLY, O_RDWR, O_CREAT, O_EXCL, and O_NONBLOCK as described in <fcntl.h>.

After line 10879 (XBD <semaphore.h> DESCRIPTION), insert the following paragraph:
The <semaphore.h> header shall define O_CREAT and O_EXCL as described in <fcntl.h>.

After line 11971 (XBD <stdlib.h> DESCRIPTION), insert the following paragraph with XSI shading:
The <stdlib.h> header shall define O_CLOEXEC, O_NOCTTY, and O_RDWR as described in <fcntl.h>.

At line 12042 (XBD <stdlib.h> DESCRIPTION), change:
Inclusion of the <stdlib.h> header may also make visible all symbols from <stddef.h>, <limits.h>, <math.h>, and <sys/wait.h>.

to this (still CX shaded):
Inclusion of the <stdlib.h> header may also make visible all symbols from <fcntl.h>, <stddef.h>, <limits.h>, <math.h>, and <sys/wait.h>.

After line 12468 (XBD <sys/mman.h> DESCRIPTION), insert the following paragraph, with TYM and SHM shading as marked:
The <sys/mman.h> header shall define <TYM|SHM>O_RDONLY, O_RDWR</TYM|SHM>, <TYM>O_WRONLY, O_CLOEXEC</TYM>, <SHM>O_CREAT, O_EXCL, and O_TRUNC</SHM> as described in <fcntl.h>.

After line 12485 (XBD <sys/mman.h> DESCRIPTION), insert the following paragraph:
Inclusion of the <sys/mman.h> header may make visible all symbols from the <fcntl.h> header.

At line 46459 (XSH posix_openpt SYNOPSIS), delete:
#include <fcntl.h>

At line 46467 (XSH posix_openpt DESCRIPTION), delete the phrase:
defined in <fcntl.h>

At line 48934 (XSH posix_typed_mem_open DESCRIPTION), delete the phrase:
and defined in the <fcntl.h> header,

At line 60341 (XSH shm_open DESCRIPTION), delete the phrase:
defined in the <fcntl.h> header

ajosey

2012-08-30 09:20

manager   bugnote:0001361

Interpretation proposed 30 August 2012 for final 30 day review

ajosey

2013-03-29 08:01

manager   bugnote:0001508

Interpretation approved 29 Mar 2013

geoffclare

2020-05-19 10:44

manager   bugnote:0004874

When applying this bug I had to do the <sys/mman.h> change a little differently because the three different shadings have to be on separate lines. It looked best with all of the constants on separate lines (like the <stdlib.h> W* list).

Issue History

Date Modified Username Field Change
2012-07-13 04:16 eblake New Issue
2012-07-13 04:16 eblake Status New => Under Review
2012-07-13 04:16 eblake Assigned To => ajosey
2012-07-13 04:16 eblake Name => Eric Blake
2012-07-13 04:16 eblake Organization => Red Hat
2012-07-13 04:16 eblake User Reference => ebb.posix_typed_mem_open
2012-07-13 04:16 eblake Section => posix_typed_mem_open
2012-07-13 04:16 eblake Page Number => 1515
2012-07-13 04:16 eblake Line Number => 48874
2012-07-13 04:16 eblake Interp Status => ---
2012-07-13 04:16 eblake Relationship added related to 0000591
2012-07-13 04:16 eblake Relationship added related to 0000411
2012-07-13 04:21 eblake Note Added: 0001307
2012-08-08 12:39 eblake Note Added: 0001319
2012-08-08 13:23 eblake Relationship added related to 0000598
2012-08-08 13:24 eblake Tag Attached: issue8
2012-08-08 15:42 eblake Note Edited: 0001319
2012-08-08 15:47 msbrown Note Edited: 0001319
2012-08-08 15:48 msbrown Interp Status --- => Pending
2012-08-08 15:48 msbrown Final Accepted Text => 0000593:0001319
2012-08-08 15:48 msbrown Status Under Review => Interpretation Required
2012-08-08 15:48 msbrown Resolution Open => Accepted As Marked
2012-08-30 09:20 ajosey Interp Status Pending => Proposed
2012-08-30 09:20 ajosey Note Added: 0001361
2013-03-29 08:01 ajosey Interp Status Proposed => Approved
2013-03-29 08:01 ajosey Note Added: 0001508
2020-05-19 10:44 geoffclare Note Added: 0004874
2020-05-19 10:44 geoffclare Status Interpretation Required => Applied
2020-06-26 16:00 geoffclare Relationship added related to 0001350
2024-06-11 08:52 agadmin Status Applied => Closed