📄 190
字号:
Replied: Fri, 27 Mar 1998 01:29:51 -0500Replied: "jonathan@DSG.Stanford.EDU "Received: from mail.eecis.udel.edu by whimsy.udel.edu id aa02952; 26 Mar 1998 20:18 ESTReceived: (from jonathan@localhost) by Kowhai.Stanford.EDU (8.7.4/8.6.9) id RAA10458; Thu, 26 Mar 1998 17:18:09 -0800 (PST)Date: Thu, 26 Mar 1998 17:18:09 -0800 (PST)Message-Id: <199803270118.RAA10458@Kowhai.Stanford.EDU>X-newsreader: xrn 9.00From: Jonathan Stone <jonathan@DSG.Stanford.EDU>Reply-To: jonathan@DSG.Stanford.EDUPath: Kowhai.Stanford.EDU!jonathanNewsgroups: comp.protocols.time.ntpTo: "David L. Mills" <mills@udel.edu>Cc: stenn@whimsy.udel.eduSubject: Portability paranoia patches for adding TIOCDCDTIMESTAMPDistribution: Followup-To: Organization: Stanford Distributed Systems GropKeywords: [posted to comp.protocols.time.ntp, for inspection, and emailed]I've implemented TIOCDCDTIMESTAMP in NetBSD, with the same semanticsand name as FreeBSD. Looking at the 3-5.92 code, if the systemheaders define TIOCDDCDTIMESTAMP, xntpd/ntp_refclock.c assumes theioctl() will always succeed. The older, pre-DIOCDCDTIMESTAMP code is#ifdef'ed outThe following patch changes the test for TIOCDDCDTIMESTAMP usage fromcompile-time to run-time. This is a small piece of paranoia, to makexntpd work even if the source has TIOCDDCDTIMESTAMP, but the kerneldoesn't. It also increases backward portabiility.I'd like to put these changes into the NetBSD-distributed version ofxntp, for ease of binary distributions. It'd be nice, but notnecessary, if they got pulled into the canonical source.I havent actually tried this on a refclock yet, eihter with or withoutTIOCDCDTIMESTAMP, but it seems utterly straightforward to fall backfrom the inkernel timestamp to the old method, if and only if thekernel pukes on the TIOCDCDTIMESTAMP ioctl(). I'd be grateful for any advice to the contrary.Index: xntpd/ntp_refclock.c===================================================================RCS file: /cvsroot/src/usr.sbin/xntp/xntpd/ntp_refclock.c,vretrieving revision 1.3diff -c -r1.3 ntp_refclock.c*** ntp_refclock.c 1998/03/06 18:17:22 1.3--- ntp_refclock.c 1998/03/27 01:10:05****************** 722,729 **** } else trtmp = rbufp->recv_time; }! ! #else /* TIOCDCDTIMESTAMP */ if (dpend >= dpt + 8) { if (buftvtots(dpend - 8, &tstmp)) { L_SUB(&trtmp, &tstmp);--- 722,730 ---- } else trtmp = rbufp->recv_time; }! else! /* XXX fallback to old method if kernel refuses TIOCDCDTIMESTAMP */! #endif /* TIOCDCDTIMESTAMP */ if (dpend >= dpt + 8) { if (buftvtots(dpend - 8, &tstmp)) { L_SUB(&trtmp, &tstmp);****************** 746,752 **** trtmp = rbufp->recv_time; } }- #endif /* TIOCDCDTIMESTAMP */ /* * Edit timecode to remove control chars. Don't monkey with the--- 747,752 ----
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -