writer.c (346B)
1 #include <u.h> 2 #include <libc.h> 3 #define BSize (1024 * 1024 * 64) 4 void 5 main(void) 6 { 7 int i; 8 long n; 9 n = 1; 10 char *buf = malloc(BSize); 11 fprint(2, "writer begin\n"); 12 for (i = 0; (i < 8) && (n > 0); i++) { 13 n = write(1, buf, BSize); 14 fprint(2, "writer: %ld/%d\n", n, BSize); 15 } 16 if (n < 0) sysfatal("%r"); 17 fprint(2, "writer end, %d\n", i); 18 }