From owner-freebsd-current Tue Jan 4 7:55:20 2000 Delivered-To: freebsd-current@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id 53C15153C9 for ; Tue, 4 Jan 2000 07:55:06 -0800 (PST) (envelope-from bde@zeta.org.au) Received: from bde.zeta.org.au (beefcake.zeta.org.au [203.26.10.12]) by mailman.zeta.org.au (8.8.7/8.8.7) with ESMTP id CAA08308; Wed, 5 Jan 2000 02:54:52 +1100 Date: Wed, 5 Jan 2000 02:54:50 +1100 (EST) From: Bruce Evans X-Sender: bde@alphplex.bde.org To: Brian Dean Cc: freebsd-current@FreeBSD.ORG Subject: Re: tip features (cdelay and ldelay)? In-Reply-To: <200001041517.KAA55947@dean.pc.sas.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Tue, 4 Jan 2000, Brian Dean wrote: > Since no one seems to recall why these features were removed, and I > don't see any reference to them in the CVS log, would someone please The were gone in the base version (4.4Lite1). > consider applying the included patch to re-enable them? > +static int > +nap ( int microsec ) > +{ > + int rc; > + > + rc = usleep ( microsec ); > + if (rc != 0) { > + fprintf ( stderr, > + "warning: ldelay or cdelay interrupted, " > + "delay time cut short: %s\n", > + strerror(errno) ); > + } > + > + return 0; > +} usleep() has a resolution of 2/HZ seconds (normally 20msec), so the above gives very slow output (50-100 cps). Using a low baud rate (500-1000 bps) give the same result. If you want a shorter delay/faster output, then there is nothing better than a busy-wait loop for implementing nap(). Using a not so low baud rate (1200+ bps) may work better. Perhaps nap() was dropped because it can't be implemented reasonably. > /* > * FTP - send single character > * wait for echo & handle timeout > @@ -573,15 +592,11 @@ > > cc = c; > xpwrite(FD, &cc, 1); > -#ifdef notdef > if (number(value(CDELAY)) > 0 && c != '\r') > nap(number(value(CDELAY))); > -#endif > if (!boolean(value(ECHOCHECK))) { > -#ifdef notdef > if (number(value(LDELAY)) > 0 && c == '\r') > nap(number(value(LDELAY))); > -#endif > return; > } > tryagain: This seems to rely on the driver adding a suitable delay for the c == '\r' case. The tty driver has never supported delays for special characters. The necessary delays are even harder to implement in the kernel than in userland, since timeout() resolution is the same as usleep() resolution and busy waiting is not acceptable in the kernel. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message