xref: /netbsd-src/share/man/man9lua/systm.9lua (revision 6a493d6bc668897c91594964a732d38505b70cbb)
1.\"	$NetBSD: systm.9lua,v 1.1 2013/12/16 23:54:26 lneto 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 systm.print_nolog() function is identical to the systm.print() function,
69except is does not send
70.Ar msg
71to the system log.
72.Pp
73.It Dv systm.uprint(msg)
74Send
75.Ar msg
76to the current process's controlling tty.
77.Pp
78.It Dv systm.aprint_normal(msg)
79Send
80.Ar msg
81to the console unless AB_QUIET is set.
82Always sends to the log.
83.Pp
84.It Dv systm.aprint_naive(msg)
85Send
86.Ar msg
87to the console only if AB_QUIET is set.
88Never sends to the log.
89.Pp
90.It Dv systm.aprint_verbose(msg)
91Send
92.Ar msg
93to the console only if AB_VERBOSE is set.
94Always sends to the log.
95.Pp
96.It Dv systm.aprint_debug(msg)
97Send
98.Ar msg
99to the console and the log only if AB_DEBUG is set.
100.Pp
101.It Dv systm.aprint_error(msg)
102Like systm.aprint_normal(), but also keeps track of the number of times called.
103This allows a subsystem to report the number of errors that occurred during a
104quiet or silent initialization phase.
105.Pp
106.It Dv count = systm.aprint_get_error_count()
107The systm.aprint_get_error_count() function reports the number of errors and
108resets the counter to 0.
109.Pp
110.It Dv systm.panic(msg)
111The systm.panic() function terminates the NetBSD system.
112The message
113.Ar msg
114is printed to the console and saved in the variable
115.Em panicstr
116for later retrieval via core dump inspection.
117A newline character is added at the end automatically.
118.El
119.Sh VARIABLES
120Upon initialisation, the
121.Nm
122module sets the following variables with the values of the correspondig kernel
123variable:
124.Pp
125.Bl -tag -width XXXX -compact
126.It Dv systm.copyright
127.It Dv systm.cpu_model
128.It Dv systm.machine
129.It Dv systm.machine_arch
130.It Dv systm.osrelease
131.It Dv systm.ostype
132.It Dv systm.kernel_ident
133.It Dv systm.version
134.It Dv systm.ncpu
135.El
136.Sh SEE ALSO
137.Xr lua 1 ,
138.Xr luac 1 ,
139.Xr intro 9lua ,
140.Xr lua 4
141.Sh HISTORY
142An
143.Nm
144manual appeared in
145.Nx 7.0 .
146.Sh AUTHORS
147.An -nosplit
148The
149.Nm
150Lua binding was written by
151.An Marc Balmer Aq Mt mbalmer@NetBSD.org .
152