From: Randy Dunlap <[email protected]>

When in dump mode, don't check for keyboard input (i.e., don't
check fd0 in the select() syscall).  Otherwise when 'key' is non-zero,
ticktime (from -t) is destroyed and the program loop exits
quickly.  If someone wants to kill powertop when in dump mode,
just kill it with ^C or "kill".

Signed-off-by: Randy Dunlap <[email protected]>
---
 powertop.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--- powertop-1.11.orig/powertop.c
+++ powertop-1.11/powertop.c
@@ -855,7 +855,7 @@ int main(int argc, char **argv)
                int64_t totalevents;
                fd_set rfds;
                struct timeval tv;
-               int key;
+               int key = 0;
 
                int i = 0;
                double c0 = 0;
@@ -863,7 +863,8 @@ int main(int argc, char **argv)
 
 
                FD_ZERO(&rfds);
-               FD_SET(0, &rfds);
+               if (!dump)
+                       FD_SET(0, &rfds);
                tv.tv_sec = ticktime;
                tv.tv_usec = (ticktime - tv.tv_sec) * 1000000;;
                do_proc_irq();




---
~Randy
LPC 2009, Sept. 23-25, Portland, Oregon
http://linuxplumbersconf.org/2009/
_______________________________________________
Discuss mailing list
[email protected]
http://lists.lesswatts.org/listinfo/discuss

Reply via email to