14772483cSRuslan Ermilov.\" 24772483cSRuslan Ermilov.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved. 34772483cSRuslan Ermilov.\" 44772483cSRuslan Ermilov.\" Redistribution and use in source and binary forms, with or without 54772483cSRuslan Ermilov.\" modification, are permitted provided that the following conditions 64772483cSRuslan Ermilov.\" are met: 74772483cSRuslan Ermilov.\" 1. Redistributions of source code must retain the above copyright 84772483cSRuslan Ermilov.\" notice(s), this list of conditions and the following disclaimer as 94772483cSRuslan Ermilov.\" the first lines of this file unmodified other than the possible 104772483cSRuslan Ermilov.\" addition of one or more copyright notices. 114772483cSRuslan Ermilov.\" 2. Redistributions in binary form must reproduce the above copyright 124772483cSRuslan Ermilov.\" notice(s), this list of conditions and the following disclaimer in the 134772483cSRuslan Ermilov.\" documentation and/or other materials provided with the distribution. 144772483cSRuslan Ermilov.\" 154772483cSRuslan Ermilov.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY 164772483cSRuslan Ermilov.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 174772483cSRuslan Ermilov.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 184772483cSRuslan Ermilov.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY 194772483cSRuslan Ermilov.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 204772483cSRuslan Ermilov.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 214772483cSRuslan Ermilov.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 224772483cSRuslan Ermilov.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 234772483cSRuslan Ermilov.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 244772483cSRuslan Ermilov.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 254772483cSRuslan Ermilov.\" DAMAGE. 264772483cSRuslan Ermilov.\" 274772483cSRuslan Ermilov.\" $FreeBSD$ 284772483cSRuslan Ermilov.\" 294772483cSRuslan Ermilov.Dd July 9, 2001 304772483cSRuslan Ermilov.Dt UCRED 9 314772483cSRuslan Ermilov.Os 324772483cSRuslan Ermilov.Sh NAME 334772483cSRuslan Ermilov.Nm ucred , 344772483cSRuslan Ermilov.Nm crget , 354772483cSRuslan Ermilov.Nm crhold , 364772483cSRuslan Ermilov.Nm crfree , 3757813e7fSRuslan Ermilov.Nm crshared , 384772483cSRuslan Ermilov.Nm crcopy , 394772483cSRuslan Ermilov.Nm crdup 404772483cSRuslan Ermilov.Nd "functions related to user credentials" 414772483cSRuslan Ermilov.Sh SYNOPSIS 424772483cSRuslan Ermilov.In sys/param.h 434772483cSRuslan Ermilov.In sys/ucred.h 444772483cSRuslan Ermilov.Ft "struct ucred *" 454772483cSRuslan Ermilov.Fn crget void 46f16b3c0dSChad David.Ft "struct ucred *" 474772483cSRuslan Ermilov.Fn crhold "struct ucred *cr" 484772483cSRuslan Ermilov.Ft void 494772483cSRuslan Ermilov.Fn crfree "struct ucred *cr" 5057813e7fSRuslan Ermilov.Ft int 5157813e7fSRuslan Ermilov.Fn crshared "struct ucred *cr" 5257813e7fSRuslan Ermilov.Ft void 5357813e7fSRuslan Ermilov.Fn crcopy "struct ucred *dest" "struct ucred *src" 544772483cSRuslan Ermilov.Ft "struct ucred *" 554772483cSRuslan Ermilov.Fn crdup "struct ucred *cr" 564772483cSRuslan Ermilov.Sh DESCRIPTION 574772483cSRuslan ErmilovThe 584772483cSRuslan Ermilov.Nm 594772483cSRuslan Ermilovfamily of functions is used to manage user credential structures 604772483cSRuslan Ermilov.Pq Vt "struct ucred" 614772483cSRuslan Ermilovwithin the kernel. 624772483cSRuslan Ermilov.Pp 634772483cSRuslan ErmilovThe 644772483cSRuslan Ermilov.Fn crget 654772483cSRuslan Ermilovfunction allocates memory 664772483cSRuslan Ermilovfor a new structure, sets its reference count to 1, and 674772483cSRuslan Ermilovinitializes its lock. 684772483cSRuslan Ermilov.Pp 694772483cSRuslan ErmilovThe 704772483cSRuslan Ermilov.Fn crhold 714772483cSRuslan Ermilovfunction increases the reference count on the credential. 724772483cSRuslan Ermilov.Pp 734772483cSRuslan ErmilovThe 744772483cSRuslan Ermilov.Fn crfree 754772483cSRuslan Ermilovfunction decreases the reference count on the credential. 764772483cSRuslan ErmilovIf the count drops to 0, the storage for the structure is freed. 774772483cSRuslan Ermilov.Pp 784772483cSRuslan ErmilovThe 7957813e7fSRuslan Ermilov.Fn crshared 8057813e7fSRuslan Ermilovfunction returns true if the credential is shared. 8157813e7fSRuslan ErmilovA credential is considered to be shared if its reference 8257813e7fSRuslan Ermilovcount is greater than one. 8357813e7fSRuslan Ermilov.Pp 8457813e7fSRuslan ErmilovThe 854772483cSRuslan Ermilov.Fn crcopy 8657813e7fSRuslan Ermilovfunction copies the contents of the source (template) 8757813e7fSRuslan Ermilovcredential into the destination template. 8857813e7fSRuslan ErmilovThe 8957813e7fSRuslan Ermilov.Vt uidinfo 9057813e7fSRuslan Ermilovstructure within the destination is referenced 9157813e7fSRuslan Ermilovby calling 9257813e7fSRuslan Ermilov.Xr uihold 9 . 934772483cSRuslan Ermilov.Pp 944772483cSRuslan ErmilovThe 954772483cSRuslan Ermilov.Fn crdup 9657813e7fSRuslan Ermilovfunction allocates memory for a new structure and copies the 9757813e7fSRuslan Ermilovcontents of 9857813e7fSRuslan Ermilov.Fa cr 9957813e7fSRuslan Ermilovinto it. 10057813e7fSRuslan ErmilovThe actual copying is performed by 10157813e7fSRuslan Ermilov.Fn crcopy . 1024772483cSRuslan Ermilov.Sh RETURN VALUES 1034772483cSRuslan ErmilovThe functions that return values all return a pointer to a 1044772483cSRuslan Ermilov.Vt ucred 1054772483cSRuslan Ermilovstructure. 1064772483cSRuslan Ermilov.Sh SEE ALSO 1074772483cSRuslan Ermilov.Xr uihold 9 1084772483cSRuslan Ermilov.Sh AUTHORS 1094772483cSRuslan ErmilovThis man page was written by 1104772483cSRuslan Ermilov.An Chad David Aq davidc@acns.ab.ca . 111