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

Contents of /trunk/sandbox.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 157 - (show annotations) (download) (as text)
Fri Aug 5 13:55:08 2005 UTC (9 years, 4 months ago) by azarah
File MIME type: text/x-chdr
File size: 3114 byte(s)
If we are called from the command line, do not care about PORTAGE_TMPDIR,
and make the current directory the work directory.  Also rename the variable
portage_tmp_dir to work_dir.

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_SANDBOX_LIB "SANDBOX_LIB"
38 #define ENV_SANDBOX_BASHRC "SANDBOX_BASHRC"
39 #define ENV_SANDBOX_LOG "SANDBOX_LOG"
40 #define ENV_SANDBOX_DEBUG_LOG "SANDBOX_DEBUG_LOG"
41
42 #define ENV_SANDBOX_DENY "SANDBOX_DENY"
43 #define ENV_SANDBOX_READ "SANDBOX_READ"
44 #define ENV_SANDBOX_WRITE "SANDBOX_WRITE"
45 #define ENV_SANDBOX_PREDICT "SANDBOX_PREDICT"
46
47 #define ENV_SANDBOX_ON "SANDBOX_ON"
48 #define ENV_SANDBOX_BEEP "SANDBOX_BEEP"
49
50 #define DEFAULT_BEEP_COUNT 3
51
52 #define SB_BUF_LEN 2048
53
54 #if !HAVE_DLVSYM
55 # define dlvsym(lib, sym, ver) dlsym(lib, sym)
56 #endif
57
58 /* Gentoo style e* printing macro's */
59 #define EINFO(_color, _hilight, _args...) \
60 do { \
61 int old_errno = errno; \
62 if (_color) \
63 fprintf(stderr, "\033[32;01m" _hilight "\033[0m" _args); \
64 else \
65 fprintf(stderr, _hilight _args); \
66 errno = old_errno; \
67 } while (0)
68
69 #define EWARN(_color, _hilight, _args...) \
70 do { \
71 int old_errno = errno; \
72 if (_color) \
73 fprintf(stderr, "\033[33;01m" _hilight "\033[0m" _args); \
74 else \
75 fprintf(stderr, _hilight _args); \
76 errno = old_errno; \
77 } while (0)
78
79 #define EERROR(_color, _hilight, _args...) \
80 do { \
81 int old_errno = errno; \
82 if (_color) \
83 fprintf(stderr, "\033[31;01m" _hilight "\033[0m" _args); \
84 else \
85 fprintf(stderr, _hilight _args); \
86 errno = old_errno; \
87 } while (0)
88
89 SB_STATIC void get_sandbox_lib(char *path);
90 #ifdef OUTSIDE_LIBSANDBOX
91 SB_STATIC void get_sandbox_rc(char *path);
92 SB_STATIC void get_sandbox_log(char *path);
93 SB_STATIC void get_sandbox_debug_log(char *path);
94 SB_STATIC int get_tmp_dir(char *path);
95 #endif /* OUTSIDE_LIBSANDBOX */
96 SB_STATIC int exists(const char *pathname);
97 #ifdef OUTSIDE_LIBSANDBOX
98 SB_STATIC int is_file(const char *pathname);
99 SB_STATIC int is_dir(const char *pathname, int follow_link);
100 SB_STATIC long file_length(int fd);
101 #endif /* OUTSIDE_LIBSANDBOX */
102
103 #endif
104
105 // 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