From: Jean-Pol.Guillement@math.univ-nantes.fr (Jean-Pol Guillement)
Subject: lockf and nfs files
Date: Thu, 06 Nov 2003 15:00:18 +0100 (MET) [thread overview]
Message-ID: <200311061400.PAA31269@lebesgue.math.univ-nantes.fr> (raw)
Dear managers,
Can somebody explain me the behavior of the lockf function
on a Tru64, 4.0F, Alpha-server 1000A with NFS mounted files ?
The following is a part of a program named testlock:
...
if ((fd=open(atester,O_WRONLY)) < 0) {
printf("impossible ouvrir %s.\n",atester);
exit(1);
}
t=lockf(fd,F_TEST,0);
if (t) {
printf("%s est locke',\nt=%d,errno = %d\n",
atester,t,errno);
printf("EBADF=%d,EACCES=%d,EAGAIN=%d,EDEADLK=%d\n\
EINTR=%d,EINVAL=%d,EOPNOTSUPP=%d\n",
EBADF,EACCES,EAGAIN,EDEADLK,EINTR,EINVAL,
EOPNOTSUPP);
} else {
printf("%s pas locke'.\n",atester);
}
...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
test 1:
touch /tmp/e; chmod 600 /tmp/e; testlock -> not locked
(and the same on any not nfs mounted file).
test 2:
/usr/users/namath is an nfs mounted directory from a linux box
by the following fstab (lebesgue) entry
/usr/users/namath@condorcet /usr/users/namath nfs
rw,bg,rsize=8192,wsize=8192,hard,intr,nfsvers=3 0 0
and the exports line on the linux system (condorcet)
/usr/users/namath lebesgue(rw,no_root_squash)
cd /usr/users/namath/myhome
touch e; chmod 600 e; testlock -> locked (errno=EACCES)
chmod 640 e; testlock -> locked (errno=EACCES)
chmod 644 e; testlock -> not locked
test 3:
On an other linux box, on the same nfs mounted directory,
testlock gives always not locked.
Thanks in advance,
Jean-Pol Guillement
reply other threads:[~2003-11-06 14:00 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox