Bump version and update Changes
[gruntmaster-daemon.git] / gruntmaster-exec
1 #!/usr/bin/perl -w
2 use v5.14;
3 use strict;
4
5 use BSD::Resource qw/setrlimit RLIMIT_AS RLIMIT_FSIZE/;
6 use sigtrap qw/XFSZ/;
7
8 ##################################################
9
10 my ($mlimit, $olimit, @args) = @ARGV;
11
12 setrlimit RLIMIT_AS, $mlimit, $mlimit or die $! if $mlimit;
13 setrlimit RLIMIT_FSIZE, $olimit, $olimit or die $! if $olimit;
14
15 %ENV = (ONLINE_JUDGE => 1, PATH => $ENV{PATH}, HOME => $ENV{PATH});
16 exec @args;
17
18 __END__
19
20 =encoding utf-8
21
22 =head1 NAME
23
24 gruntmaster-exec - Gruntmaster 6000 executor
25
26 =head1 SYNOPSIS
27
28 gruntmaster-exec 20000000 111 echo 'Hello, world!'
29
30 =head1 DESCRIPTION
31
32 gruntmaster-exec is the script used by gruntmasterd to run programs.
33
34 The first argument is the address space limit (in bytes), the second argument is the output limit (also in bytes). The rest of the arguments are the command that should be run and its arguments.
35
36 gruntmaster-exec sets the resource limits, cleans the environment (except for PATH and HOME), adds the ONLINE_JUDGE environment variable with value 1, and finally C<exec>s the given command.
37
38 =head1 AUTHOR
39
40 Marius Gavrilescu E<lt>marius@ieval.roE<gt>
41
42 =head1 COPYRIGHT AND LICENSE
43
44 Copyright (C) 2014 by Marius Gavrilescu
45
46 This program is free software: you can redistribute it and/or modify
47 it under the terms of the GNU Affero General Public License as published by
48 the Free Software Foundation, either version 3 of the License, or
49 (at your option) any later version.
This page took 0.023127 seconds and 4 git commands to generate.