/[path-sandbox]/trunk/libsbutil/sbutil.h
Gentoo

Contents of /trunk/libsbutil/sbutil.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 314 - (show annotations) (download) (as text)
Sun Jul 9 20:33:52 2006 UTC (8 years, 5 months ago) by azarah
File MIME type: text/x-chdr
File size: 3974 byte(s)
Remove file_length(), and rather use rc_get_size().

1 /*
2 * sbutil.h
3 *
4 * Util defines.
5 *
6 * Copyright 1999-2006 Gentoo Foundation
7 *
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation version 2 of the License.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 675 Mass Ave, Cambridge, MA 02139, USA.
21 *
22 * Some parts might have Copyright:
23 *
24 * Copyright (C) 2002 Brad House <brad@mainstreetsoftworks.com>
25 *
26 * $Header$
27 */
28
29 #ifndef __SBUTIL_H__
30 #define __SBUTIL_H__
31
32 #include "config.h"
33 #include "localdecls.h"
34 #include "include/rcscripts/rcutil.h"
35
36 #define SANDBOX_CONF_FILE ETCDIR "/sandbox.conf"
37 #define SANDBOX_CONFD_DIR ETCDIR "/sandbox.d"
38
39 #define LD_PRELOAD_EQ "LD_PRELOAD="
40 #define LD_PRELOAD_FILE "/etc/ld.so.preload"
41 #define LIB_NAME "libsandbox.so"
42 #define BASHRC_NAME "sandbox.bashrc"
43 #define TMPDIR "/tmp"
44 #define VAR_TMPDIR "/var/tmp"
45 #define PORTAGE_TMPDIR "/var/tmp/portage"
46 #define SANDBOX_LOG_LOCATION "/var/log/sandbox"
47 #define LOG_FILE_PREFIX "/sandbox-"
48 #define DEBUG_LOG_FILE_PREFIX "/sandbox-debug-"
49 #define LOG_FILE_EXT ".log"
50
51 #define ENV_LD_PRELOAD "LD_PRELOAD"
52
53 #define ENV_EBUILD "EBUILD"
54 #define ENV_TMPDIR "TMPDIR"
55 #define ENV_PORTAGE_TMPDIR "PORTAGE_TMPDIR"
56
57 #define ENV_BASH_ENV "BASH_ENV"
58
59 #define ENV_NOCOLOR "NOCOLOR"
60
61 #define ENV_SANDBOX_VERBOSE "SANDBOX_VERBOSE"
62 #define ENV_SANDBOX_DEBUG "SANDBOX_DEBUG"
63
64 #define ENV_SANDBOX_LIB "SANDBOX_LIB"
65 #define ENV_SANDBOX_BASHRC "SANDBOX_BASHRC"
66 #define ENV_SANDBOX_LOG "SANDBOX_LOG"
67 #define ENV_SANDBOX_DEBUG_LOG "SANDBOX_DEBUG_LOG"
68 #define ENV_SANDBOX_WORKDIR "SANDBOX_WORKDIR"
69
70 #define ENV_SANDBOX_DENY "SANDBOX_DENY"
71 #define ENV_SANDBOX_READ "SANDBOX_READ"
72 #define ENV_SANDBOX_WRITE "SANDBOX_WRITE"
73 #define ENV_SANDBOX_PREDICT "SANDBOX_PREDICT"
74
75 #define ENV_SANDBOX_ON "SANDBOX_ON"
76 #define ENV_SANDBOX_BEEP "SANDBOX_BEEP"
77
78 #define ENV_SANDBOX_PID "SANDBOX_PID"
79 #define ENV_SANDBOX_ABORT "SANDBOX_ABORT"
80 #define ENV_SANDBOX_INTRACTV "SANDBOX_INTRACTV"
81
82 #define ENV_SANDBOX_ACTIVE "SANDBOX_ACTIVE"
83 #define SANDBOX_ACTIVE "armedandready"
84
85 #define DEFAULT_BEEP_COUNT 3
86
87 #define SB_BUF_LEN 2048
88
89 /* Gentoo style e* printing macro's */
90 #define SB_EINFO(_color, _hilight, _args...) \
91 do { \
92 int old_errno = errno; \
93 if (_color) \
94 fprintf(stderr, "\033[32;01m" _hilight "\033[0m" _args); \
95 else \
96 fprintf(stderr, _hilight _args); \
97 errno = old_errno; \
98 } while (0)
99
100 #define SB_EWARN(_color, _hilight, _args...) \
101 do { \
102 int old_errno = errno; \
103 if (_color) \
104 fprintf(stderr, "\033[33;01m" _hilight "\033[0m" _args); \
105 else \
106 fprintf(stderr, _hilight _args); \
107 errno = old_errno; \
108 } while (0)
109
110 #define SB_EERROR(_color, _hilight, _args...) \
111 do { \
112 int old_errno = errno; \
113 if (_color) \
114 fprintf(stderr, "\033[31;01m" _hilight "\033[0m" _args); \
115 else \
116 fprintf(stderr, _hilight _args); \
117 errno = old_errno; \
118 } while (0)
119
120 void get_sandbox_lib(char *path);
121 void get_sandbox_rc(char *path);
122 void get_sandbox_log(char *path);
123 void get_sandbox_debug_log(char *path);
124 int get_tmp_dir(char *path);
125 bool is_env_on (const char *);
126 bool is_env_off (const char *);
127
128 /* glibc modified realpath() function */
129 char *erealpath(const char *, char *);
130 char *egetcwd(char *, size_t);
131
132 #endif /* __SBUTIL_H__ */

  ViewVC Help
Powered by ViewVC 1.1.20