[ntp:questions] "ntpdate" hanging !!

Brian Inglis Brian.Inglis at SystematicSW.Invalid
Mon Mar 7 21:56:25 UTC 2005

fn Mon, 07 Mar 2005 20:31:36 +0530 in comp.protocols.time.ntp,
Srikanth K <srikanth.k at hp.com> wrote:

>mayer at gis.net wrote:

>>Srikanth K <srikanth.k at hp.com> wrote:

>>>Hello ,
>>>I notice a hang when i run the below mentioned program in a hp-ux
>>>11.11  machine. The "ntpdate" binary which i am using in the program
>>>is taken  from "ntp-stable-4.2.0a-20040617" of the open ntp source.
>>>/* program starts here */
>>>#include <signal.h>
>>>#include <unistd.h>
>>>long oldmask, newmask;
>>>oldmask = sigblock(0);
>>>system("/usr/sbin/ntpdate -q <timeserver-ip>");
>>>/* program ends here */
>>>Is it a bug in "ntpdate" binary? If so, is there any fix available for
>>No idea. Where is it hanging? Have you tried this outside your program?
>>What's the purpose of the program? Have you run ntpdate under the
>Actually i am running a big application in hp-ux 11.11 and the program 
>which i sent in my previous mail is just a simulation of the problem in 
>my application. Actually, the application tries to block SIGALRM signal 
>and run "ntpdate" binary by calling "system" library call. In the actual 
>scenario,  the parent program blocks the SIGALRM signal and the "system" 
>function calls fork/vfork and execs the "ntpdate" binary.
>Eventually, the child process ( in this case: the ntpdate program ) has 
>SIGALRM set in its signal mask. Therefore, SIGALRM is blocked for the 
>ntpdate program also.

>Why does ntpdate behave like this ?
>Is this the normal ( expected ) behaviour of ntpdate ( when SIGALRM is 
>blocked )

Programs which block are normally awakened by signals. 
Why are you blocking SIGALRM in the first place? 
Either remove the seemingly pointless block of SIGALRM before the
system call, or do your own vfork, and reset the signal mask in the
child process, before you do the exec. 

"Doctor, it hurts when I do this!" 
"Well, then, don't do that." 

[Troll-o-meter: 7]

Thanks. Take care, Brian Inglis 	Calgary, Alberta, Canada

Brian.Inglis at CSi.com 	(Brian[dot]Inglis{at}SystematicSW[dot]ab[dot]ca)
    fake address		use address above to reply

More information about the questions mailing list