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
0000591 [1003.1(2008)/Issue 7] Base Definitions and Headers Objection Error 2012-06-29 02:44 2019-06-10 08:55
Reporter Love4Boobies View Status public  
Assigned To ajosey
Priority normal Resolution Accepted As Marked  
Status Closed  
Name Bogdan Barbu
User Reference
Section XSH open, creat
Page Number 1377, 702
Line Number 45160, 23717
Interp Status ---
Final Accepted Text see Note: 0001278 Solution 2
Summary 0000591: No reason for OH margins in the synopses of open and creat
Description While the synopses of both open and creat have OH margins for <sys/stat.h>, this is not required, given that mode_t is not XSI-only in <fcntl.h>.
Desired Action Remove the two OH margins.
Tags tc2-2008
Attached Files

- Relationships
related to 0000411Closedajosey adding atomic FD_CLOEXEC support 
parent of 0000598Closedajosey OH shading and new interfaces 
related to 0000593Closedajosey posix_typed_mem_open requires the use of <fcntl.h> 

-  Notes
eblake (manager)
2012-06-29 04:28

The stated point of the OH margin marking is to point out a header that must be included on a system that does not implement the XSI option. Read another way, it states that the non-shaded header must have an XSI-only requirement that duplicates the functionality of the OH-shaded header, so that XSI systems can rely on implicit inclusion while non-XSI cannot. However, we made a conscious effort to scrub things in POSIX 2008 to reduce the need to include multiple headers in the first place, regardless of the XSI option. In fact, the example in XBD line 266 is outdated, since getgrnam at XSH line 34131 no longer mentions <sys/types.h> with OH shading in the first place.

In the case of open(), the reason that <sys/stat.h> would be required is if you want to pass symbolic constants such as S_IRWXU for the third argument when the second includes O_CREAT, and not, as you surmised, for the definition of the mode_t type (<fcntl.h> line 7907 guarantees mode_t, but nothing in <fcntl.h> guarantees the S_* mode bits - line 7917 leaves that part optional). On the other hand, we also made the change in POSIX 2008 that the S_* macros were to have fixed constant values (in earlier versions, use of 0600 instead of S_IRUSR|S_IWUSR was undefined, but they are now required to be equivalent), therefore, if you use the numeric values instead of the constants, you no longer need <sys/stat.h> when using O_CREAT.

This means we have several things to think about: First, OH is the wrong shading (there is nothing in <fcntl.h> that gives an XSI-only mandate to include all constants from <sys/stat.h>, but OH shading is tied to XSI). Second, removing OH shading but leaving <sys/stat.h> present would mean that a conforming application MUST include <sys/stat.h> prior to <fcntl.h> in order to use open() with O_CREAT (the use of <sys/stat.h> is not necessary if O_CREAT is not present), but I just argued above that we changed things in POSIX 2008 to avoid that for all programs, not just XSI platforms. Therefore, a more correct fix would be to remove the line altogether; the text at line 45196 about O_CREAT gives adequate mention of <sys/stat.h> without requiring its use. I will add a second note with my proposed changes, based on this discussion.
eblake (manager)
2012-06-29 04:58
edited on: 2012-07-12 15:24

Solution 1 - delete OH entirely, as the last two uses are not required:

In XSH, delete the "#include <sys/stat.h>" at line 45160 (open) and 23717 (creat).

In XBD 1.7.1 Codes, delete lines 263-270 (OH code).

Solution 2 - repurpose OH to permit the existing use in open() and creat(), and add its use in more places, as related to using AT_FDCWD and friends:

In XBD 1.7.1 Codes, change lines 266-270 from:

<OH>#include <sys/types.h></OH>
#include <grp.h>
struct group *getgrnam(const char *name);

The OH margin legend indicates that the marked header is not required on XSI-conformant systems.


<OH>#include <sys/stat.h></OH>
#include <fcntl.h>
int open(const char *path, int oflag, ...);

