xref: /netbsd-src/share/man/man9lua/systm.9lua (revision 3181678dad5317915ed3f2447d3f33a8f2478a0f)
1.\"	$NetBSD: systm.9lua,v 1.2 2014/01/06 13:03:33 wiz Exp $
2.\"
3.\" Copyright (c) 2013 Marc Balmer <mbalmer@NetBSD.org>. All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright
9.\"    notice, this list of conditions and the following disclaimer.
10.\" 2. Redistributions in binary form must reproduce the above copyright
11.\"    notice, this list of conditions and the following disclaimer in the
12.\"    documentation and/or other materials provided with the distribution.
13.\" 3. Neither the name of the University nor the names of its contributors
14.\"    may be used to endorse or promote products derived from this software
15.\"    without specific prior written permission.
16.\"
17.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27.\" SUCH DAMAGE.
28.\"
29.\"
30.Dd October 29, 2013
31.Dt SYSTM 9lua
32.Os
33.Sh NAME
34.Nm systm
35.Nd access
36to general kernel functionality from Lua
37.Sh SYNOPSIS
38.Cd "local systm = require 'systm'"
39.Pp
40.Bl -tag -width XXXX -compact
41.It Dv systm.print(msg)
42.It Dv systm.print_nolog(msg)
43.It Dv systm.uprint(msg)
44.It Dv systm.aprint_normal(msg)
45.It Dv systm.aprint_naive(msg)
46.It Dv systm.aprint_verbose(msg)
47.It Dv systm.aprint_debug(msg)
48.It Dv systm.aprint_error(msg)
49.It Dv count = systm.aprint_get_error_count()
50.It Dv systm.panic(msg)
51.El
52.Sh DESCRIPTION
53The
54.Nm
55Lua binding provides access to general kernel functionality like printing
56messages on the console.
57The
58.Em systm.aprint
59functions are meant to be using during kernel autoconfiguration.
60.Pp
61.Bl -tag -width XXXX -compact
62.It Dv systm.print(msg)
63Send
64.Ar msg
65to the console.
66.Pp
67.It Dv systm.print_nolog(msg)
68The
69.Fn systm.print_nolog
70function is identical to the
71.Fn systm.print
72function,
73except is does not send
74.Ar msg
75to the system log.
76.Pp
77.It Dv systm.uprint(msg)
78Send
79.Ar msg
80to the current process's controlling tty.
81.Pp
82.It Dv systm.aprint_normal(msg)
83Send
84.Ar msg
85to the console unless AB_QUIET is set.
86Always sends to the log.
87.Pp
88.It Dv systm.aprint_naive(msg)
89Send
90.Ar msg
91to the console only if AB_QUIET is set.
92Never sends to the log.
93.Pp
94.It Dv systm.aprint_verbose(msg)
95Send
96.Ar msg
97to the console only if AB_VERBOSE is set.
98Always sends to the log.
99.Pp
100.It Dv systm.aprint_debug(msg)
101Send
102.Ar msg
103to the console and the log only if AB_DEBUG is set.
104.Pp
105.It Dv systm.aprint_error(msg)
106Like
107.Fn systm.aprint_normal ,
108but also keeps track of the number of times called.
109This allows a subsystem to report the number of errors that occurred during a
110quiet or silent initialization phase.
111.Pp
112.It Dv count = systm.aprint_get_error_count()
113The
114.Fn systm.aprint_get_error_count
115function reports the number of errors and
116resets the counter to 0.
117.Pp
118.It Dv systm.panic(msg)
119The
120.Fn systm.panic
121function terminates the
122.Nx
123system.
124The message
125.Ar msg
126is printed to the console and saved in the variable
127.Em panicstr
128for later retrieval via core dump inspection.
129A newline character is added at the end automatically.
130.El
131.Sh VARIABLES
132Upon initialisation, the
133.Nm
134module sets the following variables with the values of the corresponding kernel
135variable:
136.Pp
137.Bl -tag -width XXXX -compact
138.It Dv systm.copyright
139.It Dv systm.cpu_model
140.It Dv systm.machine
141.It Dv systm.machine_arch
142.It Dv systm.osrelease
143.It Dv systm.ostype
144.It Dv systm.kernel_ident
145.It Dv systm.version
146.It Dv systm.ncpu
147.El
148.Sh SEE ALSO
149.Xr lua 1 ,
150.Xr luac 1 ,
151.Xr lua 4 ,
152.Xr intro 9lua
153.Sh HISTORY
154An
155.Nm
156manual appeared in
157.Nx 7.0 .
158.Sh AUTHORS
159.An -nosplit
160The
161.Nm
162Lua binding was written by
163.An Marc Balmer Aq Mt mbalmer@NetBSD.org .
164