diff options
author | Denys Vlasenko | 2010-01-07 11:51:13 +0100 |
---|---|---|
committer | Denys Vlasenko | 2010-01-07 11:51:13 +0100 |
commit | ae47335dc4b5b8e9e43a3936274d6875238f0763 (patch) | |
tree | fa43f7c0e3e8930fd2e657ba42521f02f68c73a0 /networking/ntpd.c | |
parent | 053ffeeeda923eb5e8c6f18d1d614d4f8d1de4a2 (diff) | |
download | busybox-ae47335dc4b5b8e9e43a3936274d6875238f0763.zip busybox-ae47335dc4b5b8e9e43a3936274d6875238f0763.tar.gz |
ntpd: show at loglevel 2 and export in env current poll interval
function old new delta
run_script 273 340 +67
ntpd_main 832 845 +13
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking/ntpd.c')
-rw-r--r-- | networking/ntpd.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/networking/ntpd.c b/networking/ntpd.c index 038f2bd..c28d768 100644 --- a/networking/ntpd.c +++ b/networking/ntpd.c @@ -689,7 +689,7 @@ send_query_to_peer(peer_t *p) static void run_script(const char *action) { char *argv[3]; - char *env1, *env2; + char *env1, *env2, *env3; if (!G.script_name) return; @@ -700,12 +700,14 @@ static void run_script(const char *action) VERB1 bb_error_msg("executing '%s %s'", G.script_name, action); - env1 = xasprintf("stratum=%u", G.stratum); + env1 = xasprintf("%s=%u", "stratum", G.stratum); putenv(env1); - env2 = xasprintf("freq_drift_ppm=%ld", G.kernel_freq_drift); + env2 = xasprintf("%s=%ld", "freq_drift_ppm", G.kernel_freq_drift); putenv(env2); + env3 = xasprintf("%s=%u", "poll_interval", 1 << G.poll_exp); + putenv(env3); /* Other items of potential interest: selected peer, - * rootdelay, reftime, rootdisp, refid, ntp_status, poll_exp, + * rootdelay, reftime, rootdisp, refid, ntp_status, * last_update_offset, last_update_recv_time, discipline_jitter */ @@ -713,12 +715,15 @@ static void run_script(const char *action) * may take some time (seconds): */ /*wait4pid(spawn(argv));*/ spawn(argv); - G.last_script_run = G.cur_time; unsetenv("stratum"); unsetenv("freq_drift_ppm"); + unsetenv("poll_interval"); free(env1); free(env2); + free(env3); + + G.last_script_run = G.cur_time; } static NOINLINE void @@ -1897,7 +1902,7 @@ int ntpd_main(int argc UNUSED_PARAM, char **argv) timeout++; /* (nextaction - G.cur_time) rounds down, compensating */ /* Here we may block */ - VERB2 bb_error_msg("poll %us, sockets:%u", timeout, i); + VERB2 bb_error_msg("poll %us, sockets:%u, poll interval:%us", timeout, i, 1 << G.poll_exp); nfds = poll(pfd, i, timeout * 1000); gettime1900d(); /* sets G.cur_time */ if (nfds <= 0) { |