]>
git.proxmox.com Git - rustc.git/blob - src/compiler-rt/test/profile/Inputs/instrprof-file_ex.c
1 /* This is a test case where the parent process forks 10
2 * children which contend to write to the same file. With
3 * file locking support, the data from each child should not
11 extern FILE *lprofOpenFileEx(const char *);
12 int main(int argc
, char *argv
[]) {
21 fprintf(stderr
, "Requires one argument \n");
27 for (i
= 0; i
< 10; i
++) {
31 FILE *F
= lprofOpenFileEx(FN
);
33 fprintf(stderr
, "Can not open file %s from child\n", FN
);
36 fseek(F
, 0, SEEK_END
);
37 fprintf(F
, "Dump from Child %d\n", i
);
46 for (i
= 0; i
< 10; i
++) {
48 if ((tid
= waitpid(child
[i
], &child_status
, 0)) == -1)
51 F
= lprofOpenFileEx(FN
);
53 fprintf(stderr
, "Can not open file %s from parent\n", FN
);
56 fseek(F
, 0, SEEK_END
);
57 fprintf(F
, "Dump from parent %d\n", i
);