xref: /netbsd-src/lib/libutil/util.3 (revision c2f2b1bf586dabb44fdb857481bcce3a6e2e95e0)
1*c2f2b1bfSmsaitoh.\"     $NetBSD: util.3,v 1.27 2019/03/08 08:12:39 msaitoh Exp $
2f8307766Sgmcgarry.\"
3f8307766Sgmcgarry.\" Copyright (c) 2001 The NetBSD Foundation, Inc.
4f8307766Sgmcgarry.\" All rights reserved.
5f8307766Sgmcgarry.\"
6f8307766Sgmcgarry.\" This code is derived from software contributed to The NetBSD Foundation
7f8307766Sgmcgarry.\" by Gregory McGarry.
8f8307766Sgmcgarry.\"
9f8307766Sgmcgarry.\" Redistribution and use in source and binary forms, with or without
10f8307766Sgmcgarry.\" modification, are permitted provided that the following conditions
11f8307766Sgmcgarry.\" are met:
12f8307766Sgmcgarry.\" 1. Redistributions of source code must retain the above copyright
13f8307766Sgmcgarry.\"    notice, this list of conditions and the following disclaimer.
14f8307766Sgmcgarry.\" 2. Redistributions in binary form must reproduce the above copyright
15f8307766Sgmcgarry.\"    notice, this list of conditions and the following disclaimer in the
16f8307766Sgmcgarry.\"    documentation and/or other materials provided with the distribution.
17f8307766Sgmcgarry.\"
18f8307766Sgmcgarry.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19f8307766Sgmcgarry.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20f8307766Sgmcgarry.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21f8307766Sgmcgarry.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22f8307766Sgmcgarry.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23f8307766Sgmcgarry.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24f8307766Sgmcgarry.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25f8307766Sgmcgarry.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26f8307766Sgmcgarry.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27f8307766Sgmcgarry.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28f8307766Sgmcgarry.\" POSSIBILITY OF SUCH DAMAGE.
29f8307766Sgmcgarry.\"
301bf28fdbSabhinav.Dd March 31, 2017
31f8307766Sgmcgarry.Dt UTIL 3
32f8307766Sgmcgarry.Os
33f8307766Sgmcgarry.Sh NAME
341d9550a5Sjruoho.Nm util ,
351d9550a5Sjruoho.Nm libutil
36f8307766Sgmcgarry.Nd system utilities library
37f8307766Sgmcgarry.Sh LIBRARY
38f8307766Sgmcgarry.Lb libutil
39f8307766Sgmcgarry.Sh DESCRIPTION
40f8307766SgmcgarryThe
41f8307766Sgmcgarry.Nm
42f8307766Sgmcgarrylibrary is the system utilities library and contains various
4327adb020Swizsystem-dependent utility routines used in a wide variety of system daemons.
4427adb020SwizThe abstracted functions are mostly related to pseudo-terminals
4527adb020Swizand login accounting.
4627adb020SwizThese routines are
4752c3aaafSwiz.Nx Ns -specific
4827adb020Swizand are not portable.
4927adb020SwizTheir use should be restricted.
50c17db6caSjruoho.Pp
5127adb020SwizDeclarations for these functions may be obtained from the include file
52c17db6caSjruoho.In util.h .
53c17db6caSjruohoThe
54c17db6caSjruoho.Nm
55c17db6caSjruoholibrary and the associated functions are implemented within the
56c17db6caSjruoho.Pa /usr/src/lib/libutil
57c17db6caSjruohodirectory.
5859d481ffSjruoho.Sh LIST OF FUNCTIONS
5959d481ffSjruoho.Bl -column ".Xr sockaddr_snprintf 3" -compact
60ad5244b4Sabhinav.It Sy Name Ta Sy Description
6159d481ffSjruoho.It Xr disklabel_dkcksum 3 Ta compute the checksum for a disklabel
6259d481ffSjruoho.It Xr disklabel_scan 3 Ta scan a buffer for a valid disklabel
631bf28fdbSabhinav.It Xr efun 3 Ta error checked utility functions
6459d481ffSjruoho.It Xr forkpty 3 Ta tty utility function
6559d481ffSjruoho.It Xr getbootfile 3 Ta get the name of the booted kernel file
661bf28fdbSabhinav.It Xr getbyteorder 3 Ta get the current byte order
67*c2f2b1bfSmsaitoh.It Xr getdiskrawname 3 Ta get the block/character device name for a disk
681bf28fdbSabhinav.It Xr getfsspecname 3 Ta get the underlying wedge name from a label
691bf28fdbSabhinav.It Xr getfstypename 3 Ta convert a partition file system type integer to a wedge
701bf28fdbSabhinavpartition type name
7159d481ffSjruoho.It Xr getlabeloffset 3 Ta get the sector number and offset of the disklabel
7259d481ffSjruoho.It Xr getlabelsector 3 Ta get the sector number and offset of the disklabel
7359d481ffSjruoho.It Xr getmaxpartitions 3 Ta get the maximum number of partitions allowed per disk
741bf28fdbSabhinav.It Xr getmntopts 3 Ta scan mount options
7559d481ffSjruoho.It Xr getrawpartition 3 Ta get the system ``raw'' partition
761bf28fdbSabhinav.It Xr kinfo_getvmmap 3 Ta get per-process memory map information
7759d481ffSjruoho.It Xr login 3 Ta login utility function
7859d481ffSjruoho.It Xr login_cap 3 Ta query login.conf database about a user class
7959d481ffSjruoho.It Xr login_close 3 Ta query login.conf database about a user class
8059d481ffSjruoho.It Xr login_getcapbool 3 Ta query login.conf database about a user class
8159d481ffSjruoho.It Xr login_getcapnum 3 Ta query login.conf database about a user class
8259d481ffSjruoho.It Xr login_getcapsize 3 Ta query login.conf database about a user class
8359d481ffSjruoho.It Xr login_getcapstr 3 Ta query login.conf database about a user class
8459d481ffSjruoho.It Xr login_getcaptime 3 Ta query login.conf database about a user class
8559d481ffSjruoho.It Xr login_getclass 3 Ta query login.conf database about a user class
8659d481ffSjruoho.It Xr login_tty 3 Ta tty utility function
8759d481ffSjruoho.It Xr loginx 3 Ta login utility function
8859d481ffSjruoho.It Xr logout 3 Ta login utility function
8959d481ffSjruoho.It Xr logoutx 3 Ta login utility function
9059d481ffSjruoho.It Xr logwtmp 3 Ta login utility function
9159d481ffSjruoho.It Xr logwtmpx 3 Ta login utility function
9259d481ffSjruoho.It Xr opendisk 3 Ta open a disk partition
9359d481ffSjruoho.It Xr openpty 3 Ta tty utility function
9459d481ffSjruoho.It Xr pidfile 3 Ta write a daemon pid file
9559d481ffSjruoho.It Xr pidlock 3 Ta locks based on files containing PIDs
961bf28fdbSabhinav.It Xr proc_compare 3 Ta compare two processes' interactivity
9759d481ffSjruoho.It Xr pw_abort 3 Ta passwd file update function
9859d481ffSjruoho.It Xr pw_copy 3 Ta utility function for interactive passwd file updates
9959d481ffSjruoho.It Xr pw_edit 3 Ta utility function for interactive passwd file updates
10059d481ffSjruoho.It Xr pw_error 3 Ta utility function for interactive passwd file updates
10159d481ffSjruoho.It Xr pw_getconf 3 Ta password encryption configuration access function
10259d481ffSjruoho.It Xr pw_getprefix 3 Ta passwd file update function
10359d481ffSjruoho.It Xr pw_init 3 Ta utility function for interactive passwd file updates
10459d481ffSjruoho.It Xr pw_lock 3 Ta passwd file update function
10559d481ffSjruoho.It Xr pw_mkdb 3 Ta passwd file update function
10659d481ffSjruoho.It Xr pw_prompt 3 Ta utility function for interactive passwd file updates
10759d481ffSjruoho.It Xr pw_scan 3 Ta utility function for interactive passwd file updates
10859d481ffSjruoho.It Xr pw_setprefix 3 Ta passwd file update function
1091bf28fdbSabhinav.It Xr raise_default_signal 3 Ta raise the default signal handler
11059d481ffSjruoho.It Xr secure_path 3 Ta determine if a file appears to be ``secure''
11159d481ffSjruoho.It Xr setclasscontext 3 Ta query login.conf database about a user class
11259d481ffSjruoho.It Xr setusercontext 3 Ta query login.conf database about a user class
11359d481ffSjruoho.It Xr snprintb 3 Ta bitmask output conversion
11459d481ffSjruoho.It Xr sockaddr_snprintf 3 Ta socket address formatting function
115fef3cbf8Sjruoho.It Xr strpct 3 Ta decimal percent formatter
11659d481ffSjruoho.It Xr ttyaction 3 Ta ttyaction utility function
11759d481ffSjruoho.It Xr ttylock 3 Ta locks based on files containing PIDs
11859d481ffSjruoho.It Xr ttymsg 3 Ta ttymsg utility function
11959d481ffSjruoho.It Xr ttyunlock 3 Ta locks based on files containing PIDs
12059d481ffSjruoho.El
121f8307766Sgmcgarry.Sh FILES
122f8307766Sgmcgarry.Bl -tag -width /usr/lib/libutil_p.a -compact
123f8307766Sgmcgarry.It Pa /usr/lib/libutil.a
124f8307766Sgmcgarrystatic util library
125f8307766Sgmcgarry.It Pa /usr/lib/libutil.so
126f8307766Sgmcgarrydynamic util library
127f8307766Sgmcgarry.It Pa /usr/lib/libutil_p.a
128f8307766Sgmcgarrystatic util library compiled for profiling
129f8307766Sgmcgarry.El
1306afdea39Sahoka.Sh SEE ALSO
131c17db6caSjruoho.Xr efun 3 ,
132c17db6caSjruoho.Xr intro 3
133