opnsense-src/libexec/flua/modules
Mark Johnston eda96744b4 lposix: Clean up the posix namespace definitions
The posix module is subdivided according to C headers; for instance,
posix.unistd contains routines available from unistd.h, such as
chown(2).

A quirk of our implementation is that each of the modules is a direct
entry in the global table.  That is, there is no "posix" table.
Instead, "posix.foo" and "posix.bar.baz" are both top-level tables.
This is surprising and goes against Lua's shorthand of using "." to
access keys in a table.  lua-posix also doesn't work this way.

Rework things so that "posix" and "posix.sys" are proper tables.
Existing flua code which uses require() to bind posix submodules to a
name will be unaffected.  Code which accesses them directly using
something like _G["posix.sys.utsname"].uname() will be broken, but I
don't think anything like that exists.  In particular, it is now
possible to call posix.sys.utsname.uname() without any require
statements.

Reviewed by:	imp, bapt
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D51158
2025-07-07 15:43:27 +00:00
..
lfbsd.c flua: add fbsd module 2023-09-27 16:00:00 +02:00
lfbsd.h flua: add fbsd module 2023-09-27 16:00:00 +02:00
lfs.c Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00
lfs.h Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:16 -06:00
lposix.c lposix: Clean up the posix namespace definitions 2025-07-07 15:43:27 +00:00
lposix.h lposix: Clean up the posix namespace definitions 2025-07-07 15:43:27 +00:00