[X2Go-Commits] x2goserver.git - build-baikal (branch) updated: 3.1.1.3-322-ga550eb7
X2Go dev team
git-admin at x2go.org
Fri Jan 3 20:53:39 CET 2014
The branch, build-baikal has been updated
via a550eb7a5dc58acee577343c6d6031d394b79f3b (commit)
from 6b219e9ca6f76e55df80ba369807c9be831902de (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
-----------------------------------------------------------------------
Summary of changes:
X2Go/SupeReNicer.pm | 103 ++++++++++++++++++++++++++++-----------------------
debian/changelog | 1 +
2 files changed, 57 insertions(+), 47 deletions(-)
The diff of changes is:
diff --git a/X2Go/SupeReNicer.pm b/X2Go/SupeReNicer.pm
index 0df187b..0f8a3cb 100644
--- a/X2Go/SupeReNicer.pm
+++ b/X2Go/SupeReNicer.pm
@@ -43,12 +43,17 @@ our @EXPORT=('superenice');
sub checkPID {
my $pid = sanitizer("num",$_[0]);
- open(PS,"/bin/ps --no-headers -o %u,%p,%n,%c -p $pid|");
- my ($pidInf,undef) = <PS>;
- close(PS);
- my ($user,$pid,$nice,$cmd) = split(/\,/,clups($pidInf));
- $pid =~ s/\D//g;
- return ($pid,$user,$nice,$cmd)
+ if ( $pid )
+ {
+ open(PS,"/bin/ps --no-headers -o %u,%p,%n,%c -p $pid|");
+ my ($pidInf,undef) = <PS>;
+ close(PS);
+ my ($user,$pid,$nice,$cmd) = split(/\,/,clups($pidInf));
+ $pid =~ s/\D//g;
+ return ($pid,$user,$nice,$cmd);
+ } else {
+ return (-1, "failure", 0, "failed to sanitize PID");
+ }
}
@@ -118,42 +123,44 @@ sub superenice {
# Using the NICE value of the agent to figgure out the current nice state...
my ($psP,$psU,$psN,$psC) = checkPID($agentPid);
- if ($x2goState eq "R") {
+ if ($psP > -1) {
+ if ($x2goState eq "R") {
- # State is R (Running?)...
- if ($psN ne $normalNL) {
- # If nice level is not normal, renice to normal...
- syslog('notice', "ReNicing \"$userID\" to level $normalNL for session \"$x2gosid\"");
- # For the sake of getting a user back to normal ASAP... We'll renice the entire user not just individual sessions...
- system("renice", "-n", "$normalNL", "-u", "$userID");
- }
+ # State is R (Running?)...
+ if ($psN ne $normalNL) {
+ # If nice level is not normal, renice to normal...
+ syslog('notice', "ReNicing \"$userID\" to level $normalNL for session \"$x2gosid\"");
+ # For the sake of getting a user back to normal ASAP... We'll renice the entire user not just individual sessions...
+ system("renice", "-n", "$normalNL", "-u", "$userID");
+ }
- } elsif ($x2goState eq "S") {
+ } elsif ($x2goState eq "S") {
- # State is S (suspended)
- if ($psN ne $idleNL) {
+ # State is S (suspended)
+ if ($psN ne $idleNL) {
- # Did we renice this?
- open(AUPS,"/bin/ps --no-headers -o %u,%p,%n,%c -u $userID|"); # use PS to fetch a list of the users current processes
- while (<AUPS>) {
- my ($user,$pid,$nice,$cmd) = split(/\,/,clups($_));
- $pid = sanitizer("num",$pid);
-
- if (-f "/proc/$pid/environ") {
- open(ENVIRON,"/proc/$pid/environ");my ($Environ,undef) = <ENVIRON>;close(ENVIRON);
- if ($Environ =~ m/X2GO_SESSION=$x2gosid/) { # If the x2go Session ID is in environ... renice the pid...
- #syslog('debug', "$pid: X2GO_SESSION=$x2gosid");
- system("renice", "-n", "$idleNL", "-p", "$pid");
+ # Did we renice this?
+ open(AUPS,"/bin/ps --no-headers -o %u,%p,%n,%c -u $userID|"); # use PS to fetch a list of the users current processes
+ while (<AUPS>) {
+ my ($user,$pid,$nice,$cmd) = split(/\,/,clups($_));
+ $pid = sanitizer("num",$pid);
+
+ if (-f "/proc/$pid/environ") {
+ open(ENVIRON,"/proc/$pid/environ");my ($Environ,undef) = <ENVIRON>;close(ENVIRON);
+ if ($Environ =~ m/X2GO_SESSION=$x2gosid/) { # If the x2go Session ID is in environ... renice the pid...
+ #syslog('debug', "$pid: X2GO_SESSION=$x2gosid");
+ system("renice", "-n", "$idleNL", "-p", "$pid");
+ }
}
- }
- }
- close(AUPS);
+ }
+ close(AUPS);
- # Renice the AGENT so that we'll know that this one is already reniced.
- system("renice", "-n", "$idleNL", "-p", "$agentPid");
- syslog('notice', "ReNicing \"$userID\" to level $idleNL for session \"$x2gosid\"");
+ # Renice the AGENT so that we'll know that this one is already reniced.
+ system("renice", "-n", "$idleNL", "-p", "$agentPid");
+ syslog('notice', "ReNicing \"$userID\" to level $idleNL for session \"$x2gosid\"");
+ }
}
}
}
@@ -198,22 +205,24 @@ sub superenice {
# Using the NICE value of the agent to figgure out the current nice state...
my ($psP,$psU,$psN,$psC) = checkPID($agentPid);
syslog('debug', "$nUser:$x2goState,$agentPid:$psP,$psU,$psN,$psC");
- # State is R (Running?)...
- if ($x2goState eq "R") {
+ if ($psP > -1) {
+ # State is R (Running?)...
+ if ($x2goState eq "R") {
- # If nice level is not normal, renice to normal...
- if ($psN ne $normalNL) {
- syslog('debug', "ReNicing \"$nUser\" to level $normalNL");
- system("renice", "-n", "$normalNL", "-u", "$nUser");
- }
+ # If nice level is not normal, renice to normal...
+ if ($psN ne $normalNL) {
+ syslog('debug', "ReNicing \"$nUser\" to level $normalNL");
+ system("renice", "-n", "$normalNL", "-u", "$nUser");
+ }
- # State is S (suspended)
- } elsif ($x2goState eq "S") {
+ # State is S (suspended)
+ } elsif ($x2goState eq "S") {
- # Did we renice this?
- if ($psN ne $idleNL) {
- syslog('debug', "ReNicing \"$nUser\" to level $idleNL");
- system("renice", "-n", "$idleNL", "-u", "$nUser");
+ # Did we renice this?
+ if ($psN ne $idleNL) {
+ syslog('debug', "ReNicing \"$nUser\" to level $idleNL");
+ system("renice", "-n", "$idleNL", "-u", "$nUser");
+ }
}
}
}
diff --git a/debian/changelog b/debian/changelog
index 823fe95..979576c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -38,6 +38,7 @@ x2goserver (4.1.0.0-0x2go1) UNRELEASED; urgency=low
- Provide Perl functions to capture stdout/stderr with multi-argument system
calls.
- Avoid one argument system calls and backticks in SupeReNicer.
+ - Handle situations in SupeReNicer where the agent PID is not set.
* debian/control:
+ Package X2Go::Log in separate package: libx2go-log-perl.
+ Package X2Go::Server::DB in separate package: libx2go-server-db-perl.
hooks/post-receive
--
x2goserver.git (X2Go Server)
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "x2goserver.git" (X2Go Server).
More information about the x2go-commits
mailing list