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 , 374772483cSRuslan Ermilov.Nm crcopy , 384772483cSRuslan Ermilov.Nm crdup 394772483cSRuslan Ermilov.Nd "functions related to user credentials" 404772483cSRuslan Ermilov.Sh SYNOPSIS 414772483cSRuslan Ermilov.In sys/param.h 424772483cSRuslan Ermilov.In sys/ucred.h 434772483cSRuslan Ermilov.Ft "struct ucred *" 444772483cSRuslan Ermilov.Fn crget void 454772483cSRuslan Ermilov.Ft void 464772483cSRuslan Ermilov.Fn crhold "struct ucred *cr" 474772483cSRuslan Ermilov.Ft void 484772483cSRuslan Ermilov.Fn crfree "struct ucred *cr" 494772483cSRuslan Ermilov.Ft "struct ucred *" 504772483cSRuslan Ermilov.Fn crcopy "struct ucred *cr" 514772483cSRuslan Ermilov.Ft "struct ucred *" 524772483cSRuslan Ermilov.Fn crdup "struct ucred *cr" 534772483cSRuslan Ermilov.Sh DESCRIPTION 544772483cSRuslan ErmilovThe 554772483cSRuslan Ermilov.Nm 564772483cSRuslan Ermilovfamily of functions is used to manage user credential structures 574772483cSRuslan Ermilov.Pq Vt "struct ucred" 584772483cSRuslan Ermilovwithin the kernel. 594772483cSRuslan Ermilov.Pp 604772483cSRuslan ErmilovThe 614772483cSRuslan Ermilov.Fn crget 624772483cSRuslan Ermilovfunction allocates memory 634772483cSRuslan Ermilovfor a new structure, sets its reference count to 1, and 644772483cSRuslan Ermilovinitializes its lock. 654772483cSRuslan Ermilov.Pp 664772483cSRuslan ErmilovThe 674772483cSRuslan Ermilov.Fn crhold 684772483cSRuslan Ermilovfunction increases the reference count on the credential. 694772483cSRuslan Ermilov.Pp 704772483cSRuslan ErmilovThe 714772483cSRuslan Ermilov.Fn crfree 724772483cSRuslan Ermilovfunction decreases the reference count on the credential. 734772483cSRuslan ErmilovIf the count drops to 0, the storage for the structure is freed. 744772483cSRuslan Ermilov.Pp 754772483cSRuslan ErmilovThe 764772483cSRuslan Ermilov.Fn crcopy 774772483cSRuslan Ermilovfunction calls 784772483cSRuslan Ermilov.Fn crdup 794772483cSRuslan Ermilovto create a new structure, and copies the old credentials, 804772483cSRuslan Ermilovif the reference count is greater than 1; 814772483cSRuslan Ermilovotherwise, the original is returned. 824772483cSRuslan Ermilov.Pp 834772483cSRuslan ErmilovThe 844772483cSRuslan Ermilov.Fn crdup 854772483cSRuslan Ermilovfunction allocates memory for a new structure, 864772483cSRuslan Ermilovcopies the contents of the original structure 874772483cSRuslan Ermilovinto it, references the 884772483cSRuslan Ermilov.Va cr_uidinfo 894772483cSRuslan Ermilovand 904772483cSRuslan Ermilov.Va cr_ruidinfo 914772483cSRuslan Ermilovfields, sets the reference count 924772483cSRuslan Ermilovto 1, and then returns the new structure. 934772483cSRuslan Ermilov.Sh RETURN VALUES 944772483cSRuslan ErmilovThe functions that return values all return a pointer to a 954772483cSRuslan Ermilov.Vt ucred 964772483cSRuslan Ermilovstructure. 974772483cSRuslan ErmilovIn the case of 984772483cSRuslan Ermilov.Fn crcopy , 994772483cSRuslan Ermilovthe return value may be the same structure you passed to it. 1004772483cSRuslan Ermilov.Sh SEE ALSO 1014772483cSRuslan Ermilov.Xr uihold 9 1024772483cSRuslan Ermilov.Sh AUTHORS 1034772483cSRuslan ErmilovThis man page was written by 1044772483cSRuslan Ermilov.An Chad David Aq davidc@acns.ab.ca . 105