xref: /illumos-gate/usr/src/head/priv.h (revision ba3594ba9b5dd4c846c472a8d657edcb7c8109ac)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5634e26ecSCasper H.S. Dik  * Common Development and Distribution License (the "License").
6634e26ecSCasper H.S. Dik  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22*ba3594baSGarrett D'Amore  * Copyright 2014 Garrett D'Amore <garrett@damore.org>
23*ba3594baSGarrett D'Amore  *
24634e26ecSCasper H.S. Dik  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
257c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
267c478bd9Sstevel@tonic-gate  */
277c478bd9Sstevel@tonic-gate 
287c478bd9Sstevel@tonic-gate #ifndef	_PRIV_H_
297c478bd9Sstevel@tonic-gate #define	_PRIV_H_
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate #include <sys/priv.h>
327c478bd9Sstevel@tonic-gate 
337c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
347c478bd9Sstevel@tonic-gate extern "C" {
357c478bd9Sstevel@tonic-gate #endif
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate #define	PRIV_STR_PORT		0x00			/* portable output */
387c478bd9Sstevel@tonic-gate #define	PRIV_STR_LIT		0x01			/* literal output */
397c478bd9Sstevel@tonic-gate #define	PRIV_STR_SHORT		0x02			/* shortest output */
407c478bd9Sstevel@tonic-gate 
417c478bd9Sstevel@tonic-gate #define	PRIV_ALLSETS		((priv_ptype_t)0)	/* for priv_set() */
427c478bd9Sstevel@tonic-gate 
437c478bd9Sstevel@tonic-gate /*
447c478bd9Sstevel@tonic-gate  * library functions prototype.
457c478bd9Sstevel@tonic-gate  */
467c478bd9Sstevel@tonic-gate 
477c478bd9Sstevel@tonic-gate extern int setppriv(priv_op_t, priv_ptype_t, const priv_set_t *);
487c478bd9Sstevel@tonic-gate extern int getppriv(priv_ptype_t, priv_set_t *);
497c478bd9Sstevel@tonic-gate extern int setpflags(uint_t, uint_t);
507c478bd9Sstevel@tonic-gate extern uint_t getpflags(uint_t);
517c478bd9Sstevel@tonic-gate extern const priv_impl_info_t *getprivimplinfo(void);
527c478bd9Sstevel@tonic-gate 
537c478bd9Sstevel@tonic-gate extern int priv_set(priv_op_t, priv_ptype_t, ...);
547c478bd9Sstevel@tonic-gate extern boolean_t priv_ineffect(const char *);
557c478bd9Sstevel@tonic-gate extern priv_set_t *priv_str_to_set(const char *, const char *, const char **);
567c478bd9Sstevel@tonic-gate extern char *priv_set_to_str(const priv_set_t *, char, int);
577c478bd9Sstevel@tonic-gate 
587c478bd9Sstevel@tonic-gate extern int priv_getbyname(const char *);
597c478bd9Sstevel@tonic-gate extern const char *priv_getbynum(int);
607c478bd9Sstevel@tonic-gate extern int priv_getsetbyname(const char *);
617c478bd9Sstevel@tonic-gate extern const char *priv_getsetbynum(int);
627c478bd9Sstevel@tonic-gate extern char *priv_gettext(const char *);
637c478bd9Sstevel@tonic-gate 
647c478bd9Sstevel@tonic-gate extern priv_set_t *priv_allocset(void);
657c478bd9Sstevel@tonic-gate extern void priv_freeset(priv_set_t *);
667c478bd9Sstevel@tonic-gate 
677c478bd9Sstevel@tonic-gate extern void priv_emptyset(priv_set_t *);
68634e26ecSCasper H.S. Dik extern void priv_basicset(priv_set_t *);
697c478bd9Sstevel@tonic-gate extern void priv_fillset(priv_set_t *);
707c478bd9Sstevel@tonic-gate extern boolean_t priv_isemptyset(const priv_set_t *);
717c478bd9Sstevel@tonic-gate extern boolean_t priv_isfullset(const priv_set_t *);
727c478bd9Sstevel@tonic-gate extern boolean_t priv_isequalset(const priv_set_t *, const priv_set_t *);
737c478bd9Sstevel@tonic-gate extern boolean_t priv_issubset(const priv_set_t *, const priv_set_t *);
747c478bd9Sstevel@tonic-gate extern void priv_intersect(const priv_set_t *, priv_set_t *);
757c478bd9Sstevel@tonic-gate extern void priv_union(const priv_set_t *, priv_set_t *);
767c478bd9Sstevel@tonic-gate extern void priv_inverse(priv_set_t *);
777c478bd9Sstevel@tonic-gate extern int priv_addset(priv_set_t *, const char *);
787c478bd9Sstevel@tonic-gate extern void priv_copyset(const priv_set_t *, priv_set_t *);
797c478bd9Sstevel@tonic-gate extern int priv_delset(priv_set_t *, const char *);
807c478bd9Sstevel@tonic-gate extern boolean_t priv_ismember(const priv_set_t *, const char *);
817c478bd9Sstevel@tonic-gate 
827c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
837c478bd9Sstevel@tonic-gate }
847c478bd9Sstevel@tonic-gate #endif
857c478bd9Sstevel@tonic-gate 
867c478bd9Sstevel@tonic-gate #endif	/* _PRIV_H_ */
87