|Anonymous | Login||2023-03-30 23:15 UTC|
|Main | My View | View Issues | Change Log | Docs|
|Viewing Issue Simple Details [ Jump to Notes ]||[ Issue History ] [ Print ]|
|ID||Category||Severity||Type||Date Submitted||Last Update|
|0001282||[1003.1(2016/18)/Issue7+TC2] Base Definitions and Headers||Editorial||Clarification Requested||2019-08-23 16:19||2022-07-19 14:10|
|Priority||normal||Resolution||Accepted As Marked|
|Page Number||NA - used web|
|Line Number||NA - used web|
|Final Accepted Text||Note: 0005880|
|Summary||0001282: mqueue.h - pthread_attr_t is listed as defined but unclear why|
Ref: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/mqueue.h.html [^]
Issue: In mqueue.h, pthread_attr_t is listed as defined but there is no need for it as best I can see in the mqueue APIs. Is this just a cut and paste mistake?
Response from Geoff Clare when asked on mailing list:
"It's needed if you want to have mq_notify() do a SIGEV_THREAD notification. However, what's odd here is that mqueue.h is only required to declare struct sigevent as incomplete, so if you want to actually populate a struct sigevent you therefore need to include signal.h to get it properly defined -- in which case signal.h will define pthread_attr_t, so there is no need for mqueue.h to do it.
So I think either mqueue.h should be required to define struct sigevent or it should not be required to define pthread_attr_t."
There are multiple ways to resolve this but I think Geoff's suggestion of not requiring mqueue.h to define pthread_attr_t seems the simplest. It also is consistent with the example provided with mq_notify() that includes pthread.h.
The example code includes <pthread.h>, but it doesn't include <signal.h>.
If we don't change <mqueue.h> to require a complete definition of struct sigevent then we should add #include <signal.h> to the example.
edited on: 2019-08-24 21:34
I think the sigevent reference as an incomplete type is so it is not material whether <mqueue.h> #include's <signal.h> or not, or which order an application may #include these headers separately. It would be a quality of implementation issue that these headers note whether the necessary types have been declared already, whichever is referenced first. If an application doesn't make use of mq_notify() it may not have to #include <signal.h> at all then.
What I see as missing, if <mqueue.h> is #include'd first, is that the sigval union should also be defined or declared, as the sigevent structure requires this type also.
edited on: 2022-06-30 16:33
On page 297 line 10082 section <mqueue.h>, change:
shall define the pthread_attr_t, size_t, and ssize_t typesto:
shall define the size_t and ssize_t types
On page 1353 line 45082 section mq_notify() EXAMPLES, after:
On page 1355 line 45136 section mq_notify() APPLICATION USAGE, change:
Since the <mqueue.h> header is only required to declare the sigevent structure tag as naming an incomplete structure type, in order to use mq_notify() and pass it a pointer to a sigevent structure, applications need to include <signal.h> so that sigevent will be fully defined.
|2019-08-23 16:19||joelsherrill||New Issue|
|2019-08-23 16:19||joelsherrill||Name||=> Joel Sherrill|
|2019-08-23 16:19||joelsherrill||Section||=> mqueue.h|
|2019-08-23 16:19||joelsherrill||Page Number||=> NA - used web|
|2019-08-23 16:19||joelsherrill||Line Number||=> NA - used web|
|2019-08-23 16:29||geoffclare||Interp Status||=> ---|
|2019-08-23 16:29||geoffclare||Category||System Interfaces => Base Definitions and Headers|
|2019-08-23 16:41||geoffclare||Note Added: 0004537|
|2019-08-24 21:25||shware_systems||Note Added: 0004539|
|2019-08-24 21:34||shware_systems||Note Edited: 0004539|
|2022-06-30 16:26||geoffclare||Note Added: 0005880|
|2022-06-30 16:27||geoffclare||Final Accepted Text||=> Note: 0005880|
|2022-06-30 16:27||geoffclare||Status||New => Resolved|
|2022-06-30 16:27||geoffclare||Resolution||Open => Accepted As Marked|
|2022-06-30 16:27||geoffclare||Tag Attached: tc3-2008|
|2022-06-30 16:33||geoffclare||Note Edited: 0005880|
|2022-07-19 14:10||geoffclare||Status||Resolved => Applied|
|Mantis 1.1.6[^] Copyright © 2000 - 2008 Mantis Group|