]>
git.saurik.com Git - apple/launchd.git/blob - launchd/testing/missed-EVFILT_TIMER.c
9 test5225889(int first
, int second
)
11 struct timeval tvs
, tve
, tvd
;
12 struct timespec timeout
= { 30, 0 };
16 fprintf(stdout
, "First timer %i being updated to %i.\n", first
, second
);
20 EV_SET(&kev
, 0, EVFILT_TIMER
, EV_ADD
|EV_ONESHOT
, NOTE_SECONDS
, first
, NULL
);
21 r
= kevent(kq
, &kev
, 1, NULL
, 0, NULL
);
24 EV_SET(&kev
, 0, EVFILT_TIMER
, EV_ADD
|EV_ONESHOT
, NOTE_SECONDS
, second
, NULL
);
25 r
= kevent(kq
, &kev
, 1, NULL
, 0, NULL
);
28 gettimeofday(&tvs
, NULL
);
29 r
= kevent(kq
, NULL
, 0, &kev
, 1, &timeout
);
30 gettimeofday(&tve
, NULL
);
32 timersub(&tve
, &tvs
, &tvd
);
34 fprintf(stdout
, "Waited %lu seconds for kevent() to return.\n", tvd
.tv_sec
);
38 assert(kev
.data
== second
);
39 assert(tvd
.tv_sec
>= second
);
44 fprintf(stderr
, "Bug 5225889 still exists!\n");
55 fprintf(stdout
, "Finished.\n");