OLD | NEW |
1 /* | 1 /* |
2 ** This file implements a simple command-line utility that shows all of the | 2 ** This file implements a simple command-line utility that shows all of the |
3 ** Posix Advisory Locks on a file. | 3 ** Posix Advisory Locks on a file. |
4 ** | 4 ** |
5 ** Usage: | 5 ** Usage: |
6 ** | 6 ** |
7 ** showlocks FILENAME | 7 ** showlocks FILENAME |
8 ** | 8 ** |
9 ** To compile: gcc -o showlocks showlocks.c | 9 ** To compile: gcc -o showlocks showlocks.c |
10 */ | 10 */ |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 fd = open(argv[1], O_RDWR, 0); | 55 fd = open(argv[1], O_RDWR, 0); |
56 if( fd<0 ){ | 56 if( fd<0 ){ |
57 fprintf(stderr, "%s: cannot open %s\n", argv[0], argv[1]); | 57 fprintf(stderr, "%s: cannot open %s\n", argv[0], argv[1]); |
58 return 1; | 58 return 1; |
59 } | 59 } |
60 cnt = showLocksInRange(fd, 0, MX_LCK); | 60 cnt = showLocksInRange(fd, 0, MX_LCK); |
61 if( cnt==0 ) printf("no locks\n"); | 61 if( cnt==0 ) printf("no locks\n"); |
62 close(fd); | 62 close(fd); |
63 return 0; | 63 return 0; |
64 } | 64 } |
OLD | NEW |