Commit | Line | Data |
---|---|---|
34e49164 C |
1 | int do_setitimer(int which, struct itimerval *value, |
2 | struct itimerval *ovalue) | |
3 | { | |
4 | unsigned long expire; | |
5 | cputime_t cputime; | |
6 | int k; | |
7 | if (ovalue && (k = do_getitimer(which, ovalue)) < 0) | |
8 | return k; | |
9 | switch (which) { | |
10 | case ITIMER_VIRTUAL: | |
11 | cputime = timeval_to_cputime(&value->it_value); | |
12 | - if (cputime_eq(cputime, cputime_zero)) | |
13 | - cputime = jiffies_to_cputime(1); | |
14 | + if (cputime_gt(cputime, cputime_zero)) | |
15 | + cputime = cputime_add(cputime, | |
16 | + jiffies_to_cputime(1)); | |
17 | current->it_virt_value = cputime; | |
18 | cputime = timeval_to_cputime(&value->it_interval); | |
19 | current->it_virt_incr = cputime; | |
20 | break; | |
21 | case ITIMER_PROF: | |
22 | cputime = timeval_to_cputime(&value->it_value); | |
23 | - if (cputime_eq(cputime, cputime_zero)) | |
24 | - cputime = jiffies_to_cputime(1); | |
25 | + if (cputime_gt(cputime, cputime_zero)) | |
26 | + cputime = cputime_add(cputime, | |
27 | + jiffies_to_cputime(1)); | |
28 | current->it_prof_value = cputime; | |
29 | cputime = timeval_to_cputime(&value->it_interval); | |
30 | current->it_prof_incr = cputime; | |
31 | break; | |
32 | default: | |
33 | return -EINVAL; | |
34 | } | |
35 | return 0; | |
36 | } |