/[path-sandbox]/trunk/src/sandbox.h
Gentoo

Contents of /trunk/src/sandbox.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 189 - (show annotations) (download) (as text)
Thu Dec 1 09:46:17 2005 UTC (8 years, 7 months ago) by azarah
File MIME type: text/x-chdr
File size: 3208 byte(s)
Remove the SB_STATIC and including of getcwd.c, etc voodoo, as we new use a
symbol map, and all non-exported symbols are local.  Cleanup getcwd.c, as
the generic getcwd for older 2.4 kernels do not work properly anyhow, and
just makes things slower.  Some other warning fixes.

1 /*
2 * Copyright (C) 2002 Brad House <brad@mainstreetsoftworks.com>,
3 * Possibly based on code from Geert Bevin, Uwyn, http://www.uwyn.com
4 * Distributed under the terms of the GNU General Public License, v2 or later
5 * Author: Brad House <brad@mainstreetsoftworks.com>
6 *
7 * $Header$
8 */
9
10 #ifndef __SANDBOX_H__
11 #define __SANDBOX_H__
12
13 #include "localdecls.h"
14 #include "config.h"
15
16 /* Uncomment below to use flock instead of fcntl (POSIX way) to lock/unlock files */
17 /* #define USE_FLOCK */
18
19 #define LD_PRELOAD_EQ "LD_PRELOAD="
20 #define LD_PRELOAD_FILE "/etc/ld.so.preload"
21 #define LIB_NAME "libsandbox.so"
22 #define BASHRC_NAME "sandbox.bashrc"
23 #define TMPDIR "/tmp"
24 #define VAR_TMPDIR "/var/tmp"
25 #define PORTAGE_TMPDIR "/var/tmp/portage"
26 #define SANDBOX_LOG_LOCATION "/var/log/sandbox"
27 #define LOG_FILE_PREFIX "/sandbox-"
28 #define DEBUG_LOG_FILE_PREFIX "/sandbox-debug-"
29 #define LOG_FILE_EXT ".log"
30
31 #define ENV_LD_PRELOAD "LD_PRELOAD"
32
33 #define ENV_EBUILD "EBUILD"
34 #define ENV_TMPDIR "TMPDIR"
35 #define ENV_PORTAGE_TMPDIR "PORTAGE_TMPDIR"
36
37 #define ENV_BASH_ENV "BASH_ENV"
38
39 #define ENV_SANDBOX_VERBOSE "SANDBOX_VERBOSE"
40 #define ENV_SANDBOX_DEBUG "SANDBOX_DEBUG"
41
42 #define ENV_SANDBOX_LIB "SANDBOX_LIB"
43 #define ENV_SANDBOX_BASHRC "SANDBOX_BASHRC"
44 #define ENV_SANDBOX_LOG "SANDBOX_LOG"
45 #define ENV_SANDBOX_DEBUG_LOG "SANDBOX_DEBUG_LOG"
46
47 #define ENV_SANDBOX_DENY "SANDBOX_DENY"
48 #define ENV_SANDBOX_READ "SANDBOX_READ"
49 #define ENV_SANDBOX_WRITE "SANDBOX_WRITE"
50 #define ENV_SANDBOX_PREDICT "SANDBOX_PREDICT"
51
52 #define ENV_SANDBOX_ON "SANDBOX_ON"
53 #define ENV_SANDBOX_BEEP "SANDBOX_BEEP"
54
55 #define ENV_SANDBOX_ACTIVE "SANDBOX_ACTIVE"
56 #define SANDBOX_ACTIVE "armedandready"
57
58 #define DEFAULT_BEEP_COUNT 3
59
60 #define SB_BUF_LEN 2048
61
62 /* Gentoo style e* printing macro's */
63 #define EINFO(_color, _hilight, _args...) \
64 do { \
65 int old_errno = errno; \
66 if (_color) \
67 fprintf(stderr, "\033[32;01m" _hilight "\033[0m" _args); \
68 else \
69 fprintf(stderr, _hilight _args); \
70 errno = old_errno; \
71 } while (0)
72
73 #define EWARN(_color, _hilight, _args...) \
74 do { \
75 int old_errno = errno; \
76 if (_color) \
77 fprintf(stderr, "\033[33;01m" _hilight "\033[0m" _args); \
78 else \
79 fprintf(stderr, _hilight _args); \
80 errno = old_errno; \
81 } while (0)
82
83 #define EERROR(_color, _hilight, _args...) \
84 do { \
85 int old_errno = errno; \
86 if (_color) \
87 fprintf(stderr, "\033[31;01m" _hilight "\033[0m" _args); \
88 else \
89 fprintf(stderr, _hilight _args); \
90 errno = old_errno; \
91 } while (0)
92
93 void get_sandbox_lib(char *path);
94 #ifdef OUTSIDE_LIBSANDBOX
95 void get_sandbox_rc(char *path);
96 void get_sandbox_log(char *path);
97 void get_sandbox_debug_log(char *path);
98 int get_tmp_dir(char *path);
99 #endif /* OUTSIDE_LIBSANDBOX */
100 int exists(const char *pathname);
101 #ifdef OUTSIDE_LIBSANDBOX
102 int is_file(const char *pathname);
103 int is_dir(const char *pathname, int follow_link);
104 long file_length(int fd);
105 #endif /* OUTSIDE_LIBSANDBOX */
106
107 #endif /* __SANDBOX_H__ */
108
109 // vim:noexpandtab noai:cindent ai

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.20