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)
Fri, Aug 8, 9:20 AM
Unknown Object (File)
Mon, Jul 28, 5:48 PM
Unknown Object (File)
Sun, Jul 27, 4:29 PM
Unknown Object (File)
Sun, Jul 27, 3:33 PM
Unknown Object (File)
Sun, Jul 27, 1:23 AM
Unknown Object (File)
Fri, Jul 25, 11:03 AM
Unknown Object (File)
Tue, Jul 22, 12:17 AM
Unknown Object (File)
Sat, Jul 12, 3:44 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 Skipped
Unit
Tests Skipped
Build Status
Buildable 65210
Build 62093: arc lint + arc unit