[LinuxPPS] Patch to make ppsldisc to 'go away' after 60 sec.
clemens at dwf.com
clemens at dwf.com
Tue Aug 26 18:24:55 CEST 2008
After 'playing' with ntp for a while, and starting and restarting it,
I find that I have half a dozen ppsldisc's running.
If anything this is irritating,- and is probably why I reported that
I was having problems with -rc4.
In any case, here is what I do locally.
1) compile ppsldisc.c and put it in /usr/local/bin
2) modify the /etc/rc.d/init.d/ntpd startup file, and where it says
# Start daemon.
echo -n "Starting ntpd: "
daemon $NTPD -c $ntpconf
I add two lines to make it read
# Start daemon.
echo -n "Starting ppsldisc: "
/usr/local/bin/ppsldisc /dev/ttyS0 &
echo -n "Starting ntpd: "
daemon $NTPD -c $ntpconf
I have now modified Rodolfo's ppsldisc with the following minimal patch:
[root at deneb pps]# diff -c ppsldisc.c ppsldisc2.c
*** ppsldisc.c 2008-08-23 15:39:46.000000000 -0600
--- ppsldisc2.c 2008-08-26 10:08:31.000000000 -0600
***************
*** 7,12 ****
--- 7,13 ----
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
+ #include <signal.h>
#ifndef N_PPS
#define N_PPS __N_PPS
***************
*** 19,24 ****
--- 20,30 ----
exit(EXIT_FAILURE);
}
+ void handler()
+ {
+ exit(0);
+ }
+
int main(int argc, char *argv[])
{
int fd;
***************
*** 40,45 ****
--- 46,53 ----
exit(EXIT_FAILURE);
}
+ signal (SIGALRM, handler);
+ alarm(60);
pause();
return 0;
---
so that it kills itself after 60 seconds.
Thats WAY longer than its going to take ntpd to get initialized, and
once ntpd is running you no longer ned ppsldisc.
I think this would be a worthwhile change to ppsldisc.c, but that's
up to Rodolfo,- I find it useful.
--
Reg.Clemens
reg at dwf.com
More information about the LinuxPPS
mailing list