aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFeng Tang <feng.tang@intel.com>2010-06-08 16:10:39 +0800
committerFeng Tang <feng.tang@intel.com>2010-07-20 11:10:03 +0800
commit49db2cbc1db01c4fbbbba6f51050941fd7411930 (patch)
tree3d8a3085e0c3c5a257de708e73fb85c896ebe7dc
parente43783bd06d915b2157e63b9b1853e7600ef2b87 (diff)
downloadsyslinux-49db2cbc1db01c4fbbbba6f51050941fd7411930.tar.gz
syslinux-49db2cbc1db01c4fbbbba6f51050941fd7411930.tar.xz
syslinux-49db2cbc1db01c4fbbbba6f51050941fd7411930.zip
elflink: change cli.c/get_key.c to use times() provided in core
-rw-r--r--core/elflink/cli.c7
-rw-r--r--core/elflink/get_key.c9
2 files changed, 10 insertions, 6 deletions
diff --git a/core/elflink/cli.c b/core/elflink/cli.c
index 2e223ae0..ec4d1612 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 ce82fd1f..b2f70925 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;