summaryrefslogtreecommitdiff
path: root/sys/stand/boot/cmd.c
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>1999-04-20 02:20:13 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>1999-04-20 02:20:13 +0000
commite6436270ffeb97dc22f5a01839fb4e34946dbceb (patch)
tree7b6dc2bd47d02b29df594eb4838fc2bb39d9fcb2 /sys/stand/boot/cmd.c
parent838da128b485c2c1ce2551cfa006e55de0ee8bc6 (diff)
make calls for current time to BIOS less often; toby -- ok
Diffstat (limited to 'sys/stand/boot/cmd.c')
-rw-r--r--sys/stand/boot/cmd.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/sys/stand/boot/cmd.c b/sys/stand/boot/cmd.c
index dc8b12445e6..687e0ede0ad 100644
--- a/sys/stand/boot/cmd.c
+++ b/sys/stand/boot/cmd.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: cmd.c,v 1.43 1998/10/29 17:07:24 mickey Exp $ */
+/* $OpenBSD: cmd.c,v 1.44 1999/04/20 02:20:12 mickey Exp $ */
/*
- * Copyright (c) 1997,1998 Michael Shalayeff
+ * Copyright (c) 1997-1999 Michael Shalayeff
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -223,17 +223,20 @@ readline(buf, to)
extern int debug;
#endif
register char *p = buf, *pe = buf, ch;
- register time_t tt;
/* Only do timeout if greater than 0 */
if (to > 0) {
- tt = getsecs() + to;
+ u_long i = 0;
+ time_t tt = getsecs() + to;
#ifdef DEBUG
if (debug > 2)
printf ("readline: timeout(%d) at %u\n", to, tt);
#endif
- while (getsecs() < tt && !cnischar())
- ;
+ /* check for timeout expiration less often
+ (for some very constrained archs) */
+ while (!cnischar())
+ if (!(i++ % 1000) && (getsecs() >= tt))
+ break;
if (!cnischar()) {
strncpy(buf, "boot", 5);