diff --git a/doc/ddlp.txt b/doc/ddlp.txt index 69763a5..4635f5c 100644 --- a/doc/ddlp.txt +++ b/doc/ddlp.txt @@ -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 diff --git a/test/open-cd-excl.c b/test/open-cd-excl.c index 80efae0..fffe4d0 100644 --- a/test/open-cd-excl.c +++ b/test/open-cd-excl.c @@ -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");