Browse Source

Adaptations to new test results and discussions

ZeroThreeEight
Thomas Schmitt 14 years ago
parent
commit
96098b3f2d
2 changed files with 5 additions and 9 deletions
  1. +2
    -1
      doc/ddlp.txt
  2. +3
    -8
      test/open-cd-excl.c

+ 2
- 1
doc/ddlp.txt View File

@ -154,7 +154,8 @@ device files with combinations of read-write, O_EXCL, and fcntl().
(This does not mean that Ted endorsed our project yet. He helps exploring.)
Friendly in the sense of DDLP-A would be any run which uses at least one of
the options -e (i.e. O_EXCL) or -f (i.e. F_SETLK).
the options -e (i.e. O_EXCL) or -f (i.e. F_SETLK, applied to a file
descriptor which was obtained from a standard device file path).
The code is available under GPL at
http://libburnia.pykix.org/browser/libburn/trunk/test/open-cd-excl.c?format=txt
To be compiled by


+ 3
- 8
test/open-cd-excl.c View File

@ -109,16 +109,10 @@ int main(int argc, char **argv)
printf("fcntl lock apparently %sLOCKED\n",
(fl.l_type == F_UNLCK) ? "NOT " : "");
/* ts A70418: do not try to lock if it is already locked */
if (fl.l_type != F_UNLCK) {
printf("failed\n");
exit(1);
}
init_flock(&fl, do_rdwr);
printf("Trying to grab fcntl lock...\n");
if (fcntl(fd, F_SETLKW, &fl) < 0) {
perror("fcntl: F_SETLKW: ");
if (fcntl(fd, F_SETLK, &fl) < 0) {
perror("fcntl: F_SETLK: ");
printf("failed\n");
exit(1);
}
@ -127,6 +121,7 @@ int main(int argc, char **argv)
/* ts A70417: added end_immediately */
printf("Holding %s open.\n", device_name);
usleep(100000);
if (end_immediately)
exit(0);
printf("Press ^C to exit.\n");


Loading…
Cancel
Save