Allow java jobs to have multiple classes
[gruntmaster-daemon.git] / gruntmaster-exec
index 9590b4e34173feaa8198bfa13e84e424d810bea6..0a2c50c204c12477cd93d574353fe3a7bdeb80bd 100755 (executable)
@@ -18,9 +18,6 @@ use constant +{
        DIED => 5,
        REJ => 10,
 };
-# These constants are changed by ex/makevm
-use constant USER => 65534;
-use constant GROUP => 65534;
 
 use BSD::Resource qw/setrlimit RLIMIT_AS RLIMIT_FSIZE RLIMIT_NPROC/;
 use IPC::Signal qw/sig_name sig_num/;
@@ -31,7 +28,7 @@ use POSIX qw//;
 use Text::ParseWords qw/shellwords/;
 use Time::HiRes qw/alarm/;
 
-my (@fds, $timeout, $mlimit, $olimit, $nobody);
+my (@fds, $timeout, $mlimit, $olimit, $sudo);
 my $close = 1;
 
 GetOptions(
@@ -40,12 +37,12 @@ GetOptions(
        "mlimit=i"  => \$mlimit,
        "olimit=i"  => \$olimit,
        "close!"    => \$close,
-       "nobody!"   => \$nobody,
+       "sudo!"   => \$sudo,
 );
 
 my $killuser = $ENV{GRUNTMASTER_KILL_USER};
 my @sudo;
-@sudo = (shellwords ($ENV{GRUNTMASTER_SUDO}), '--') if $ENV{GRUNTMASTER_SUDO} && $nobody;
+@sudo = (shellwords ($ENV{GRUNTMASTER_SUDO}), '--') if $ENV{GRUNTMASTER_SUDO} && $sudo;
 undef $mlimit if @sudo; # sudo wants a lot of address space
 
 my $ret = fork // die 'Cannot fork';
@@ -59,7 +56,7 @@ if ($ret) {
                }
                $tle = 1
        };
-       alarm ($timeout || 5);
+       alarm ($timeout || 10);
        waitpid $ret, 0;
        alarm 0;
        if (@sudo) {
@@ -92,9 +89,7 @@ if ($ret) {
        %ENV = (ONLINE_JUDGE => 1, PATH => $ENV{PATH}, HOME => $ENV{HOME});
        setrlimit RLIMIT_AS, $mlimit, $mlimit or die $! if $mlimit;
        setrlimit RLIMIT_FSIZE, $olimit, $olimit or die $! if $olimit;
-       setrlimit RLIMIT_NPROC, $nproc, $nproc or die $! if $nobody;
-       POSIX::setgid $nobody ? 65534 : USER;
-       POSIX::setuid $nobody ? 65534 : GROUP;
+       setrlimit RLIMIT_NPROC, $nproc, $nproc or die $! if $sudo;
        unshift @ARGV, @sudo;
        say STDERR "Executing: ", join ' ', map { "'$_'" } @ARGV if $debug;
        exec @ARGV;
This page took 0.01039 seconds and 4 git commands to generate.