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