Bugtraq mailing list archives
Re: fcntl() file locking under Solaris 2.4
From: matt () uts EDU AU (Jas)
Date: Wed, 22 Feb 1995 22:49:33 +1100 (EST)
Jas (Matthew K) wrote this...
to all you coders out there be aware file locking behaves differently for NFS file systems under solaris 2.4... be warned doing a ufs file lock on a NFS file makes fcntl() hang.. it doesnt return an error, it hangs. anyway here is a snippet of code that does a work around.. instead of fcntl(fd,F_SETLK,&info); try this.. struct statvfs vfsbuf; cmd=F_SETLK; if(!fstatvfs(fd,&vfsbuf)&&!strcmp("nfs",vfsbuf.f_basetype)) cmd=F_RSETLK; fcntl(fd,cmd,&info); hope this helps.. Matt
ooops i goofed i just realised.. it should have been F_SETLKW and F_RSETLKW, they do an atomic wait and set lock.. but a ufs lock will never occur on a NFS fd, so the net effect is that fcntl(nfsfd,F_SETLKW,&foo) will never return... :| rather agrivating.. i think it would be much better if it returned -1 EINVAL *shrug* Matt -- #!/bin/sh echo '16i[q]sa[ln0=aln100%Pln100/snlbx]sbA0D3F204445524F42snlbxq'|dc;exit Matthew Keenan Systems Programmer Information Technology Division University of Technology Sydney Australia It's nice to be in a position where people apologize because they assume there's humor in your work, based on past experience, but they're not sure where it is. -- Rob Pike
Current thread:
- mail.local.c patch Jon Peatfield (Feb 18)
- MAILING REQUEST Anonymous the XXIIV (Feb 18)
- Re: mail.local.c patch Neil Woods (Feb 18)
- Re: mail.local.c patch Christopher Samuel (Feb 20)
- HP-UX Problem... Mr Martin J Hargreaves (Feb 19)
- Re: HP-UX Problem... Aaron Sherman (Feb 20)
- Re: HP-UX Problem... Andrew Hughes (Feb 20)
- Bugtraq mailing list William B. Chmura (Feb 21)
- fcntl() file locking under Solaris 2.4 Jas (Feb 21)
- Re: fcntl() file locking under Solaris 2.4 Jas (Feb 22)
- snooper watchers Ben Taylor (Feb 22)
- Re: snooper watchers Eric Conrad (Feb 22)
- Re: snooper watchers Ben Taylor (Feb 22)
- CERT Advisory CA-95:05.sendmail.vulnerabilities (fwd) Paul 'Shag' Walmsley (Feb 22)
- Re: CERT Advisory CA-95:05.sendmail.vulnerabilities (fwd) Dave Schweisguth (Feb 23)
- Sendmail 8.6.9 security hole Igor V. Semenyuk (Feb 22)
- Re: Sendmail 8.6.9 security hole Christopher Samuel (Feb 23)
- Re: HP-UX Problem... Aaron Sherman (Feb 20)
- Sun Security Bulletin #129 (sendmail) Mark Graff (Feb 22)
- new sendmail bug? James W. Abendschan (Feb 22)
- Re: new sendmail bug? joel (Feb 22)