Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F146967260
D46556.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D46556.diff
View Options
diff --git a/share/man/man1/intro.1 b/share/man/man1/intro.1
--- a/share/man/man1/intro.1
+++ b/share/man/man1/intro.1
@@ -85,6 +85,7 @@
.Xr which 1 ,
.Xr intro 2 ,
.Xr intro 3 ,
+.Xr intro 3lua ,
.Xr sysexits 3 ,
.Xr intro 4 ,
.Xr intro 5 ,
diff --git a/share/man/man3lua/Makefile b/share/man/man3lua/Makefile
--- a/share/man/man3lua/Makefile
+++ b/share/man/man3lua/Makefile
@@ -1,5 +1,7 @@
.include <src.opts.mk>
-MAN= intro.3lua
+MAN= freebsd.3lua \
+ intro.3lua \
+ posix.3lua
.include <bsd.prog.mk>
diff --git a/share/man/man3lua/intro.3lua b/share/man/man3lua/intro.3lua
--- a/share/man/man3lua/intro.3lua
+++ b/share/man/man3lua/intro.3lua
@@ -24,32 +24,31 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd October 24, 2020
+.Dd September 5, 2024
.Dt INTRO 3lua
.Os
.Sh NAME
.Nm intro
-.Nd introduction to the Lua modules for flua
+.Nd introduction to flua
.Po
.Fx
Lua
.Pc
.Sh DESCRIPTION
-This section describes
-.Em flua
-.Po
-.Fx
-Lua
-.Pc
-and the Lua modules provided in the
+.Nm
+is a Lua 5.4 interpreter which is available for use in the
.Fx
-base system.
+base system, via
+.Pa /usr/libexec/flua .
+It provides a number of FreeBSD-specific modules.
.Pp
The Lua modules provided by
.Fx
are:
.Bl -tag -width jail
+.It Xr freebsd 3lua
.It Xr jail 3lua
+.It Xr posix 3lua
Wrapper for
.Xr jail 3 .
.El
diff --git a/share/man/man3lua/posix.3lua b/share/man/man3lua/posix.3lua
new file mode 100644
--- /dev/null
+++ b/share/man/man3lua/posix.3lua
@@ -0,0 +1,89 @@
+.\"
+.\" SPDX-License-Identifier: BSD-2-Clause
+.\"
+.\" Copyright (c) 2024 Mark Johnston <markj@FreeBSD.org>
+.\"
+.Dd September 5, 2024
+.Dt POSIX 3lua
+.Os
+.Sh NAME
+Lua bindings for POSIX interfaces
+.Sh SYNOPSIS
+.Bl -tag -width XXXX -compact
+.It Dv pid, err, errno = posix.spawn.posix_spawn(path, [file_actions,] [attrs,] args[, env])
+.It Dv pid, err, errno = posix.spawn.posix_spawnp(file, [file_actions,] [attrs,] args[, env])
+
+.It Dv ok, err, errno = posix.stat.chmod(path, mode)
+
+.It Dv utsname, err, errno = posix.sys.utsname.uname()
+
+.It Dv ok, err, errno = posix.unistd.chown(path, user, group)
+.It Dv ok, err, errno = posix.unistd.close(fd)
+.It Dv pid = posix.unistd.getpid()
+.It Dv fd1, fd2 = posix.unistd.pipe()
+.El
+.Sh DESCRIPTION
+The
+.Nm posix
+module provides bindings for various standard
+.Xr c 7
+interfaces provided by
+.Fx .
+This implementation aims to be compatible with the luaposix project.
+The namespace is partitioned by the names of C headers located in
+.Pa /usr/include
+and
+.Pa /usr/include/sys .
+.Pp
+These bindings generally correspond to individual C functions or constants
+and for the most do not implement functionality directly, except when doing
+so is convenient.
+For example, the
+.Fa user
+and
+.Fa group
+parameters for
+.Fn posix.unistd.chown
+can be integers corresponding to the desired user and group ID, as they must
+be for the
+.Xr chown 2
+system call, but they may instead be strings, in which case
+.Fn posix.unistd.chown
+will use
+.Xr getpwnam_r 3
+and
+.Xr getgrnam_r 3
+to resolve them to integer identifiers before calling
+.Xr chown 2 .
+.Pp
+The
+.Nm
+module defines a userdata type to represent a file descriptor,
+as returned or consumed by many functions in this module.
+The flua garbage collector will automatically close descriptors
+that are no longer in use, so descriptors can not be leaked.
+However, the garbage collector does not ensure that unreferenced
+descriptors are closed within any particular time frame.
+It may thus be necessary to manually close descriptors using
+.Fn posix.unistd.close .
+.Sh RETURN VALUES
+Functions in this module follow a convention of returning a
+non-nil value if the function call was successful, and a 3-tuple
+of nil, the error string, and an
+.Xr errno 2
+value, if the call failed.
+.Sh EXAMPLES
+Retrieve system identifiers using
+.Xr uname 3
+and print them:
+.Bd -literal -offset indent
+local uts, err = posix.sys.utsname.uname()
+if not uts then
+ error("uname failed: " .. err)
+end
+for k, v in pairs(uts) do
+ print(k .. ": " .. v)
+end
+.Ed
+.Sh SEE ALSO
+.Xr intro 3lua
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Mar 8, 5:32 AM (2 h, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29396169
Default Alt Text
D46556.diff (4 KB)
Attached To
Mode
D46556: flua: Expand man page coverage a bit
Attached
Detach File
Event Timeline
Log In to Comment