Page MenuHomeFreeBSD

lposix: Clean up the posix namespace definitions
ClosedPublic

Authored by markj on Jul 4 2025, 8:12 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Sep 7, 10:17 AM
Unknown Object (File)
Thu, Sep 4, 6:00 PM
Unknown Object (File)
Wed, Sep 3, 9:13 AM
Unknown Object (File)
Mon, Sep 1, 8:46 AM
Unknown Object (File)
Fri, Aug 29, 4:24 PM
Unknown Object (File)
Wed, Aug 27, 10:45 PM
Unknown Object (File)
Sat, Aug 16, 11:56 PM
Unknown Object (File)
Aug 12 2025, 12:18 PM
Subscribers

Details

Summary

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.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable