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

Contents of /trunk/src/sandbox.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 216 - (show annotations) (download) (as text)
Mon Dec 5 09:28:34 2005 UTC (8 years, 8 months ago) by azarah
File MIME type: text/x-chdr
File size: 3386 byte(s)
Rename sandbox_futils.c to sandbox_utils.c.  Add gstrndup() and gbasename()
to sandbox_utils.c.  Add check for glibc, and fixup things to not need glibc
only extensions if not needed for versioned symbols.

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 #define LD_PRELOAD_EQ "LD_PRELOAD="
17 #define LD_PRELOAD_FILE "/etc/ld.so.preload"
18 #define LIB_NAME "libsandbox.so"
19 #define BASHRC_NAME "sandbox.bashrc"
20 #define TMPDIR "/tmp"
21 #define VAR_TMPDIR "/var/tmp"
22 #define PORTAGE_TMPDIR "/var/tmp/portage"
23 #define SANDBOX_LOG_LOCATION "/var/log/sandbox"
24 #define LOG_FILE_PREFIX "/sandbox-"
25 #define DEBUG_LOG_FILE_PREFIX "/sandbox-debug-"
26 #define LOG_FILE_EXT ".log"
27
28 #define ENV_LD_PRELOAD "LD_PRELOAD"
29
30 #define ENV_EBUILD "EBUILD"
31 #define ENV_TMPDIR "TMPDIR"
32 #define ENV_PORTAGE_TMPDIR "PORTAGE_TMPDIR"
33
34 #define ENV_BASH_ENV "BASH_ENV"
35
36 #define ENV_SANDBOX_VERBOSE "SANDBOX_VERBOSE"
37 #define ENV_SANDBOX_DEBUG "SANDBOX_DEBUG"
38
39 #define ENV_SANDBOX_LIB "SANDBOX_LIB"
40 #define ENV_SANDBOX_BASHRC "SANDBOX_BASHRC"
41 #define ENV_SANDBOX_LOG "SANDBOX_LOG"
42 #define ENV_SANDBOX_DEBUG_LOG "SANDBOX_DEBUG_LOG"
43
44 #define ENV_SANDBOX_DENY "SANDBOX_DENY"
45 #define ENV_SANDBOX_READ "SANDBOX_READ"
46 #define ENV_SANDBOX_WRITE "SANDBOX_WRITE"
47 #define ENV_SANDBOX_PREDICT "SANDBOX_PREDICT"
48
49 #define ENV_SANDBOX_ON "SANDBOX_ON"
50 #define ENV_SANDBOX_BEEP "SANDBOX_BEEP"
51
52 #define ENV_SANDBOX_ACTIVE "SANDBOX_ACTIVE"
53 #define SANDBOX_ACTIVE "armedandready"
54
55 #define DEFAULT_BEEP_COUNT 3
56
57 #define SB_BUF_LEN 2048
58
59 /* Gentoo style e* printing macro's */
60 #define EINFO(_color, _hilight, _args...) \
61 do { \
62 int old_errno = errno; \
63 if (_color) \
64 fprintf(stderr, "\033[32;01m" _hilight "\033[0m" _args); \
65 else \
66 fprintf(stderr, _hilight _args); \
67 errno = old_errno; \
68 } while (0)
69
70 #define EWARN(_color, _hilight, _args...) \
71 do { \
72 int old_errno = errno; \
73 if (_color) \
74 fprintf(stderr, "\033[33;01m" _hilight "\033[0m" _args); \
75 else \
76 fprintf(stderr, _hilight _args); \
77 errno = old_errno; \
78 } while (0)
79
80 #define EERROR(_color, _hilight, _args...) \
81 do { \
82 int old_errno = errno; \
83 if (_color) \
84 fprintf(stderr, "\033[31;01m" _hilight "\033[0m" _args); \
85 else \
86 fprintf(stderr, _hilight _args); \
87 errno = old_errno; \
88 } while (0)
89
90 void get_sandbox_lib(char *path);
91 #ifdef OUTSIDE_LIBSANDBOX
92 void get_sandbox_rc(char *path);
93 void get_sandbox_log(char *path);
94 void get_sandbox_debug_log(char *path);
95 int get_tmp_dir(char *path);
96 #endif /* OUTSIDE_LIBSANDBOX */
97 int exists(const char *pathname);
98 #ifdef OUTSIDE_LIBSANDBOX
99 int is_file(const char *pathname);
100 int is_dir(const char *pathname, int follow_link);
101 long file_length(int fd);
102 #endif /* OUTSIDE_LIBSANDBOX */
103
104 /* Compat functions for GNU extensions */
105 char *gstrndup (const char *str, size_t size);
106 /* Same as basename(3), but do not modify path */
107 char *gbasename (const char *path);
108
109 /* glibc modified realpath() function */
110 char *erealpath(const char *, char *);
111 char *egetcwd(char *, size_t);
112
113 #endif /* __SANDBOX_H__ */
114
115 // 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