File: x-console.patch

package info (click to toggle)
killer 0.90-15
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 764 kB
  • sloc: perl: 8,785; makefile: 35; sh: 1
file content (35 lines) | stat: -rw-r--r-- 1,044 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Description: Detect kdm and gdm logins as console users.
 In that case jump over the initializeTty routine.
 This is example output from who in this case:
 .
 % who
 kdmuser :0           2008-01-22 15:58
 %
 .
 % who
 gdmuser tty7         2008-02-14 20:21 (:0)
 %

--- killer-git.orig/killer	2014-09-28 09:00:39.615967816 +0200
+++ killer-git/killer	2014-09-28 09:00:39.831969617 +0200
@@ -876,10 +876,16 @@
     while ( <W> ) {
 	chop;
 	@parts = split(/[ \t]+/);
-	if ( $parts[1] eq 'console' ) {
-	    $consoleuser = $parts[0];
-	}
-	$self->initializeTty($parts[1], stat("/dev/" . $parts[1]));
+    if ( $parts[1] eq 'console'
+         || $parts[1] =~ '^:\d+$'    # kdm
+         || $parts[1] =~ '^tty\d$'   # gdm
+       ) {
+         $consoleuser = $parts[0];
+         $tty2idletime{$parts[1]}=0; # do not kill processes for the console user (set idle time to 0)
+         push (@{$user2ttys{$consoleuser}},  $parts[1]);
+    } else {
+         $self->initializeTty($parts[1], stat("/dev/" . $parts[1]));
+    }
     }
     close(W);
 }