Adaptations to new test results and discussions

This commit is contained in:
Thomas Schmitt 2007-04-18 21:31:21 +00:00
parent 256139c9d6
commit 96098b3f2d
2 changed files with 5 additions and 9 deletions

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

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");