Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Is setitimer broken under current?



Hi,

I'm having a problem with KDE4.1 konqueror.  It aborts with an Alarm clock" 
message whenever the page it's on contains JavaScript.  I've tracked it down 
to an issue with setitimer.  The attached program reproduces the problem.

Running the program under 3.1 or 4.0 produces the expected:

reset1 = 0 0
reset2 = 0 0
normal exit reached

With current (ca 30 July) I get:

reset1 = 0 0
reset2 = -800068256 -797028960
Alarm clock

For some reason the third call to setitimer returns bad values for the 
previous value of the timer (the exact values vary slightly).

This is on i386 single processor.

Is this a known issue or should I file a PR.

Thanks,
Sverre

#include <stdio.h>
#include <sys/time.h>

int main () {
        struct itimerval m_tv, m_oldtv;

        m_tv.it_interval.tv_sec = 4;
        m_tv.it_interval.tv_usec = 0;
        m_tv.it_value.tv_sec = 4;
        m_tv.it_value.tv_usec = 0;

        setitimer(ITIMER_REAL, &m_tv, &m_oldtv);
        printf("reset1 = %ld %ld\n", m_oldtv.it_value.tv_sec,  
m_oldtv.it_value.tv_usec);
        sleep(2);

        setitimer(ITIMER_REAL, &m_oldtv, 0L);
        sleep(1);

        setitimer(ITIMER_REAL, &m_tv, &m_oldtv);
        printf("reset2 = %ld %ld\n", m_oldtv.it_value.tv_sec,  
m_oldtv.it_value.tv_usec);
        sleep(2);

        setitimer(ITIMER_REAL, &m_oldtv, 0L);
        sleep(10);
        
        printf("normal exit reached\n");
}


Home | Main Index | Thread Index | Old Index