xref: /freebsd/share/man/man9/uidinfo.9 (revision edf8578117e8844e02c0121147f45e4609b30680)
1.\"
2.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice(s), this list of conditions and the following disclaimer as
9.\"    the first lines of this file unmodified other than the possible
10.\"    addition of one or more copyright notices.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice(s), this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\"
15.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
16.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18.\" DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
19.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
25.\" DAMAGE.
26.\"
27.Dd July 10, 2001
28.Dt UIDINFO 9
29.Os
30.Sh NAME
31.Nm uidinfo ,
32.Nm uihashinit ,
33.Nm uifind ,
34.Nm uihold ,
35.Nm uifree
36.Nd "functions for managing UID information"
37.Sh SYNOPSIS
38.In sys/param.h
39.In sys/proc.h
40.In sys/resourcevar.h
41.Ft void
42.Fn uihashinit void
43.Ft "struct uidinfo *"
44.Fn uifind "uid_t uid"
45.Ft void
46.Fn uihold "struct uidinfo *uip"
47.Ft void
48.Fn uifree "struct uidinfo *uip"
49.Sh DESCRIPTION
50The
51.Nm
52family of functions
53is used to manage
54.Vt uidinfo
55structures.
56Each
57.Vt uidinfo
58structure maintains per uid resource consumption counts, including the
59process count and socket buffer space usage.
60.Pp
61The
62.Fn uihashinit
63function initializes the
64.Vt uidinfo
65hash table and its mutex.
66This function should only be called during system initialization.
67.Pp
68The
69.Fn uifind
70function looks up and returns the
71.Vt uidinfo
72structure for
73.Fa uid .
74If no
75.Vt uidinfo
76structure exists for
77.Fa uid ,
78a new structure will be allocated and initialized.
79The
80.Nm
81hash mutex is acquired and released.
82.Pp
83The
84.Fn uihold
85function increases the reference count on
86.Fa uip .
87.Fa uip Ns 's
88lock is acquired and released.
89.Pp
90The
91.Fn uifree
92function decreases the reference count on
93.Fa uip ,
94and if the count reaches 0
95.Fa uip
96is freed.
97.Fa uip Ns 's
98lock is acquired and release and the uidinfo hash mutex may be
99acquired and released.
100.Sh RETURN VALUES
101.Fn uifind
102returns a pointer to an initialized
103.Vt uidinfo
104structure, and should not fail.
105.Sh AUTHORS
106This manual page was written by
107.An Chad David Aq Mt davidc@acns.ab.ca .
108