View Issue Details

IDProjectCategoryView StatusLast Update
00012821003.1(2016/18)/Issue7+TC2Base Definitions and Headerspublic2024-06-11 09:08
Reporterjoelsherrill Assigned To 
PrioritynormalSeverityEditorialTypeClarification Requested
Status ClosedResolutionAccepted As Marked 
NameJoel Sherrill
Organization
User Reference
Sectionmqueue.h
Page NumberNA - used web
Line NumberNA - used web
Interp Status---
Final Accepted Text0001282:0005880
Summary0001282: mqueue.h - pthread_attr_t is listed as defined but unclear why
DescriptionRef: 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."

Desired ActionThere 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.

Tagstc3-2008

Activities

geoffclare

2019-08-23 16:41

manager   bugnote:0004537

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.

shware_systems

2019-08-24 21:25

reporter   bugnote:0004539

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

geoffclare

2022-06-30 16:26

manager   bugnote:0005880

Last edited: 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 types
to:
shall define the size_t and ssize_t types


On page 1353 line 45082 section mq_notify() EXAMPLES, after:
#include <pthread.h>
add:
#include <signal.h>


On page 1355 line 45136 section mq_notify() APPLICATION USAGE, change:
None.
to:
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.


Issue History

Date Modified Username Field Change
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 => 0001282: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
2024-06-11 09:08 agadmin Status Applied => Closed