NetBSD-Bugs archive

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

kern/53595: getitimer() returns strange value



>Number:         53595
>Category:       kern
>Synopsis:       getitimer() returns strange value
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Sep 12 00:05:00 +0000 2018
>Originator:     OHNOYA Satoru
>Release:        8.0
>Organization:
>Environment:
NetBSD localhost 8.0 NetBSD 8.0 (GENERIC) #0: Tue Jul 17 14:59:51 UTC 2018  mkrepro%mkrepro.NetBSD.org@localhost:/usr/src/sys/arch/i386/compile/GENERIC i386
>Description:
When call setitmer(), set interval.it_interval.tv_usec to 250000. But call getitimer(), returns it_interval.tv_sec to 250000.

>How-To-Repeat:
Run this program.
---
#include <stdio.h>
#include <signal.h>
#include <unistd.h>
#include <sys/time.h>

int main(int argc, char** argv) {
        struct itimerval  interval, remain;

        interval.it_value.tv_usec = 250000;
        interval.it_value.tv_sec = 0;
        interval.it_interval.tv_usec = 250000;
        interval.it_interval.tv_sec = 0;

        setitimer(ITIMER_REAL, &interval, NULL);

        getitimer(ITIMER_REAL, &remain);
        printf("getitimer : it_value.tv_usec:%lu, it_value.tv_sec:%lu, it_interval.tv_usec:%lu, it_interval.tv_sec:%lu\n",
                remain.it_value.tv_usec, remain.it_value.tv_sec, remain.it_interval.tv_usec, remain.it_interval.tv_sec);

        return 0;
}
---
getitimer : it_value.tv_usec:250000, it_value.tv_sec:0, it_interval.tv_usec:0, it_interval.tv_sec:250000

>Fix:
Sorry, I don't know.



Home | Main Index | Thread Index | Old Index