[POSIX][Bug] mqueue.h: Include file does not conform the standard (#15085)

2024-12-09 Thread Javier Alonso
Good morning NuttX devs,

This is Javi. I'm writing you regarding a compliant bug regarding the mqueue
header and POSIX. The IEEE Std 1003.1-2024 states that some symbols should
be exposed when doing #include  but are missing in the "
include/mqueue.h" NuttX version, failing to comply with the standard.

I had a look at the NuttX Community page, which suggests sending an email
with all the details so the developers can easily check this. I have
attached the patch with the changes and created a PR in GitHub (#15085
<https://github.com/apache/nuttx/pull/15085>), as it wasn't clear to me
what's the preferred procedure.

Have a nice day,

Javier Alonso Silva (he, him, his)
Geotab

Embedded Systems Developer | GEUR


*Quickly schedule a meeting <https://calendar.app.google/DRoGm4sLw89JC8At6>*

Toll-free

Visit

+34 900 535 371
www.geotab.com/es

Twitter <https://twitter.com/geotab> | Facebook
<https://www.facebook.com/Geotab> | YouTube
<https://www.youtube.com/user/MyGeotab> | LinkedIn
<https://www.linkedin.com/company/geotab/>
From 466649025556441853f572f86c4d7ca092a11871 Mon Sep 17 00:00:00 2001
From: Javier Alonso 
Date: Mon, 9 Dec 2024 09:34:26 +0100
Subject: [PATCH] [POSIX][Bug] `mqueue.h`: Include file does not conform the
 standard

The Open Group Base Specification IEEE Std 1003.1-2024 states that

> The  header shall define O_RDONLY, O_WRONLY, O_RDWR,
> O_CREAT, O_EXCL, and O_NONBLOCK as described in .
https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/mqueue.h.html

It also states that:

> The  header shall define the struct timespec structure as described in .
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  header may make visible symbols defined
> in the headers , , and .

So having those includes shouldn't be an issue.

Signed-off-by: Javier Alonso 
---
 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 
 #include 
 #include 
+#include 
 
 /
  * Pre-processor Definitions
-- 
2.47.0



Re: [POSIX][Bug] syslog: Add support for %m modifier (#15320)

2024-12-24 Thread Javier Alonso
Hello again NuttX maintainers,

I have created a second PR to revert my previous changes:
https://github.com/apache/nuttx/pull/15331. First, I want to apologize for
the changes I introduced yesterday. I was expecting them to not break
anything but it seems the user and kernel space code is tightly coupled.

The change ideally should have only affected user-space code, as syslog,
vsprintf, and friends are user-space libraries. However, some NuttX code in
the kernel-space area uses those functions instead of having kernel ones.
For the moment, I'm proposing reverting this change, and in the future work
on a better approach to address this.

Thanks in advance for all of your support.

Merry Christmas,

Javier Alonso Silva (he, him, his)
Geotab

Embedded Systems Developer | GEUR


*Quickly schedule a meeting <https://calendar.app.google/DRoGm4sLw89JC8At6>*

Toll-free

Visit

+34 900 535 371
www.geotab.com/es

Twitter <https://twitter.com/geotab> | Facebook
<https://www.facebook.com/Geotab> | YouTube
<https://www.youtube.com/user/MyGeotab> | LinkedIn
<https://www.linkedin.com/company/geotab/>


On Mon, Dec 23, 2024 at 3:54 PM Javier Alonso 
wrote:

> Good afternoon NuttX devs,
>
> I hope this email finds you well. First of all, Merry Christmas! I have
> just submitted a PR to the NuttX repo regarding a missing feature in the
> syslog module. The IEEE Std 1003.1-2024 states that the syslog() call shall
> accept the %m modifier, which causes the current strerror to be printed -
> it is a shorthand to "%s", strerror(errno).
>
> The PR is available at https://github.com/apache/nuttx/pull/15320.
>
> Have a nice day,
>
> Javier Alonso Silva (he, him, his)
> Geotab
>
> Embedded Systems Developer | GEUR
>
>
> *Quickly schedule a meeting
> <https://calendar.app.google/DRoGm4sLw89JC8At6>*
>
> Toll-free
>
> Visit
>
> +34 900 535 371
> www.geotab.com/es
>
> Twitter <https://twitter.com/geotab> | Facebook
> <https://www.facebook.com/Geotab> | YouTube
> <https://www.youtube.com/user/MyGeotab> | LinkedIn
> <https://www.linkedin.com/company/geotab/>
>


[POSIX][Bug] syslog: Add support for %m modifier (#15320)

2024-12-23 Thread Javier Alonso
Good afternoon NuttX devs,

I hope this email finds you well. First of all, Merry Christmas! I have
just submitted a PR to the NuttX repo regarding a missing feature in the
syslog module. The IEEE Std 1003.1-2024 states that the syslog() call shall
accept the %m modifier, which causes the current strerror to be printed -
it is a shorthand to "%s", strerror(errno).

The PR is available at https://github.com/apache/nuttx/pull/15320.

Have a nice day,

Javier Alonso Silva (he, him, his)
Geotab

Embedded Systems Developer | GEUR


*Quickly schedule a meeting <https://calendar.app.google/DRoGm4sLw89JC8At6>*

Toll-free

Visit

+34 900 535 371
www.geotab.com/es

Twitter <https://twitter.com/geotab> | Facebook
<https://www.facebook.com/Geotab> | YouTube
<https://www.youtube.com/user/MyGeotab> | LinkedIn
<https://www.linkedin.com/company/geotab/>
From 203505b4a2f2d5798fa107aeefc013ebeed5292f Mon Sep 17 00:00:00 2001
From: Javier Alonso 
Date: Mon, 23 Dec 2024 15:30:39 +0100
Subject: [PATCH] [POSIX][Bug] syslog: Add support for `%m` modifier

The POSIX standard states that the `syslog()` function generates
the body from the message and arguments the same way as `printf()`,

> except that the additional conversion specification `%m` shall be
> recognized;

*https://pubs.opengroup.org/onlinepubs/009695399/functions/syslog.html*

What most of the implementations do is to leverage the processing to
`vsprintf` internals, to reduce code duplicity. This means the `%m`
modifier is present on almost all `printf` implementations. Take
the following code snippet as an example: https://onlinegdb.com/YdR9pU6KS.

Therefore, for `syslog` to support such a specification, the underlying
library shall be updated to support it too.

Signed-off-by: Javier Alonso 
---
 libs/libc/stdio/lib_libvsprintf.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/libs/libc/stdio/lib_libvsprintf.c b/libs/libc/stdio/lib_libvsprintf.c
index 610a6a42d9..4589154d5d 100644
--- a/libs/libc/stdio/lib_libvsprintf.c
+++ b/libs/libc/stdio/lib_libvsprintf.c
@@ -163,6 +163,10 @@ static int vsprintf_internal(FAR struct lib_outstream_s *stream,
   uint16_t flags;
   int width;
   int prec;
+
+  /* For the %m format we may need the current `errno' value */
+
+  int saved_errno = errno;
   union
   {
 #if defined (CONFIG_LIBC_LONG_LONG) || (ULONG_MAX > 4294967295UL)
@@ -911,6 +915,11 @@ flt_oper:
   size = 1;
   goto str_lpad;
 
+case 'm': /* Print error message (%m) */
+  pnt = strerror(saved_errno);
+  size = strlen(pnt); /* Adjusting the size is not supported by %m */
+  goto str_lpad;
+
 case 's':
 case 'S':
 #ifdef CONFIG_LIBC_NUMBERED_ARGS
-- 
2.47.1



[Q&A] LTO Marked as "experimental"

2025-05-29 Thread Javier Alonso
Hello,

I'm interested in using LTO on our current project. It concerns me a little
bit the option is marked as "experimental", and finding nothing
when looking in the forums, commits, or mail archive. Can anyone illustrate
to me on the latest status, or any future development plans, if any?

Thanks in advance,

Javier Alonso Silva (he, him, his)
Geotab

Embedded Systems Developer | GEUR


*Quickly schedule a meeting <https://calendar.app.google/DRoGm4sLw89JC8At6>*

Toll-free

Visit

+34 900 535 371
www.geotab.com/es

Twitter <https://twitter.com/geotab> | Facebook
<https://www.facebook.com/Geotab> | YouTube
<https://www.youtube.com/user/MyGeotab> | LinkedIn
<https://www.linkedin.com/company/geotab/>


Re: [Q&A] LTO Marked as "experimental"

2025-06-03 Thread Javier Alonso
Bump here :)

We're planning on introducing this feature and I'd like to know the
caveats, if any.

BR,

Javier Alonso Silva (he, him, his)
Geotab

Embedded Systems Developer | GEUR


*Quickly schedule a meeting <https://calendar.app.google/DRoGm4sLw89JC8At6>*

Toll-free

Visit

+34 900 535 371
www.geotab.com/es

Twitter <https://twitter.com/geotab> | Facebook
<https://www.facebook.com/Geotab> | YouTube
<https://www.youtube.com/user/MyGeotab> | LinkedIn
<https://www.linkedin.com/company/geotab/>


On Thu, May 29, 2025 at 3:13 PM Javier Alonso 
wrote:

> Hello,
>
> I'm interested in using LTO on our current project. It concerns me a
> little bit the option is marked as "experimental", and finding nothing
> when looking in the forums, commits, or mail archive. Can anyone illustrate
> to me on the latest status, or any future development plans, if any?
>
> Thanks in advance,
>
> Javier Alonso Silva (he, him, his)
> Geotab
>
> Embedded Systems Developer | GEUR
>
>
> *Quickly schedule a meeting
> <https://calendar.app.google/DRoGm4sLw89JC8At6>*
>
> Toll-free
>
> Visit
>
> +34 900 535 371
> www.geotab.com/es
>
> Twitter <https://twitter.com/geotab> | Facebook
> <https://www.facebook.com/Geotab> | YouTube
> <https://www.youtube.com/user/MyGeotab> | LinkedIn
> <https://www.linkedin.com/company/geotab/>
>