Skip to content
This repository was archived by the owner on Nov 17, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
8b84b17
Increase default num boxes
wil93 Jan 18, 2016
c231b13
Merge pull request #10 from algorithm-ninja/increase_num_boxes
gollux Jan 18, 2016
a3a2c4d
var_len of default environment rules was not initialized
gollux Jan 22, 2016
ab6ec57
Implemented "--silent" mode
gollux Jan 23, 2016
c228c56
Clean up signal handling
gollux Jan 23, 2016
6d7aa39
Call watchdog timer every 100 ms
gollux Jan 24, 2016
8af30e7
Changed default box location to /var/local/lib/isolate/
gollux Jan 24, 2016
4693333
Makefile: Do not use "asciidoc -D" when building man pages
gollux Jan 24, 2016
ce9dad0
Fixed race condition in make_dir()
gollux Jan 24, 2016
6b46017
Add a LICENSE file.
gollux Jan 24, 2016
c8b0eef
Source split to several files
gollux Jan 24, 2016
4d364d5
Compile-time configuration moved to a run-time config file
gollux Jan 24, 2016
cb04630
Update the manual page to reflect recent changes
gollux Jan 24, 2016
450096d
Released as version 1.2
gollux Jan 24, 2016
8fc6594
Man page: Do not refer to a non-existent section
gollux Aug 16, 2016
e7f421b
Makefile: Enable prototype warnings
gollux Aug 16, 2016
9fa5760
cgroups: Fix inheritance of cpusets
gollux Aug 16, 2016
a01a65e
Added per-box configuration of CPU and NUMA node sets
gollux Aug 16, 2016
a2590eb
Added a possibility to choose a parent cgroup
gollux Aug 16, 2016
3bf44c4
Released as version 1.3
gollux Oct 10, 2016
e3c1368
Added f to short_opts
hermanzdosilovic Oct 22, 2016
0ede685
Merge pull request #18 from hermanzdosilovic/file-size
gollux Oct 24, 2016
7f55e36
Cosmetic: Options should be sorted
gollux Oct 24, 2016
424e3a6
Makefile: remove exec permission for config and manpage files
seirl Mar 3, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Implemented "--silent" mode
Also documented behavior wrt. std{in,out,err}.
  • Loading branch information
gollux committed Jan 23, 2016
commit ab6ec57fa14214f7b3b38605b19a9821a9293fb2
15 changes: 12 additions & 3 deletions isolate.1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,19 @@ OPTIONS

*-i, --stdin=*'file'::
Redirect standard input from 'file'. The 'file' has to be accessible
inside the sandbox.
inside the sandbox. Otherwise, standard input is inherited from the
parent process.

*-o, --stdout=*'file'::
Redirect standard output to 'file'. The 'file' has to be accessible
inside the sandbox.
inside the sandbox. Otherwise, standard output is inherited from the
parent process and the sandbox manager does not write anything to it.

*-r, --stderr=*'file'::
Redirect standard error output to 'file'. The 'file' has to be accessible
inside the sandbox.
inside the sandbox. Otherwise, standard error output is inherited from
the parent process and both the sandboxed process and the sandbox manager
can write their status messages to it.

*-c, --chdir=*'dir'::
Change directory to 'dir' before executing the program. This path must be
Expand All @@ -119,6 +123,11 @@ OPTIONS
Tell the sandbox manager to be verbose and report on what is going on.
Using *-v* multiple times produces even more jabber.

*-s, --silent*::
Tell the sandbox manager to keep silence. No status messages are printed
to stderr except for fatal errors of the sandbox itself. The combination of
*--verbose* and *--silent* has an undefined effect.

ENVIRONMENT RULES
-----------------
UNIX processes normally inherit all environment variables from their parent. The
Expand Down
24 changes: 18 additions & 6 deletions isolate.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ static int wall_timeout;
static int extra_timeout;
static int pass_environ;
static int verbose;
static int silent;
static int fsize_limit;
static int memory_limit;
static int stack_limit;
Expand Down Expand Up @@ -227,8 +228,11 @@ err(char *msg, ...)
char buf[1024];
vsnprintf(buf, sizeof(buf), msg, args);
meta_printf("message:%s\n", buf);
fputs(buf, stderr);
fputc('\n', stderr);
if (!silent)
{
fputs(buf, stderr);
fputc('\n', stderr);
}
box_exit(1);
}

Expand Down Expand Up @@ -1166,9 +1170,12 @@ box_keeper(void)
if (wall_timeout && wall_ms > wall_timeout)
err("TO: Time limit exceeded (wall clock)");
flush_line();
fprintf(stderr, "OK (%d.%03d sec real, %d.%03d sec wall)\n",
total_ms/1000, total_ms%1000,
wall_ms/1000, wall_ms%1000);
if (!silent)
{
fprintf(stderr, "OK (%d.%03d sec real, %d.%03d sec wall)\n",
total_ms/1000, total_ms%1000,
wall_ms/1000, wall_ms%1000);
}
box_exit(0);
}
else if (WIFSIGNALED(stat))
Expand Down Expand Up @@ -1430,6 +1437,7 @@ Options:\n\
-M, --meta=<file>\tOutput process information to <file> (name:value)\n\
-q, --quota=<blk>,<ino>\tSet disk quota to <blk> blocks and <ino> inodes\n\
--share-net\t\tShare network namespace with the parent process\n\
-s, --silent\t\tDo not print status messages except for fatal errors\n\
-k, --stack=<size>\tLimit stack size to <size> KB (default: 0=unlimited)\n\
-r, --stderr=<file>\tRedirect stderr to <file>\n\
-i, --stdin=<file>\tRedirect stdin from <file>\n\
Expand Down Expand Up @@ -1459,7 +1467,7 @@ enum opt_code {
OPT_SHARE_NET,
};

static const char short_opts[] = "b:c:d:eE:i:k:m:M:o:p::q:r:t:vw:x:";
static const char short_opts[] = "b:c:d:eE:i:k:m:M:o:p::q:r:st:vw:x:";

static const struct option long_opts[] = {
{ "box-id", 1, NULL, 'b' },
Expand All @@ -1480,6 +1488,7 @@ static const struct option long_opts[] = {
{ "quota", 1, NULL, 'q' },
{ "run", 0, NULL, OPT_RUN },
{ "share-net", 0, NULL, OPT_SHARE_NET },
{ "silent", 0, NULL, 's' },
{ "stack", 1, NULL, 'k' },
{ "stderr", 1, NULL, 'r' },
{ "stdin", 1, NULL, 'i' },
Expand Down Expand Up @@ -1557,6 +1566,9 @@ main(int argc, char **argv)
case 'r':
redir_stderr = optarg;
break;
case 's':
silent++;
break;
case 't':
timeout = 1000*atof(optarg);
break;
Expand Down