From leres@ee.lbl.gov  Thu Jul 17 19:57:30 1997
Received: from hot.ee.lbl.gov (hot.ee.lbl.gov [131.243.1.42])
          by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id TAA22847
          for <FreeBSD-gnats-submit@freebsd.org>; Thu, 17 Jul 1997 19:57:30 -0700 (PDT)
Received: by hot.ee.lbl.gov (8.8.6/1.43r)
	id TAA17366; Thu, 17 Jul 1997 19:57:29 -0700 (PDT)
Message-Id: <199707180257.TAA17366@hot.ee.lbl.gov>
Date: Thu, 17 Jul 1997 19:57:29 PDT
From: Craig Leres <leres@ee.lbl.gov>
To: FreeBSD-gnats-submit@freebsd.org
Subject: Re: Processes shouldn't get SIGIO when the tty is set to CLOCAL

>Number:         4113
>Category:       kern
>Synopsis:       Processes shouldn't get SIGIO when the tty is set to CLOCAL
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jul 17 20:00:02 PDT 1997
>Closed-Date:    Mon May 4 04:02:32 PDT 1998
>Last-Modified:  Mon May  4 04:03:07 PDT 1998
>Originator:     Craig Leres
>Release:        FreeBSD 2.2.2-RELEASE i386
>Organization:
Lawrence Berkeley National Laboratory
>Environment:

	

>Description:

	When running the current release of xntp (3-5.90), xntpd syslogs
	repeated errors:

	    Jul 17 12:29:24 meg xntpd[1714]: synchronized to GPS_JUPITER(0), st
ratum=0
	    Jul 17 12:29:25 meg xntpd[1714]: input_handler: select() returned 0
	    Jul 17 12:29:56 meg last message repeated 31 times
	    Jul 17 12:31:57 meg last message repeated 121 times
	    Jul 17 12:41:58 meg last message repeated 601 times
	    Jul 17 12:51:59 meg last message repeated 601 times
	    Jul 17 13:02:00 meg last message repeated 601 times
	    Jul 17 13:12:01 meg last message repeated 601 times
	    Jul 17 13:22:02 meg last message repeated 601 times
	    Jul 17 13:32:03 meg last message repeated 601 times
	    Jul 17 13:42:04 meg last message repeated 601 times

	These are due to the DCD line being toggled once per second.

>How-To-Repeat:

	Run the lastest xntpd with a refernece clock that uses
	the DCD line to import the PPS signal; watch the syslog.

>Fix:
	
	The appended patch to kern/tty.c cures the problem.

RCS file: RCS/tty.c,v
retrieving revision 1.1
diff -c -r1.1 tty.c
*** /tmp/,RCSt1005870	Thu Jul 17 19:49:16 1997
--- tty.c	Thu Jul 17 19:17:05 1997
***************
*** 1377,1383 ****
  		if (!ISSET(tp->t_state, TS_ZOMBIE))
  			SET(tp->t_state, TS_CONNECTED);
  		wakeup(TSA_CARR_ON(tp));
! 		ttwakeup(tp);
  		ttwwakeup(tp);
  	}
  	return (1);
--- 1377,1392 ----
  		if (!ISSET(tp->t_state, TS_ZOMBIE))
  			SET(tp->t_state, TS_CONNECTED);
  		wakeup(TSA_CARR_ON(tp));
! 		/* Don't generate SIGIO's for DCD if CLOCAL */
! 		if (ISSET(tp->t_cflag, CLOCAL)) {
! 			register int t_state;
! 
! 			t_state = tp->t_state;
! 			CLR(tp->t_state, TS_ASYNC);
! 			ttwakeup(tp);
! 			tp->t_state = t_state;
! 		} else
! 			ttwakeup(tp);
  		ttwwakeup(tp);
  	}
  	return (1);

------- End of Forwarded Message

>Release-Note:
>Audit-Trail:

From: Bruce Evans <bde@zeta.org.au>
To: FreeBSD-gnats-submit@FreeBSD.ORG, leres@ee.lbl.gov
Cc:  Subject: Re: kern/4113: Re: Processes shouldn't get SIGIO when the tty is set to CLOCAL
Date: Mon, 28 Jul 1997 17:14:12 +1000

 >Subject: kern/4113: Re: Processes shouldn't get SIGIO when the tty is set to CLOCAL
 
 I'm not sure what the correct behaviour is here.  One could argue
 that SIGIO should never be delivered for carrier rises, since carrier
 transitions aren't i/o.  OTOH, it may be useful to deliver a SIGIO for
 all state transitions in the driver, in case the application cares.
 This would be particularly useful for monitoring the carrier state in
 CLOCAL mode :-).  Applications that want to monitor the carrier state
 usually use alarms, but this gives a high latency.
 
 Bruce

From: Craig Leres <leres@ee.lbl.gov>
To: Bruce Evans <bde@zeta.org.au>
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: kern/4113: Re: Processes shouldn't get SIGIO when the tty is set to
Date: Mon, 28 Jul 1997 03:30:43 PDT

 > >Subject: kern/4113: Re: Processes shouldn't get SIGIO when the tty is set to CLOCAL
 > 
 > I'm not sure what the correct behaviour is here.  One could argue
 > that SIGIO should never be delivered for carrier rises, since carrier
 > transitions aren't i/o.  OTOH, it may be useful to deliver a SIGIO for
 > all state transitions in the driver, in case the application cares.
 > This would be particularly useful for monitoring the carrier state in
 > CLOCAL mode :-).  Applications that want to monitor the carrier state
 > usually use alarms, but this gives a high latency.
 
 The truth is, I think they're crazy for using SIGIO in xntpd... But
 since it's not my furball my main interest is in making xntpd run as
 well on FreeBSD as it does on other Unix systems. (And if an app wants
 to monitor the carrier state while in CLOCAL mode, it will only work
 under FreeBSD.)
 
 		Craig
State-Changed-From-To: open->closed 
State-Changed-By: phk 
State-Changed-When: Mon May 4 04:02:32 PDT 1998 
State-Changed-Why:  
I agree about ntpd being crazy using SIGIO. 
see also 4112 
>Unformatted:
------- Forwarded Message

Date: Thu, 17 Jul 1997 19:52:48 -0700 (PDT)
From: leres@ee.lbl.gov (Craig Leres)
Subject: Processes shouldn't get SIGIO when the tty is set to CLOCAL
To: FreeBSD-gnats-submit@freebsd.org
Cc: leres@ee.lbl.gov, mills@udel.edu (Dave Mills)
Reply-To: leres@ee.lbl.gov
X-send-pr-version: 3.2


