Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84 exptools; site ihlpg.UUCP Path: utzoo!linus!decvax!bellcore!petrus!sabre!zeta!epsilon!gamma!ulysses!mhuxr!mhuxn!ihnp4!ihlpg!jchvr From: jchvr@ihlpg.UUCP (VanRietschote) Newsgroups: net.sources Subject: MKLOCK prgrm to create lock file against concurrent accesses Message-ID: <1538@ihlpg.UUCP> Date: Tue, 7-Jan-86 13:30:22 EST Article-I.D.: ihlpg.1538 Posted: Tue Jan 7 13:30:22 1986 Date-Received: Wed, 8-Jan-86 08:07:24 EST Distribution: net Organization: AT&T Bell Laboratories Lines: 38 --- mklock will create a lock file which can be tested against to disallow the concurrent access to a shared resource. It is simple but does the trick. For more info see next news item with manual page. Feel free to use or abuse this program at your own risk. --- cut here --- /* mklock.c to create .lock file -*-update-version-*- * HFVR VERSION=Thu Apr 11 10:39:33 1985 * Usage: mklock file */ #include main(argc,argv) int argc; char *argv[]; { int f; if (argc != 2) { fprintf(stderr,"\007%s: exactly one argument expected\n",argv[0]); exit(1); }/*fi*/ if ((strcmp(argv[1],"-?") == 0)) { fprintf(stderr,"%s creates lock file. Usage: %s file.\n",argv[0],argv[0]); exit(1); }/*fi*/ if ((f = creat(argv[1],0)) < 0) { fprintf(stderr,"\007%s: ",argv[0]); perror(""); exit(1); } else { close(f); exit(0); }/*fi*/ }