The OH margin legend indicates that the optional header defines constants that will be needed if the function is called with certain flag arguments; thus it may be required for some of the functionality described, but is not needed otherwise.

At each of the following SYNOPSIS locations:
line 19444 (faccessat, via access)
line 22157 (fchmodat, via chmod)
line 22312 (fchownat, via chown)
line 31644 (fstatat)
line 32362 (utimensat, via futimens)
line 40104 (linkat, via link)
line 42301 (mkdirat, via mkdir)
line 42498 (mkfifoat, via mkfifo)
line 42617 (mknodat, via mknod) (also with XSI shading)
line 55843 (readlinkat, via readlink)
line 56920 (renameat, via rename) (also with CX shading)
line 65046 (symlinkat, via symlink)
line 68003 (unlinkat, via unlink)
insert a line with OH shading:
<OH>#include <fcntl.h></OH>

Also, at the following SEE ALSO locations:
line 42393 (mkdir)
line 42594 (mkfifo)
line 42745 (mknod)
line 55930 (readlink)
line 57083 (rename)
line 65140 (symlink)
add a reference to <fcntl.h>.

eblake (manager)
2012-06-29 05:10

If 0000411 is applied and we go with option 2 of repurposing the OH marking, then the newly-added dup3() and mkostemp() would also need an OH-shaded <fcntl.h> for O_CLOEXEC.
geoffclare (manager)
2012-06-29 09:32

If we choose solution 2, all the pages that get an OH <fcntl.h> should also have <fcntl.h> added to their SEE ALSO section.
eblake (manager)
2012-07-12 23:01
edited on: 2012-07-12 23:09

getsockopt() (page 1076, line 35886) mentions the use of IPPROTO_TCP from <netinet/in.h>, does this qualify for use of the OH marking?

posix_typed_mem_open() (page 1516, line 48934) requires the use of O_* constants from <fcntl.h>; but in this case, there is no way to avoid the use of these constants, so the <fcntl.h> header should be unconditional rather than OH for using this function (or else <sys/mman.h> should be required to expose those constants and allowed to expose all of <fcntl.h>).

- Issue History
Date Modified Username Field Change
2012-06-29 02:44 Love4Boobies New Issue
2012-06-29 02:44 Love4Boobies Status New => Under Review
2012-06-29 02:44 Love4Boobies Assigned To => ajosey
2012-06-29 02:44 Love4Boobies Name => Bogdan Barbu
2012-06-29 02:44 Love4Boobies Section => open, creat
2012-06-29 02:44 Love4Boobies Page Number => ?
2012-06-29 02:44 Love4Boobies Line Number => ?
2012-06-29 04:28 eblake Note Added: 0001277
2012-06-29 04:30 eblake Section open, creat => XSH open, creat
2012-06-29 04:30 eblake Page Number ? => 1377, 702
2012-06-29 04:30 eblake Line Number ? => 45160, 23717
2012-06-29 04:30 eblake Interp Status => ---
2012-06-29 04:58 eblake Note Added: 0001278
2012-06-29 05:10 eblake Note Added: 0001279
2012-06-29 05:10 eblake Relationship added related to 0000411
2012-06-29 09:32 geoffclare Note Added: 0001280
2012-07-12 15:14 eblake Note Edited: 0001278
2012-07-12 15:24 eblake Note Edited: 0001278
2012-07-12 15:30 eblake Final Accepted Text => see Note: 0001278 Solution 2
2012-07-12 15:30 eblake Status Under Review => Resolved
2012-07-12 15:30 eblake Resolution Open => Accepted As Marked
2012-07-12 15:30 eblake Tag Attached: tc2-2008
2012-07-12 23:01 eblake Note Added: 0001306
2012-07-12 23:09 eblake Note Edited: 0001306
2012-07-13 04:16 eblake Relationship added related to 0000593
2012-08-08 13:23 eblake Relationship added parent of 0000598
2019-06-10 08:55 agadmin Status Resolved => Closed

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