Skip to content

interpreters/luamodules/luasyslog: Do not define openlog() and closelog(). - #3939

Open
casaroli wants to merge 1 commit into
apache:masterfrom
casaroli:fb-openlog-functions-up
Open

casaroli wants to merge 1 commit into
apache:masterfrom
casaroli:fb-openlog-functions-up

Conversation

@casaroli

Copy link
Copy Markdown
Contributor

Summary

The Makefile and CMakeLists.txt of interpreters/luamodules/luasyslog defined openlog() and closelog() as macros for lsyslog.c. <syslog.h> already gives both, so these macros are not necessary. apache/nuttx#21128 makes openlog() and closelog() functions of libc; then the macros expand inside the declarations of <syslog.h>, and lsyslog.c does not compile.

This PR removes the macros. lsyslog.c then uses openlog() and closelog() of <syslog.h>.

Impact

Only the build of the luasyslog Lua module (sim:lua). It works with the current <syslog.h> (macros) and with the new one (functions), so this PR can merge first.

Testing

sim:lua (macOS host) with this PR and apache/nuttx#21128 builds and links lsyslog.c. A file with the openlog()/closelog() calls of lsyslog.c, compiled without the macros against <syslog.h> of nuttx master and of apache/nuttx#21128: both compile. With the macros, it does not compile against apache/nuttx#21128.

tools/checkpatch.sh -c -u -m -g passes.

…og().

The Makefile and CMakeLists.txt defined openlog() and closelog() as
macros for lsyslog.c.  <syslog.h> already gives both, so the macros are
not necessary.  When <syslog.h> declares them as functions, the macros
break the declarations and lsyslog.c does not compile.

Remove the macros.  lsyslog.c then uses openlog() and closelog() of
<syslog.h>.

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
@cederom

cederom commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

This one depends on apache/nuttx#21128 right?

If yes, not sure if providing fake function stubs that are declared as supported and implemented is the way to go.

In LUA here probably these stubs were used to fix build issues. But how does that look on a working environment (i.e. Liunux)?

@casaroli

Copy link
Copy Markdown
Contributor Author

It does not depend on it: this PR builds with the current <syslog.h>, where openlog() and closelog() are macros, and with apache/nuttx#21128, where they are functions. On Linux, lsyslog.c calls the openlog() and closelog() of libc, which is what it does on NuttX after this PR. apache/nuttx#21128 now implements them as musl does (the ident, LOG_PID, LOG_PERROR).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants