|
|
1.1 root 1: /* @(#)dupreq.c 1.2 90/01/03 NFS Rev 2 Testsuite */
2: /*
3: * check for lost reply on non-idempotent resuests
4: */
5: #include <stdio.h>
6:
7: main(argc, argv)
8: int argc;
9: char *argv[];
10: {
11: int count, i;
12: int fd;
13: int cfail, lfail, u1fail, u2fail;
14: char name1[256];
15: char name2[256];
16:
17: if (argc != 3) {
18: fprintf(stderr, "usage: %s count name\n", argv[0]);
19: exit(1);
20: }
21: setbuf(stdout, NULL);
22: count = atoi(argv[1]);
23: sprintf(name1, "%s1", argv[2]);
24: sprintf(name2, "%s2", argv[2]);
25: cfail = lfail = u1fail = u2fail = 0;
26: for (i=count; i > 0; i--) {
27: if ((fd = creat(name1, 0666)) < 0) {
28: cfail++;
29: fprintf(stderr, "create ");
30: perror(name1);
31: continue;
32: }
33: close(fd);
34: if (link(name1, name2) < 0) {
35: lfail++;
36: fprintf(stderr, "link %s %s", name1, name2);
37: perror(" ");
38: }
39: if (unlink(name2) < 0) {
40: u1fail++;
41: fprintf(stderr, "unlink %s", name2);
42: perror(" ");
43: }
44: if (unlink(name1) < 0) {
45: u2fail++;
46: fprintf(stderr, "unlink %s", name1);
47: perror(" ");
48: }
49: }
50: fprintf(stdout, "%d tries\n", count);
51: if (cfail) {
52: fprintf(stdout, "%d bad create\n", cfail);
53: }
54: if (lfail) {
55: fprintf(stdout, "%d bad link\n", lfail);
56: }
57: if (u1fail) {
58: fprintf(stdout, "%d bad unlink 1\n", u1fail);
59: }
60: if (u2fail) {
61: fprintf(stdout, "%d bad unlink 2\n", u2fail);
62: }
63: exit(0);
64: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.