Bug 4113 - Processes shouldn't get SIGIO when the tty is set to CLOCAL
Summary: Processes shouldn't get SIGIO when the tty is set to CLOCAL
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 2.2.2-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: FreeBSD bugs mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 1997-07-18 04:00 UTC by Craig Leres
Modified: 1998-05-04 12:03 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Craig Leres freebsd_committer 1997-07-18 04:00:02 UTC
	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.

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

RCS file: RCS/tty.c,v
retrieving revision 1.1


------- End of Forwarded Message--KcuQY4gUYj5921uHa8Ty4ulx8L2oimHjHOCAjG6gwCz1ZbLk
Content-Type: text/plain; name="file.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="file.diff"

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);
How-To-Repeat: 
	Run the lastest xntpd with a refernece clock that uses
	the DCD line to import the PPS signal; watch the syslog.
Comment 1 bde 1997-07-28 08:14:12 UTC
>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
Comment 2 Craig Leres freebsd_committer 1997-07-28 11:30:43 UTC
> >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
Comment 3 Poul-Henning Kamp freebsd_committer 1998-05-04 12:02:32 UTC
State Changed
From-To: open->closed

I agree about ntpd being crazy using SIGIO. 
see also 4112