Whamcloud - gitweb
land 0.5.20.3 b_devel onto HEAD (b_devel will remain)
[fs/lustre-release.git] / lustre / tests / writeme.c
1 #include <fcntl.h>
2 #include <unistd.h>
3 #include <stdlib.h>
4 #include <stdio.h>
5 #include <string.h>
6
7 int main(int argc, char **argv)
8 {
9         int fd, rc; 
10         int i = 0;
11         char buf[4096];
12         
13         memset(buf, 0, 4096);
14
15         if (argc != 2) { 
16                 printf("Usage openme <filename>\n"); 
17                 exit(1);
18         }
19
20         fd = open(argv[1], O_RDWR | O_CREAT, 0600);
21         if (fd == -1) { 
22                 printf("Error opening %s\n", argv[1]);
23                 exit(1);
24         }
25
26         while (1) { 
27                 sprintf(buf, "write %d\n", i); 
28                 rc = write(fd, buf, sizeof(buf)); 
29                 sleep(1); 
30         }
31         return 0;
32 }