xref: /titanic_52/usr/src/head/ucred.h (revision 7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fe)
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 #ifndef	_UCRED_H_
28 #define	_UCRED_H_
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <sys/types.h>
33 #include <sys/priv.h>
34 
35 #ifdef	__cplusplus
36 extern "C" {
37 #endif
38 
39 typedef struct ucred_s ucred_t;
40 
41 /*
42  * library functions prototype.
43  */
44 #if	defined(__STDC__)
45 
46 extern ucred_t *ucred_get(pid_t pid);
47 
48 extern void ucred_free(ucred_t *);
49 
50 extern uid_t ucred_geteuid(const ucred_t *);
51 extern uid_t ucred_getruid(const ucred_t *);
52 extern uid_t ucred_getsuid(const ucred_t *);
53 extern gid_t ucred_getegid(const ucred_t *);
54 extern gid_t ucred_getrgid(const ucred_t *);
55 extern gid_t ucred_getsgid(const ucred_t *);
56 extern int   ucred_getgroups(const ucred_t *, const gid_t **);
57 
58 extern const priv_set_t *ucred_getprivset(const ucred_t *, priv_ptype_t);
59 extern uint_t ucred_getpflags(const ucred_t *, uint_t);
60 
61 extern pid_t ucred_getpid(const ucred_t *); /* for door_cred compatibility */
62 
63 extern size_t ucred_size(void);
64 
65 extern int getpeerucred(int, ucred_t **);
66 
67 extern zoneid_t ucred_getzoneid(const ucred_t *);
68 
69 extern projid_t ucred_getprojid(const ucred_t *);
70 
71 #else	/* Non ANSI */
72 
73 extern ucred_t *ucred_get(/* pid_t pid */);
74 
75 extern void ucred_free(/* ucred_t * */);
76 
77 extern uid_t ucred_geteuid(/* ucred_t * */);
78 extern uid_t ucred_getruid(/* ucred_t * */);
79 extern uid_t ucred_getsuid(/* ucred_t * */);
80 extern gid_t ucred_getegid(/* ucred_t * */);
81 extern gid_t ucred_getrgid(/* ucred_t * */);
82 extern gid_t ucred_getsgid(/* ucred_t * */);
83 extern int   ucred_getgroups(/* ucred_t *, gid_t ** */);
84 
85 extern priv_set_t *ucred_getprivset(/* ucred_t *, priv_ptype_t */);
86 extern uint_t ucred_getpflags(/* ucred_t *, uint_t */);
87 
88 extern pid_t ucred_getpid(/* ucred_t * */);
89 
90 extern size_t ucred_size(/* void */);
91 
92 extern int getpeerucred(/* int, ucred_t ** */);
93 
94 extern zoneid_t ucred_getzoneid(/* ucred_t * */);
95 
96 extern projid_t ucred_getprojid(/* ucred_t * */);
97 
98 #endif	/* __STDC__ */
99 
100 #ifdef	__cplusplus
101 }
102 #endif
103 
104 #endif	/* _UCRED_H_ */
105