From 9a571ec74efcaed3a787e20c68c9ff29bda48729 Mon Sep 17 00:00:00 2001 From: Brian Somers Date: Fri, 24 Oct 1997 22:36:31 +0000 Subject: [PATCH] sleep => nointr_sleep usleep => nointr_usleep (not just a #define) Already done by: ache --- usr.sbin/ppp/chat.c | 6 +++--- usr.sbin/ppp/command.c | 4 ++-- usr.sbin/ppp/defs.h | 8 +++----- usr.sbin/ppp/main.c | 12 ++++++------ usr.sbin/ppp/modem.c | 6 +++--- usr.sbin/ppp/timer.c | 6 +++--- 6 files changed, 20 insertions(+), 22 deletions(-) diff --git a/usr.sbin/ppp/chat.c b/usr.sbin/ppp/chat.c index 64325295d71d..05b4ecb5cf2b 100644 --- a/usr.sbin/ppp/chat.c +++ b/usr.sbin/ppp/chat.c @@ -18,7 +18,7 @@ * Columbus, OH 43221 * (614)451-1883 * - * $Id: chat.c,v 1.32 1997/08/25 00:29:07 brian Exp $ + * $Id: chat.c,v 1.33 1997/08/31 22:59:15 brian Exp $ * * TODO: * o Support more UUCP compatible control sequences. @@ -148,10 +148,10 @@ ExpandString(char *str, char *result, int reslen, int sendmode) addcr = 0; break; case 'd': /* Delay 2 seconds */ - sleep(2); + nointr_sleep(2); break; case 'p': - usleep(250000); + nointr_usleep(250000); break; /* Pause 0.25 sec */ case 'n': *result++ = '\n'; diff --git a/usr.sbin/ppp/command.c b/usr.sbin/ppp/command.c index 2d50b958d1d7..634e28974c96 100644 --- a/usr.sbin/ppp/command.c +++ b/usr.sbin/ppp/command.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: command.c,v 1.85 1997/09/25 00:52:33 brian Exp $ + * $Id: command.c,v 1.86 1997/10/12 01:49:37 brian Exp $ * */ #include @@ -167,7 +167,7 @@ DialCommand(struct cmdtab const * cmdlist, int argc, char **argv) break; } if ((res = DialModem()) == EX_DONE) { - sleep(1); + nointr_sleep(1); ModemTimeout(); PacketMode(); break; diff --git a/usr.sbin/ppp/defs.h b/usr.sbin/ppp/defs.h index 6e2835a5a12d..d9d4ea1b73b5 100644 --- a/usr.sbin/ppp/defs.h +++ b/usr.sbin/ppp/defs.h @@ -15,7 +15,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: defs.h,v 1.19 1997/09/10 02:20:28 brian Exp $ + * $Id: defs.h,v 1.20 1997/10/23 21:32:48 ache Exp $ * * TODO: */ @@ -106,10 +106,8 @@ char *dstsystem; #endif #ifdef SIGALRM -#define sleep nointr_sleep -#define usleep nointr_usleep -u_int sleep(u_int sec); -void usleep(u_int usec); +u_int nointr_sleep(u_int sec); +void nointr_usleep(u_int usec); #endif #endif /* _DEFS_H_ */ diff --git a/usr.sbin/ppp/main.c b/usr.sbin/ppp/main.c index 23b0ea710655..cea84275d8f2 100644 --- a/usr.sbin/ppp/main.c +++ b/usr.sbin/ppp/main.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: main.c,v 1.82 1997/10/07 00:56:57 brian Exp $ + * $Id: main.c,v 1.83 1997/10/16 23:55:18 brian Exp $ * * TODO: * o Add commands for traffic summary, version display, etc. @@ -166,7 +166,7 @@ Cleanup(int excode) { OsLinkdown(); OsCloseLink(1); - sleep(1); + nointr_sleep(1); if (mode & MODE_AUTO) DeleteIfRoutes(1); (void) unlink(pid_filename); @@ -708,7 +708,7 @@ DoLoop() } else if (mode & MODE_DEDICATED) { if (modem < 0) while (OpenModem(mode) < 0) - sleep(VarReconnectTimer); + nointr_sleep(VarReconnectTimer); } fflush(VarTerm); @@ -787,7 +787,7 @@ DoLoop() LogPrintf(LogCHAT, "Dial attempt %u\n", tries); if ((res = DialModem()) == EX_DONE) { - sleep(1); /* little pause to allow peer starts */ + nointr_sleep(1); /* little pause to allow peer starts */ ModemTimeout(); PacketMode(); dial_up = FALSE; @@ -848,7 +848,7 @@ DoLoop() * ppp process eats many CPU time. */ #ifndef SIGALRM - usleep(TICKUNIT); + nointr_usleep(TICKUNIT); TimerService(); #else handle_signals(); @@ -931,7 +931,7 @@ DoLoop() } if (FD_ISSET(modem, &rfds)) { /* something to read from modem */ if (LcpFsm.state <= ST_CLOSED) - usleep(10000); + nointr_usleep(10000); n = read(modem, rbuff, sizeof(rbuff)); if ((mode & MODE_DIRECT) && n <= 0) { DownConnection(); diff --git a/usr.sbin/ppp/modem.c b/usr.sbin/ppp/modem.c index eb97a02416f2..36f423d268b0 100644 --- a/usr.sbin/ppp/modem.c +++ b/usr.sbin/ppp/modem.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: modem.c,v 1.57 1997/09/22 23:59:14 brian Exp $ + * $Id: modem.c,v 1.58 1997/09/23 22:07:51 brian Exp $ * * TODO: */ @@ -552,7 +552,7 @@ OpenModem(int mode) mbits = 0; dev_is_modem = isatty(modem) || DEV_IS_SYNC; if (DEV_IS_SYNC) - sleep(1); + nointr_sleep(1); if (dev_is_modem && !DEV_IS_SYNC) { tcgetattr(modem, &rstio); modemios = rstio; @@ -685,7 +685,7 @@ HangupModem(int flag) } tcsetattr(modem, TCSANOW, &tio); #endif - sleep(1); + nointr_sleep(1); } /* diff --git a/usr.sbin/ppp/timer.c b/usr.sbin/ppp/timer.c index 3070346065fc..c4463c04919c 100644 --- a/usr.sbin/ppp/timer.c +++ b/usr.sbin/ppp/timer.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: timer.c,v 1.19 1997/10/23 20:11:01 ache Exp $ + * $Id: timer.c,v 1.20 1997/10/23 21:32:48 ache Exp $ * * TODO: */ @@ -198,7 +198,7 @@ ShowTimers() #ifdef SIGALRM u_int -sleep(u_int sec) +nointr_sleep(u_int sec) { struct timeval to, st, et; long sld, nwd, std; @@ -229,7 +229,7 @@ sleep(u_int sec) } void -usleep(u_int usec) +nointr_usleep(u_int usec) { struct timeval to, st, et; long sld, nwd, std;