Path: utzoo!attcan!uunet!smsdpg!seg From: seg@smsdpg.uu.net (Scott Garfinkle) Newsgroups: comp.protocols.nfs Subject: PC-NFS Locking Problem Message-ID: <183@smsdpg.uu.net> Date: 18 Jan 89 17:50:00 GMT Organization: SMS Data Products Group, Reston VA Lines: 52 Has anybody done anything with sharing/locking under DOS 3.x and PC-NGS? The manual specifically states that advisory locking is supported via the standard DOS function calls. However, I wrote the following simple program to test this stuff and found that my requests for locks are completely ignored -- this program, run from two different PC nodes at the same time, returns successfully from acquiring a lock on the same file on out server! Am I missing something? Setup: AT clone and PC clone, both running PC-DOS 3.3 with SHARE installed and PC-NFS v3.0; Server==Sun 3/180 running SunOS 4.0. (PCs are using the WD8003 ethernet cards.) Code for test follows (for MSC5.1) Scott E. Garfinkle SMS Data Products Group, Inc. uunet!smsdpg!seg (smsdpg!seg@uunet.uu.net)( ----------- #include #include #include #include #include #include #include char *cmdname; main(int argc, char **argv) { int fd; long flen; extern int errno; cmdname = *argv; if(argc != 2) { fprintf(stderr,"Usage: %s \n",cmdname); exit(1); } if((fd = sopen(argv[1],O_RDWR,SH_DENYWR)) == -1) { fprintf(stderr,"%s: Couldn't open %s for read/write, errno=%d.\n", cmdname,argv[1],errno); exit(2); } printf("Opened %s for read/write in Deny Write mode.\nHit any key to continue.", argv[1]); fflush(stdout); (void) getch(); putch('\n'); putch('\r'); flen = filelength(fd); if(locking(fd,LK_LOCK,flen)) { fprintf(stderr,"%s: Failed to lock %ld bytes, errno=%d.\n", cmdname,flen,errno); exit(3); } printf("Locked %ld bytes. Hit any key to continue.", flen); fflush(stdout); (void) getch(); exit(locking(fd,LK_UNLCK,flen)); }