xref: /illumos-gate/usr/src/cmd/allocate/allocate.h (revision 40e2b7c9adf98f629a8a3463b605d4322963ef30)
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 2006 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_ALLOCATE_H
28 #define	_ALLOCATE_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 /* Option Flags */
37 #define	SILENT		0001	/* -s */
38 #define	USERID		0002	/* -U <uid> for list_devices(1) */
39 #define	LIST		0004	/* -l */
40 #define	FREE		0010	/* -n */
41 #define	CURRENT 	0020	/* -u */
42 #define	FORCE		0040	/* -F */
43 #define	FORCE_ALL 	0100	/* -I */
44 #define	TYPE		0200	/* -g */
45 #define	USERNAME	0400	/* -U <username> for allocate(1) */
46 
47 /* Misc. */
48 
49 #define	ALL	-1
50 
51 /* Error returns start at 4 */
52 #define	SYSERROR	4
53 #define	DACLCK		5
54 #define	DACACC		6
55 #define	DEVLST		7
56 #define	NALLOCU		8
57 #define	NOTAUTH		9
58 #define	CNTFRC		10
59 #define	CNTDEXEC	11
60 #define	NO_DEVICE	12
61 #define	DSPMISS		13
62 #define	ALLOCERR	14
63 #define	IMPORT_ERR	15
64 #define	NODAENT		16
65 #define	NODMAPENT	17
66 #define	SETACL_PERR	18
67 #define	CHOWN_PERR	19
68 #define	ALLOC		20
69 #define	ALLOC_OTHER	21
70 #define	NALLOC		22
71 #define	AUTHERR		23
72 #define	CLEAN_ERR	24
73 #define	DEVNAME_ERR	25
74 #define	DEVNAME_TOOLONG	26
75 
76 /* Tunable Parameters */
77 #define	DEV_DIR		"/dev"
78 #define	DAC_DIR		"/etc/security/dev"
79 #define	SECLIB		"/etc/security/lib"
80 #define	ALLOC_MODE	0600
81 #define	DEALLOC_MODE    0000
82 #define	ALLOC_ERR_MODE  0100
83 #define	ALLOC_UID	(uid_t)0	/* root */
84 #define	ALLOC_GID	(gid_t)1	/* other */
85 
86 /* Functions */
87 extern int allocate(int optflg, uid_t uid, char *device);
88 extern int deallocate(int optflg, uid_t uid, char *device);
89 extern int list_devices(int optflg, uid_t uid, char *device);
90 
91 #ifdef	__cplusplus
92 }
93 #endif
94 
95 #endif	/* _ALLOCATE_H */
96