1.\" $NetBSD: util.3,v 1.24 2011/08/29 12:39:50 jruoho 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 August 29, 2011 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 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 forkpty 3 Ta tty utility function 64.It Xr getbootfile 3 Ta get the name of the booted kernel file 65.It Xr getlabeloffset 3 Ta get the sector number and offset of the disklabel 66.It Xr getlabelsector 3 Ta get the sector number and offset of the disklabel 67.It Xr getmaxpartitions 3 Ta get the maximum number of partitions allowed per disk 68.It Xr getrawpartition 3 Ta get the system ``raw'' partition 69.It Xr login 3 Ta login utility function 70.It Xr login_cap 3 Ta query login.conf database about a user class 71.It Xr login_close 3 Ta query login.conf database about a user class 72.It Xr login_getcapbool 3 Ta query login.conf database about a user class 73.It Xr login_getcapnum 3 Ta query login.conf database about a user class 74.It Xr login_getcapsize 3 Ta query login.conf database about a user class 75.It Xr login_getcapstr 3 Ta query login.conf database about a user class 76.It Xr login_getcaptime 3 Ta query login.conf database about a user class 77.It Xr login_getclass 3 Ta query login.conf database about a user class 78.It Xr login_tty 3 Ta tty utility function 79.It Xr loginx 3 Ta login utility function 80.It Xr logout 3 Ta login utility function 81.It Xr logoutx 3 Ta login utility function 82.It Xr logwtmp 3 Ta login utility function 83.It Xr logwtmpx 3 Ta login utility function 84.It Xr opendisk 3 Ta open a disk partition 85.It Xr openpty 3 Ta tty utility function 86.It Xr pidfile 3 Ta write a daemon pid file 87.It Xr pidlock 3 Ta locks based on files containing PIDs 88.It Xr pw_abort 3 Ta passwd file update function 89.It Xr pw_copy 3 Ta utility function for interactive passwd file updates 90.It Xr pw_edit 3 Ta utility function for interactive passwd file updates 91.It Xr pw_error 3 Ta utility function for interactive passwd file updates 92.It Xr pw_getconf 3 Ta password encryption configuration access function 93.It Xr pw_getprefix 3 Ta passwd file update function 94.It Xr pw_init 3 Ta utility function for interactive passwd file updates 95.It Xr pw_lock 3 Ta passwd file update function 96.It Xr pw_mkdb 3 Ta passwd file update function 97.It Xr pw_prompt 3 Ta utility function for interactive passwd file updates 98.It Xr pw_scan 3 Ta utility function for interactive passwd file updates 99.It Xr pw_setprefix 3 Ta passwd file update function 100.It Xr secure_path 3 Ta determine if a file appears to be ``secure'' 101.It Xr setclasscontext 3 Ta query login.conf database about a user class 102.It Xr setusercontext 3 Ta query login.conf database about a user class 103.It Xr snprintb 3 Ta bitmask output conversion 104.It Xr sockaddr_snprintf 3 Ta socket address formatting function 105.It Xr strpct 3 Ta decimal percent formatter 106.It Xr ttyaction 3 Ta ttyaction utility function 107.It Xr ttylock 3 Ta locks based on files containing PIDs 108.It Xr ttymsg 3 Ta ttymsg utility function 109.It Xr ttyunlock 3 Ta locks based on files containing PIDs 110.El 111.Sh FILES 112.Bl -tag -width /usr/lib/libutil_p.a -compact 113.It Pa /usr/lib/libutil.a 114static util library 115.It Pa /usr/lib/libutil.so 116dynamic util library 117.It Pa /usr/lib/libutil_p.a 118static util library compiled for profiling 119.El 120.Sh SEE ALSO 121.Xr efun 3 , 122.Xr intro 3 123