69467264ce1ed1985a72186e0230ec253404c635
[feed/packages.git] / utils / stress / patches / 010-usleep.patch
1 --- a/src/stress.c
2 +++ b/src/stress.c
3 @@ -262,6 +262,7 @@ main (int argc, char **argv)
4
5 /* Calculate the backoff value so we get good fork throughput. */
6 backoff = do_backoff * forks;
7 + struct timespec b = {backoff / 1000000, (backoff % 1000000) * 1000};
8 dbg (stdout, "using backoff sleep of %llius\n", backoff);
9
10 /* If we are supposed to respect a timeout, calculate it. */
11 @@ -296,7 +297,7 @@ main (int argc, char **argv)
12 {
13 case 0: /* child */
14 alarm (timeout);
15 - usleep (backoff);
16 + nanosleep(&b, NULL);
17 if (do_dryrun)
18 exit (0);
19 exit (hogcpu ());
20 @@ -317,7 +318,7 @@ main (int argc, char **argv)
21 {
22 case 0: /* child */
23 alarm (timeout);
24 - usleep (backoff);
25 + nanosleep(&b,&b);
26 if (do_dryrun)
27 exit (0);
28 exit (hogio ());
29 @@ -337,7 +338,7 @@ main (int argc, char **argv)
30 {
31 case 0: /* child */
32 alarm (timeout);
33 - usleep (backoff);
34 + nanosleep(&b, &b);
35 if (do_dryrun)
36 exit (0);
37 exit (hogvm
38 @@ -358,7 +359,7 @@ main (int argc, char **argv)
39 {
40 case 0: /* child */
41 alarm (timeout);
42 - usleep (backoff);
43 + nanosleep(&b, &b);
44 if (do_dryrun)
45 exit (0);
46 exit (hoghdd (do_hdd_bytes));