From f3b5a6849c192cbc0fa90446bbb13d79252d7e53 Mon Sep 17 00:00:00 2001 From: mycroft Date: Fri, 13 Aug 2004 17:19:15 +0000 Subject: [PATCH] Replace the sleep(2) in setctty() with a nanosleep(), with a default value of 250ms. --- sbin/init/init.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sbin/init/init.c b/sbin/init/init.c index 3c1e3317941d..e8140309f4fa 100644 --- a/sbin/init/init.c +++ b/sbin/init/init.c @@ -1,4 +1,4 @@ -/* $NetBSD: init.c,v 1.65 2004/08/13 17:11:49 mycroft Exp $ */ +/* $NetBSD: init.c,v 1.66 2004/08/13 17:19:15 mycroft Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1991, 1993\n" #if 0 static char sccsid[] = "@(#)init.c 8.2 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: init.c,v 1.65 2004/08/13 17:11:49 mycroft Exp $"); +__RCSID("$NetBSD: init.c,v 1.66 2004/08/13 17:19:15 mycroft Exp $"); #endif #endif /* not lint */ @@ -90,6 +90,7 @@ __RCSID("$NetBSD: init.c,v 1.65 2004/08/13 17:11:49 mycroft Exp $"); #define STALL_TIMEOUT 30 /* wait N secs after warning */ #define DEATH_WATCH 10 /* wait N secs for procs to die */ +const struct timespec dtrtime = {.tv_sec = 0, .tv_nsec = 250000}; #if defined(RESCUEDIR) #define INIT_BSHELL RESCUEDIR "/sh" @@ -530,7 +531,7 @@ setctty(const char *name) int fd; (void) revoke(name); - sleep(2); /* leave DTR low */ + nanosleep(&dtrtime, NULL); /* leave DTR low for a bit */ if ((fd = open(name, O_RDWR)) == -1) { stall("can't open %s: %m", name); _exit(1);