A NOTE has been added to this issue. ====================================================================== http://austingroupbugs.net/view.php?id=1274 ====================================================================== Reported By: dannyniu Assigned To: ====================================================================== Project: 1003.1(2016)/Issue7+TC2 Issue ID: 1274 Category: Base Definitions and Headers Type: Omission Severity: Editorial Priority: normal Status: New Name: DannyNiu/NJF Organization: Individual User Reference: Section: <sys/types.h> header Page Number: 402-405 Line Number: 13652-13746 Interp Status: --- Final Accepted Text: ====================================================================== Date Submitted: 2019-07-28 10:42 UTC Last Modified: 2019-08-23 16:15 UTC ====================================================================== Summary: pid_t must fit in an int for definition of fcntl to be consistent. ======================================================================
---------------------------------------------------------------------- (0004536) geoffclare (manager) - 2019-08-23 16:15 http://austingroupbugs.net/view.php?id=1274#c4536 ---------------------------------------------------------------------- Proposed changes... On page 238 line 8002 section <fcntl.h>, add:<blockquote>The <b><fcntl.h></b> header shall define the <b>f_owner_ex</b> structure, which shall include at least the following members:<pre>enum f_pid_type type Discriminator for pid pid_t pid Process ID or process group ID</pre> The <b><fcntl.h></b> header shall define the enumerated type <b>enum f_pid_type</b> whose enumerators shall include at least the following: F_OWNER_PID<blockquote>The <i>pid</i> member of <b>f_owner_ex</b> holds a process ID.</blockquote>F_OWNER_PGRP<blockquote>The <i>pid</i> member of <b>f_owner_ex</b> holds a process group ID.</blockquote></blockquote> On page 238 line 8016 section <fcntl.h>, change:<blockquote>F_GETOWN<blockquote>Get process or process group ID to receive SIGURG signals.</blockquote>F_SETOWN<blockquote>Set process or process group ID to receive SIGURG signals.</blockquote></blockquote>to:<blockquote>F_GETOWN<blockquote>Get process or process group ID to receive SIGURG signals, via <b>int</b> type.</blockquote>F_GETOWN_EX<blockquote>Get process or process group ID to receive SIGURG signals, via <b>pid_t</b> type.</blockquote>F_SETOWN<blockquote>Set process or process group ID to receive SIGURG signals, via <b>int</b> type.</blockquote>F_SETOWN_EX<blockquote>Set process or process group ID to receive SIGURG signals, via <b>pid_t</b> type.</blockquote></blockquote> On page 821 line 27817 section fnctl(), add:<blockquote>F_GETOWN_EX<blockquote>If <i>fildes</i> refers to a socket, get the process ID or process group ID specified to receive SIGURG signals when out-of-band data is available, by setting the <i>type</i> and <i>pid</i> members of the <b>f_owner_ex</b> structure pointed to by the third argument, <i>arg</i>. The value of <i>type</i> shall be F_OWNER_PID or F_OWNER_PGRP to indicate that <i>pid</i> contains a process ID or a process group ID, respectively. The value of <i>pid</i> shall be zero if no SIGURG signals are to be sent. If fildes does not refer to a socket, the results are unspecified.</blockquote>F_SETOWN_EX<blockquote>If <i>fildes</i> refers to a socket, set the process ID or process group ID specified to receive SIGURG signals when out-of-band data is available, using the value of the third argument, <i>arg</i>, taken as type pointer to <b>struct f_owner_ex</b>. The <i>type</i> and <i>pid</i> members of this structure shall be used as follows:<ul><li>A <i>pid</i> value of zero shall indicate that no SIGURG signals are to be sent.</li> <li>A <i>type</i> value of F_OWNER_PID and a positive <i>pid</i> value shall indicate that SIGURG signals are to be sent to the process ID specified in <i>pid</i>.</li> <li>A <i>type</i> value of F_OWNER_PGRP and a positive <i>pid</i> value shall indicate that SIGURG signals are to be sent to the process group ID specified in <i>pid</i>.</li></ul> If fildes does not refer to a socket, the results are unspecified.</blockquote></blockquote> Move the text from the F_SETOWN description on lines 27803-27816, beginning "Each time a SIGURG signal is sent" and ending "or by other means", to a separate paragraph after the F_SETOWN_EX description, and in it change:<blockquote>Each time a SIGURG signal is sent</blockquote>to:<blockquote>For F_SETOWN and F_SETOWN_EX, each time a SIGURG signal is sent</blockquote> On page 823 line 27923 section fcntl() (EINVAL shall fail), change:<blockquote>The <i>cmd</i> argument is invalid, or the <i>cmd</i> argument is F_DUPFD or F_DUPFD_CLOEXEC and <i>arg</i> is negative or greater than or equal to {OPEN_MAX}, or the <i>cmd</i> argument is F_GETLK, F_SETLK, or F_SETLKW and the data pointed to by <i>arg</i> is not valid, or <i>fildes</i> refers to a file that does not support locking.</blockquote>to:<blockquote>The <i>cmd</i> argument is invalid; or the <i>cmd</i> argument is F_DUPFD or F_DUPFD_CLOEXEC and <i>arg</i> is negative or is greater than or equal to {OPEN_MAX}; or the <i>cmd</i> argument is F_SETOWN_EX and the <i>type</i> member of the <b>f_owner_ex</b> structure pointed to by <i>arg</i> is invalid, or the <i>pid</i> member is negative and the <i>type</i> member is F_OWNER_PID or F_OWNER_PGRP; or the <i>cmd</i> argument is F_GETLK, F_SETLK, or F_SETLKW and the data pointed to by <i>arg</i> is not valid, or <i>fildes</i> refers to a file that does not support locking.</blockquote> On page 824 line 27938 section fcntl() (ESRCH), change:<blockquote>F_SETOWN</blockquote>to:<blockquote>F_SETOWN or F_SETOWN_EX</blockquote> On page 824 line 27944 section fcntl() (EINVAL may fail), change:<blockquote>The <i>cmd</i> argument is F_SETOWN and the value of the argument is not valid as a process or process group identifier.</blockquote>to:<blockquote>The <i>cmd</i> argument is F_SETOWN and the value of <i>arg</i> is positive and is not valid as a process ID or the value of <i>arg</i> is negative and its absolute value is not valid as a process group ID; or the <i>cmd</i> argument is F_SETOWN_EX, the value of the <i>type</i> member of the <b>f_owner_ex</b> structure pointed to by <i>arg</i> is F_OWNER_PID, and the value of the <i>pid</i> member is not valid as a process ID; or the <i>cmd</i> argument is F_SETOWN_EX, the value of the <i>type</i> member of the <b>f_owner_ex</b> structure pointed to by <i>arg</i> is F_OWNER_PGRP, and the value of the <i>pid</i> member is not valid as a process group ID.</blockquote> On page 824 line 27946 section fcntl() (EPERM), change:<blockquote>F_SETOWN</blockquote>to:<blockquote>F_SETOWN or F_SETOWN_EX</blockquote> On page 825 line 28011 section fcntl() APPLICATION USAGE, change:<blockquote>On systems which do not perform permission checks at the time of an <i>fcntl</i>() call with F_SETOWN, ...</blockquote>to:<blockquote>On implementations where process IDs can be greater than INT_MAX, F_SETOWN cannot be used with process IDs greater than INT_MAX or process group IDs greater than INT_MAX+1 because the value is passed to <i>fcntl</i>() in an argument of type <b>int</b>. In this situation, F_SETOWN_EX should be used instead. Similarly, if a process ID greater than INT_MAX or a process group ID greater than INT_MAX+1 has been set to receive SIGURG signals (using F_SETOWN_EX), F_GETOWN cannot be used to obtain the value because <i>fcntl</i>() returns the value as type <b>int</b> and will thus give an [EOVERFLOW] error for such values. F_GETOWN_EX should be used instead. Note that the convention of negating a process group ID is only used with F_SETOWN and F_GETOWN; the <i>pid</i> member of the <b>f_owner_ex</b> structure used with F_SETOWN_EX and F_GETOWN_EX is not negated when it specifies a process group ID. On systems which do not perform permission checks at the time of an <i>fcntl</i>() call with F_SETOWN or F_SETOWN_EX, ...</blockquote> On page 827 line 28077 section fcntl() RATIONALE, add a new paragraph:<blockquote>The F_SETOWN_EX and F_GETOWN_EX values for <i>cmd</i> and the associated <b>f_owner_ex</b> structure were adopted from the GNU C library. In addition to the values F_OWNER_PID and F_OWNER_PGRP for the <i>type</i> member, this also has F_OWNER_TID to specify that the <i>pid</i> member contains a thread ID. However, this relies on thread IDs being representable in a <b>pid_t</b> and so was not included in POSIX.1-20xx. The aim of adding F_SETOWN_EX and F_GETOWN_EX was to address the inability of F_SETOWN and F_GETOWN to handle process IDs greater than INT_MAX and process group IDs greater than INT_MAX+1, and this need is satisfied without including F_OWNER_TID.</blockquote> Issue History Date Modified Username Field Change ====================================================================== 2019-07-28 10:42 dannyniu New Issue 2019-07-28 10:42 dannyniu Name => DannyNiu/NJF 2019-07-28 10:42 dannyniu Organization => Individual 2019-07-28 10:42 dannyniu Section => <sys/types.h> header 2019-07-28 10:42 dannyniu Page Number => 402-405 2019-07-28 10:42 dannyniu Line Number => 13652-13746 2019-07-28 13:49 jilles Note Added: 0004496 2019-07-29 00:52 shware_systems Note Added: 0004497 2019-07-29 09:08 geoffclare Note Added: 0004498 2019-08-15 16:37 eblake Note Added: 0004524 2019-08-15 16:52 shware_systems Note Added: 0004525 2019-08-15 16:58 eblake Note Added: 0004526 2019-08-15 19:03 shware_systems Note Added: 0004527 2019-08-15 19:32 eblake Note Added: 0004528 2019-08-15 19:33 eblake Note Edited: 0004528 2019-08-23 16:15 geoffclare Note Added: 0004536 ======================================================================