Add headers for OpenSolaris extensions that glibc implements
[kopensolaris-gnu/glibc.git] / sysdeps / unix / sysv / solaris2 / kopensolaris-gnu / sys / priv.h
1 /* Declarations of privilege functions and types.
2    Copyright (C) 2008 Free Software Foundation, Inc.
3    This file is part of the GNU C Library.
4
5    The GNU C Library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Lesser General Public
7    License as published by the Free Software Foundation; either
8    version 2.1 of the License, or (at your option) any later version.
9
10    The GNU C Library is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    Lesser General Public License for more details.
14
15    You should have received a copy of the GNU Lesser General Public
16    License along with the GNU C Library; if not, write to the Free
17    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18    02111-1307 USA.  */
19
20 #ifndef _SYS_PRIV_H
21 #define _SYS_PRIV_H
22
23 #include <sys/types.h>
24 #include <sys/priv_names.h>
25
26 /* privsys codes */
27 #define PRIVSYS_SETPPRIV        0
28 #define PRIVSYS_GETPPRIV        1
29 #define PRIVSYS_GETIMPLINFO     2
30 #define PRIVSYS_SETPFLAGS       3
31 #define PRIVSYS_GETPFLAGS       4
32 #define PRIVSYS_ISSETUGID       5
33 #define PRIVSYS_KLPD_REG        6
34 #define PRIVSYS_KLPD_UNREG      7
35
36 typedef enum priv_op
37 {
38         PRIV_ON,
39         PRIV_OFF,
40         PRIV_SET
41 } priv_op_t;
42
43 typedef uint32_t priv_chunk_t;
44 typedef struct priv_set priv_set_t;
45 typedef const char *priv_ptype_t;
46 typedef const char *priv_t;
47
48 typedef struct priv_impl_info
49 {
50         uint32_t priv_headersize;
51         uint32_t priv_flags;
52         uint32_t priv_nsets;
53         uint32_t priv_setsize;
54         uint32_t priv_max;
55         uint32_t priv_infosize;
56         uint32_t priv_globalinfosize;
57 } priv_impl_info_t;
58
59 #define PRIV_DEBUG              0x0001
60 #define PRIV_AWARE              0x0002
61 #define PRIV_AWARE_INHERIT      0x0004
62 #define __PROC_PROTECT          0x0008
63 #define NET_MAC_AWARE           0x0010
64 #define NET_MAC_AWARE_INHERIT   0x0020
65 #define PRIV_XPOLICY            0x0080
66 #define PRIV_USER               (PRIV_DEBUG | NET_MAC_AWARE | \
67         NET_MAC_AWARE_INHERIT |  PRIV_XPOLICY)
68
69 #define PRIV_IMPL_INFO_SIZE(p) \
70         ((p)->priv_headersize + (p)->priv_globalinfosize)
71
72 typedef struct priv_info
73 {
74         uint32_t priv_info_type;
75         uint32_t priv_info_size;
76 } priv_info_t;
77
78 typedef struct priv_info_uint
79 {
80         priv_info_t info;
81         uint_t val;
82 } priv_info_uint_t;
83
84 typedef struct priv_info_set
85 {
86         priv_info_t info;
87         priv_chunk_t set[1];
88 } priv_info_set_t;
89
90 typedef struct priv_info_names
91 {
92         priv_info_t info;
93         int cnt;
94         char names[1];
95 } priv_info_names_t;
96
97 #define PRIV_PRPRIV_INFO_OFFSET(p) \
98         (sizeof (prpriv_t) + sizeof (priv_chunk_t)) * \
99         ((p)->pr_nsets * (p)->pr_setsize - 1)
100
101 #define PRIV_PRPRIV_SIZE(p) \
102         (PRIV_PRPRIV_INFO_OFFSET(p) + (p)->pr_infosize)
103
104 #define PRIV_ALL        (-1)
105 #define PRIV_MULTIPLE   (-2)
106 #define PRIV_NONE       (-3)
107 #define PRIV_ALLZONE    (-4)
108 #define PRIV_GLOBAL     (-5)
109
110 #define PRIV_INFO_SETNAMES      1
111 #define PRIV_INFO_PRIVNAMES     2
112 #define PRIV_INFO_BASICPRIVS    3
113 #define PRIV_INFO_FLAGS         4
114
115 #endif /* _SYS_PRIV_H */