xref: /titanic_52/usr/src/lib/libc/port/sys/ppriv.c (revision a72f7ea693101cc48bafbb4db6bb437d828011c4)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #pragma ident	"%Z%%M%	%I%	%E% SMI"
28 
29 #pragma weak setppriv = _setppriv
30 #pragma weak getppriv = _getppriv
31 #pragma weak setpflags = _setpflags
32 #pragma weak getpflags = _getpflags
33 
34 #include "synonyms.h"
35 #include <sys/types.h>
36 #include <sys/syscall.h>
37 #include "priv_private.h"
38 #include <priv.h>
39 
40 int
41 setppriv(priv_op_t op, priv_ptype_t type, const priv_set_t *pset)
42 {
43 	priv_data_t *d;
44 	int set;
45 
46 	LOADPRIVDATA(d);
47 
48 	set = priv_getsetbyname(type);
49 
50 	return (syscall(SYS_privsys, PRIVSYS_SETPPRIV, op, set, (void *)pset,
51 	    d->pd_setsize));
52 }
53 
54 int
55 getppriv(priv_ptype_t type, priv_set_t *pset)
56 {
57 	priv_data_t *d;
58 	int set;
59 
60 	LOADPRIVDATA(d);
61 
62 	set = priv_getsetbyname(type);
63 
64 	return (syscall(SYS_privsys, PRIVSYS_GETPPRIV, 0, set, (void *)pset,
65 	    d->pd_setsize));
66 }
67 
68 int
69 getprivinfo(priv_impl_info_t *buf, size_t bufsize)
70 {
71 	return (syscall(SYS_privsys, PRIVSYS_GETIMPLINFO, 0, 0, (void *)buf,
72 	    bufsize));
73 }
74 
75 int
76 setpflags(uint_t flag, uint_t val)
77 {
78 	return (syscall(SYS_privsys, PRIVSYS_SETPFLAGS, (priv_op_t)flag,
79 			(priv_ptype_t)(uintptr_t)val, 0, 0));
80 }
81 
82 uint_t
83 getpflags(uint_t flag)
84 {
85 	return (syscall(SYS_privsys, PRIVSYS_GETPFLAGS, flag, 0, 0, 0));
86 }
87