[syslinux:elflink] elflink: change cli.c/get_key.c to use times() provided in core

syslinux-bot for Feng Tang feng.tang at intel.com
Thu Aug 12 21:03:11 PDT 2010


Commit-ID:  49db2cbc1db01c4fbbbba6f51050941fd7411930
Gitweb:     http://syslinux.zytor.com/commit/49db2cbc1db01c4fbbbba6f51050941fd7411930
Author:     Feng Tang <feng.tang at intel.com>
AuthorDate: Tue, 8 Jun 2010 16:10:39 +0800
Committer:  Feng Tang <feng.tang at intel.com>
CommitDate: Tue, 20 Jul 2010 11:10:03 +0800

elflink: change cli.c/get_key.c to use times() provided in core



---
 core/elflink/cli.c     |    7 ++++---
 core/elflink/get_key.c |    9 ++++++---
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/core/elflink/cli.c b/core/elflink/cli.c
index 2e223ae..ec4d161 100644
--- a/core/elflink/cli.c
+++ b/core/elflink/cli.c
@@ -12,8 +12,9 @@
 #include <linux/list.h>
 #include <sys/exec.h>
 #include <sys/module.h>
-#include "getkey.h"
+#include <core.h>
 
+#include "getkey.h"
 #include "common.h"
 #include "menu.h"
 #include "cli.h"
@@ -36,9 +37,9 @@ int mygetkey(clock_t timeout)
 	tto = min(totaltimeout, INT_MAX);
 	to = timeout ? min(tto, timeout) : tto;
 
-	t0 = times(NULL);
+	t0 = jiffies();
 	key = get_key(stdin, to);
-	t = times(NULL) - t0;
+	t = jiffies() - t0;
 
 	if (totaltimeout <= t)
 	    longjmp(timeout_jump, 1);
diff --git a/core/elflink/get_key.c b/core/elflink/get_key.c
index ce82fd1..b2f7092 100644
--- a/core/elflink/get_key.c
+++ b/core/elflink/get_key.c
@@ -38,8 +38,11 @@
 #include <errno.h>
 #include <unistd.h>
 #include <time.h>
+#include <core.h>
+
 #include <sys/times.h>
 #include <sys/module.h>
+
 #include "getkey.h"
 
 struct keycode {
@@ -132,11 +135,11 @@ int get_key(FILE * f, clock_t timeout)
 	timeout++;
 
     nc = 0;
-    start = times(NULL);
+    start = jiffies();
     do {
 	rv = read(fileno(f), &ch, 1);
 	if (rv == 0 || (rv == -1 && errno == EAGAIN)) {
-	    clock_t lateness = times(NULL) - start;
+	    clock_t lateness = jiffies() - start;
 	    if (nc && lateness > 1 + KEY_TIMEOUT) {
 		if (nc == 1)
 		    return buffer[0];	/* timeout in sequence */
@@ -151,7 +154,7 @@ int get_key(FILE * f, clock_t timeout)
 	    continue;
 	}
 
-	start = times(NULL);
+	start = jiffies();
 
 	buffer[nc++] = ch;
 



More information about the Syslinux-commits mailing list