1.\" $NetBSD: util.3,v 1.27 2019/03/08 08:12:39 msaitoh Exp $ 2.\" 3.\" Copyright (c) 2001 The NetBSD Foundation, Inc. 4.\" All rights reserved. 5.\" 6.\" This code is derived from software contributed to The NetBSD Foundation 7.\" by Gregory McGarry. 8.\" 9.\" Redistribution and use in source and binary forms, with or without 10.\" modification, are permitted provided that the following conditions 11.\" are met: 12.\" 1. Redistributions of source code must retain the above copyright 13.\" notice, this list of conditions and the following disclaimer. 14.\" 2. Redistributions in binary form must reproduce the above copyright 15.\" notice, this list of conditions and the following disclaimer in the 16.\" documentation and/or other materials provided with the distribution. 17.\" 18.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 19.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28.\" POSSIBILITY OF SUCH DAMAGE. 29.\" 30.Dd March 31, 2017 31.Dt UTIL 3 32.Os 33.Sh NAME 34.Nm util , 35.Nm libutil 36.Nd system utilities library 37.Sh LIBRARY 38.Lb libutil 39.Sh DESCRIPTION 40The 41.Nm 42library is the system utilities library and contains various 43system-dependent utility routines used in a wide variety of system daemons. 44The abstracted functions are mostly related to pseudo-terminals 45and login accounting. 46These routines are 47.Nx Ns -specific 48and are not portable. 49Their use should be restricted. 50.Pp 51Declarations for these functions may be obtained from the include file 52.In util.h . 53The 54.Nm 55library and the associated functions are implemented within the 56.Pa /usr/src/lib/libutil 57directory. 58.Sh LIST OF FUNCTIONS 59.Bl -column ".Xr sockaddr_snprintf 3" -compact 60.It Sy Name Ta Sy Description 61.It Xr disklabel_dkcksum 3 Ta compute the checksum for a disklabel 62.It Xr disklabel_scan 3 Ta scan a buffer for a valid disklabel 63.It Xr efun 3 Ta error checked utility functions 64.It Xr forkpty 3 Ta tty utility function 65.It Xr getbootfile 3 Ta get the name of the booted kernel file 66.It Xr getbyteorder 3 Ta get the current byte order 67.It Xr getdiskrawname 3 Ta get the block/character device name for a disk 68.It Xr getfsspecname 3 Ta get the underlying wedge name from a label 69.It Xr getfstypename 3 Ta convert a partition file system type integer to a wedge 70partition type name 71.It Xr getlabeloffset 3 Ta get the sector number and offset of the disklabel 72.It Xr getlabelsector 3 Ta get the sector number and offset of the disklabel 73.It Xr getmaxpartitions 3 Ta get the maximum number of partitions allowed per disk 74.It Xr getmntopts 3 Ta scan mount options 75.It Xr getrawpartition 3 Ta get the system ``raw'' partition 76.It Xr kinfo_getvmmap 3 Ta get per-process memory map information 77.It Xr login 3 Ta login utility function 78.It Xr login_cap 3 Ta query login.conf database about a user class 79.It Xr login_close 3 Ta query login.conf database about a user class 80.It Xr login_getcapbool 3 Ta query login.conf database about a user class 81.It Xr login_getcapnum 3 Ta query login.conf database about a user class 82.It Xr login_getcapsize 3 Ta query login.conf database about a user class 83.It Xr login_getcapstr 3 Ta query login.conf database about a user class 84.It Xr login_getcaptime 3 Ta query login.conf database about a user class 85.It Xr login_getclass 3 Ta query login.conf database about a user class 86.It Xr login_tty 3 Ta tty utility function 87.It Xr loginx 3 Ta login utility function 88.It Xr logout 3 Ta login utility function 89.It Xr logoutx 3 Ta login utility function 90.It Xr logwtmp 3 Ta login utility function 91.It Xr logwtmpx 3 Ta login utility function 92.It Xr opendisk 3 Ta open a disk partition 93.It Xr openpty 3 Ta tty utility function 94.It Xr pidfile 3 Ta write a daemon pid file 95.It Xr pidlock 3 Ta locks based on files containing PIDs 96.It Xr proc_compare 3 Ta compare two processes' interactivity 97.It Xr pw_abort 3 Ta passwd file update function 98.It Xr pw_copy 3 Ta utility function for interactive passwd file updates 99.It Xr pw_edit 3 Ta utility function for interactive passwd file updates 100.It Xr pw_error 3 Ta utility function for interactive passwd file updates 101.It Xr pw_getconf 3 Ta password encryption configuration access function 102.It Xr pw_getprefix 3 Ta passwd file update function 103.It Xr pw_init 3 Ta utility function for interactive passwd file updates 104.It Xr pw_lock 3 Ta passwd file update function 105.It Xr pw_mkdb 3 Ta passwd file update function 106.It Xr pw_prompt 3 Ta utility function for interactive passwd file updates 107.It Xr pw_scan 3 Ta utility function for interactive passwd file updates 108.It Xr pw_setprefix 3 Ta passwd file update function 109.It Xr raise_default_signal 3 Ta raise the default signal handler 110.It Xr secure_path 3 Ta determine if a file appears to be ``secure'' 111.It Xr setclasscontext 3 Ta query login.conf database about a user class 112.It Xr setusercontext 3 Ta query login.conf database about a user class 113.It Xr snprintb 3 Ta bitmask output conversion 114.It Xr sockaddr_snprintf 3 Ta socket address formatting function 115.It Xr strpct 3 Ta decimal percent formatter 116.It Xr ttyaction 3 Ta ttyaction utility function 117.It Xr ttylock 3 Ta locks based on files containing PIDs 118.It Xr ttymsg 3 Ta ttymsg utility function 119.It Xr ttyunlock 3 Ta locks based on files containing PIDs 120.El 121.Sh FILES 122.Bl -tag -width /usr/lib/libutil_p.a -compact 123.It Pa /usr/lib/libutil.a 124static util library 125.It Pa /usr/lib/libutil.so 126dynamic util library 127.It Pa /usr/lib/libutil_p.a 128static util library compiled for profiling 129.El 130.Sh SEE ALSO 131.Xr efun 3 , 132.Xr intro 3 133