aboutsummaryrefslogtreecommitdiffstats
path: root/com32/libutil
diff options
context:
space:
mode:
authorhpa <hpa>2005-01-20 18:41:12 +0000
committerhpa <hpa>2005-01-20 18:41:12 +0000
commitd952fbec351096681f3ce4a1e96740395ecf619e (patch)
tree58c2c08959479c161fdb3589207180e823be5e23 /com32/libutil
parent15088eec8155b23f6768a6412229300b56f8bffb (diff)
downloadsyslinux-d952fbec351096681f3ce4a1e96740395ecf619e.tar.gz
syslinux-d952fbec351096681f3ce4a1e96740395ecf619e.tar.xz
syslinux-d952fbec351096681f3ce4a1e96740395ecf619e.zip
Move idle function into libcom32; libutil function is now just a wrapper.
Diffstat (limited to 'com32/libutil')
-rw-r--r--com32/libutil/Makefile2
-rw-r--r--com32/libutil/get_key.c3
-rw-r--r--com32/libutil/idle.c53
-rw-r--r--com32/libutil/include/libutil.h40
4 files changed, 97 insertions, 1 deletions
diff --git a/com32/libutil/Makefile b/com32/libutil/Makefile
index c3cc4149..9003f986 100644
--- a/com32/libutil/Makefile
+++ b/com32/libutil/Makefile
@@ -47,7 +47,7 @@ LNXCFLAGS = -I./include -W -Wall -O -g
LNXSFLAGS = -g
LNXLDFLAGS = -g
OBJCOPY = objcopy
-LIBOBJS = ansiline.o ansiraw.o get_key.o
+LIBOBJS = ansiline.o ansiraw.o get_key.o idle.o
LNXLIBOBJS = $(patsubst %.o,%.lo,$(LIBOBJS))
.SUFFIXES: .lss .c .lo .o .elf .c32 .lnx
diff --git a/com32/libutil/get_key.c b/com32/libutil/get_key.c
index b7498a1e..e3b8f02b 100644
--- a/com32/libutil/get_key.c
+++ b/com32/libutil/get_key.c
@@ -41,6 +41,7 @@
#include <time.h>
#include <sys/times.h>
#include <getkey.h>
+#include <libutil.h>
struct keycode {
int code;
@@ -139,6 +140,8 @@ int get_key(FILE *f, clock_t timeout)
else if ( !nc && timeout && lateness > timeout )
return KEY_NONE; /* timeout before sequence */
+ do_idle();
+
another = 1;
continue;
}
diff --git a/com32/libutil/idle.c b/com32/libutil/idle.c
new file mode 100644
index 00000000..7f724900
--- /dev/null
+++ b/com32/libutil/idle.c
@@ -0,0 +1,53 @@
+#ident "$Id$"
+/* ----------------------------------------------------------------------- *
+ *
+ * Copyright 2005 H. Peter Anvin - All Rights Reserved
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall
+ * be included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * ----------------------------------------------------------------------- */
+
+/*
+ * idle.c
+ *
+ * What to do in a busy loop...
+ */
+
+#ifdef __COM32__
+
+#include <syslinux.h>
+
+void do_idle(void)
+{
+ syslinux_idle();
+}
+
+#else
+
+#include <sched.h>
+
+void do_idle(void)
+{
+ sched_yield(); /* As good as we can get... */
+}
+
+#endif
diff --git a/com32/libutil/include/libutil.h b/com32/libutil/include/libutil.h
new file mode 100644
index 00000000..9138b6db
--- /dev/null
+++ b/com32/libutil/include/libutil.h
@@ -0,0 +1,40 @@
+#ident "$Id$"
+/* ----------------------------------------------------------------------- *
+ *
+ * Copyright 2005 H. Peter Anvin - All Rights Reserved
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall
+ * be included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * ----------------------------------------------------------------------- */
+
+/*
+ * libutil.h
+ *
+ * Misc libutil functions
+ */
+
+#ifndef LIBUTIL_LIBUTIL_H
+#define LIBUTIL_LIBUTIL_H
+
+void do_idle(void);
+
+#endif