xref: /original-bsd/lib/libc/gen/pwcache.3 (revision 35d77a20)
1.\" Copyright (c) 1989, 1991 The Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" %sccs.include.redist.man%
5.\"
6.\"     @(#)pwcache.3	5.4 (Berkeley) 04/19/91
7.\"
8.Dd
9.Dt PWCACHE 3
10.Os
11.Sh NAME
12.Nm pwcache
13.Nd cache password and group entries
14.Sh SYNOPSIS
15.Fn user_from_uid "uid_t uid" "int nouser"
16.Fn group_from_gid "gid_t gid" "int nogroup"
17.Sh DESCRIPTION
18.Bf -symbolic
19This interface is not part of the C library.
20It has been placed in the Berkeley utility library, libutil, as it is
21used by several standard utilities.
22.Ef
23.Pp
24The
25.Fn user_from_uid
26function returns the user name associated with the argument
27.Fa uid .
28The user name is cached so that multiple calls with the same
29.Fa uid
30do not require additional calls to
31.Xr getpwuid 3 .
32If there is no user associated with the
33.Fa uid ,
34a pointer is returned
35to an
36.Tn ASCII
37representation of the
38.Fa uid ,
39unless the argument
40.Fa nouser
41is non-zero, in which case a
42.Dv NULL
43pointer is returned.
44.Pp
45The
46.Fn group_from_gid
47function returns the group name associated with the argument
48.Fa gid .
49The group name is cached so that multiple calls with the same
50.Fa gid
51do not require additional calls to
52.Xr getgrgid 3 .
53If there is no group associated with the
54.Fa gid ,
55a pointer is returned
56to an
57.Tn ASCII
58representation of the
59.Fa gid ,
60unless the argument
61.Fa nogroup
62is non-zero, in which case a
63.Dv NULL
64pointer is returned.
65.Sh SEE ALSO
66.Xr getgrgid 3 ,
67.Xr getpwuid 3
68.Sh HISTORY
69The
70.Fn user_from_id
71and
72.Fn group_from_id
73functions are
74.Ud .
75