This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new d1772e1432 [POSIX][Bug] `mqueue.h`: Include file does not conform the
standard
d1772e1432 is described below
commit d1772e143249cac4643ef34d1a9c6835ea7b4e88
Author: Javier Alonso <[email protected]>
AuthorDate: Mon Dec 9 09:34:26 2024 +0100
[POSIX][Bug] `mqueue.h`: Include file does not conform the standard
The Open Group Base Specification IEEE Std 1003.1-2024 states that
> The <mqueue.h> header shall define O_RDONLY, O_WRONLY, O_RDWR,
> O_CREAT, O_EXCL, and O_NONBLOCK as described in <fcntl.h>.
https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/mqueue.h.html
It also states that:
> The <mqueue.h> header shall define the struct timespec structure as
described in <time.h>.
https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/mqueue.h.html
The way the `mqueue.h` include file is defined right now violates the
standard, having potentially different code depending on the platform the
code is being compiled against - assuming a multi-arch POSIX environment.
The standard also states that:
> Inclusion of the <mqueue.h> header may make visible symbols defined
> in the headers <fcntl.h>, <signal.h>, and <time.h>.
So having those includes shouldn't be an issue.
---
include/mqueue.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/mqueue.h b/include/mqueue.h
index 8fb6c4470b..3590e9a018 100644
--- a/include/mqueue.h
+++ b/include/mqueue.h
@@ -27,8 +27,10 @@
* Included Files
****************************************************************************/
+#include <fcntl.h>
#include <sys/types.h>
#include <signal.h>
+#include <time.h>
/****************************************************************************
* Pre-processor Definitions