Merge commit '9276b3991ba20d5a5660887ba81b0bc7bed25a0c'
[unleashed.git] / share / man / man9f / drv_priv.9f
blobfb2a4412db04f02199a4799889dd2f633326340b
1 '\" te
2 .\" Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved.
3 .\" Copyright 1989 AT&T
4 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
5 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
6 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
7 .TH DRV_PRIV 9F "Jan 16, 2006"
8 .SH NAME
9 drv_priv \- determine driver privilege
10 .SH SYNOPSIS
11 .LP
12 .nf
13 #include <sys/types.h>
14 #include <sys/cred.h>
15 #include <sys/ddi.h>
19 \fBint\fR \fBdrv_priv\fR(\fBcred_t *\fR\fIcr\fR);
20 .fi
22 .SH INTERFACE LEVEL
23 .sp
24 .LP
25 Architecture independent level 1 (DDI/DKI).
26 .SH PARAMETERS
27 .sp
28 .ne 2
29 .na
30 \fB\fIcr\fR\fR
31 .ad
32 .RS 6n
33 Pointer to the user credential structure.
34 .RE
36 .SH DESCRIPTION
37 .sp
38 .LP
39 The \fBdrv_priv()\fR function provides a general interface to the system
40 privilege policy. It determines whether the credentials supplied by the user
41 credential structure pointed to by \fIcr\fR identify a process that has the
42 \fB{PRIV_SYS_DEVICES}\fR privilege asserted in its effective set. This function
43 should be used only when file access modes, special minor device numbers, and
44 the device policy (see \fBprivileges\fR(5), \fBadd_drv\fR(8)) are insufficient
45 to provide protection for the requested driver function. It is intended to
46 replace all calls to \fBsuser()\fR and any explicit checks for effective user
47 ID = 0 in driver code.
48 .SH RETURN VALUES
49 .sp
50 .LP
51 This routine returns \fB0\fR if it succeeds, \fBEPERM\fR if it fails.
52 .SH CONTEXT
53 .sp
54 .LP
55 The \fBdrv_priv()\fR function can be called from user, interrupt, or kernel
56 context.
57 .SH SEE ALSO
58 .sp
59 .LP
60 \fBadd_drv\fR(8), \fBupdate_drv\fR(8), \fBprivileges\fR(5)
61 .sp
62 .LP
63 \fIWriting Device Drivers\fR