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 (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 22 /* 23 * Copyright 2008 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 "lint.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