aboutsummaryrefslogtreecommitdiff
path: root/test/bun.js/test-programs/bigpipe-w.c
blob: 1acd94f7bc0d5c9f09f0dcbe0403bbb27a9ef220 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <unistd.h>

char one_mb_pipe_buf_1[1024 * 1024];

 int main(int argc, char* argv[])
 {
    for (int i = 0; i < sizeof(one_mb_pipe_buf_1); i++) {
      one_mb_pipe_buf_1[i] = i % 256;
    }

    while (1) {

    
    size_t amt = 0;
    size_t cnt = 0;

    cnt = 0;
    while (cnt < sizeof(one_mb_pipe_buf_1)) {
      amt = read(0, one_mb_pipe_buf_1 + cnt, sizeof(one_mb_pipe_buf_1) - cnt);
      if (amt == 0) {
        break;
      }
      cnt += amt;
    }
    }
 }