1 /*
2 * load50.c -- a simple busy-looping tool.
3 * Obviously, this runs with any kernel and any Unix
4 *
5 * Copyright (C) 2001 Alessandro Rubini and Jonathan Corbet
6 * Copyright (C) 2001 O'Reilly & Associates
7 *
8 * The source code in this file can be freely used, adapted,
9 * and redistributed in source or binary form, so long as an
10 * acknowledgment appears in derived source files. The citation
11 * should list that the code comes from the book "Linux Device
12 * Drivers" by Alessandro Rubini and Jonathan Corbet, published
13 * by O'Reilly & Associates. No warranty is attached;
14 * we cannot take responsibility for errors or fitness for use.
15 */
16
17 #include <stdio.h>
18 #include <stdlib.h>
19 #include <unistd.h>
20
21 int main(int argc, char **argv)
22 {
23 int i, load=50;
24
25 if (argc==2) {
26 load=atoi(argv[1]);
27 }
28 printf("Bringing load to %i\n",load);
29
30 for (i=0; i<load; i++)
31 if (fork()==0)
32 break;
33
34 while(1)
35 ;
36 return 0;
37 }
38
39
|
This page was automatically generated by the
LXR engine.
|