permit multiline comments and strings in macros
[bpt/coccinelle.git] / demos / itimer.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 current->it_virt_value = cputime;
15 cputime = timeval_to_cputime(&value->it_interval);
16 current->it_virt_incr = cputime;
17 break;
18 case ITIMER_PROF:
19 cputime = timeval_to_cputime(&value->it_value);
20 if (cputime_eq(cputime, cputime_zero))
21 cputime = jiffies_to_cputime(1);
22 current->it_prof_value = cputime;
23 cputime = timeval_to_cputime(&value->it_interval);
24 current->it_prof_incr = cputime;
25 break;
26 default:
27 return -EINVAL;
28 }
29 return 0;
30 }