Re: fcntl always fails to delete lock file, and PID is always -6464

[ Available lists | Index of freebsd-fs | Month of Oct 2010 | Week of 5 Oct 2010 | Raw email | View thread | Wrap long lines | Reply | Tag ]
From
Daichi GOTO <daichi@ongs.co.jp>
Date
5 Oct 2010 08:55:37
Subject
Re: fcntl always fails to delete lock file, and PID is always -6464
Message-ID
20101005175536.a67998ae.daichi@ongs.co.jp


[ Hide this part ]
On Tue, 5 Oct 2010 01:23:02 -0700
Garrett Cooper <gcooper@FreeBSD.org> wrote:
> 2010/10/4 Daichi GOTO <daichi@ongs.co.jp>:
> > Thanks nice test tool :) And at last I got it excepting one mystery!
> >
> > On Mon, 4 Oct 2010 20:17:08 -0700
> > Garrett Cooper <gcooper@FreeBSD.org> wrote:
> >> Following through the same process on FreeBSD...
> >>
> >> Window 1:
> >> $ ls -l /tmp/lockfile
> >> ls: /tmp/lockfile: No such file or directory
> >> $ ./test_fcntl
> >>
> >> Window 2:
> >>
> >> $ ls -l /tmp/lockfile
> >> -rwsr-x--- 1 garrcoop wheel 0 Oct 4 20:14 /tmp/lockfile
> >> $ ./test_fcntl
> >> test_fcntl: fcntl: Resource temporarily unavailable
> >
> > Just my mystery is as follow:
> >
> > Windows 1:
> > % ./test_fcntl
> > My pid: 43490
> >
> > Windows 2:
> > % ls -l /tmp/lockfile
> > -r-sr-x--- 1 daichi wheel 0 10 5 15:02 /tmp/lockfile <--- is it weird, isn't it?
> > % ./test_fcntl
> > test_fcntl: open: Permission denied
> > %
> >
> > Oops... What's wrong... /tmp is as follow:
> >
> > % mount | grep tmp
> > /dev/ada0s1f on /tmp (ufs, local, noatime, soft-updates)
> > % dumpfs /tmp | grep journal
> > flags soft-updates+journal
> > %
> >
> > And working scene:
> >
> > Windows 2:
> > % chmod u+w /tmp/lockfile
> > % ls -l /tmp/lockfile
> > -rwsr-x--- 1 daichi wheel 0 10 5 15:22 /tmp/lockfile
> > % ./test_fcntl
> > My pid: 43646
> > test_fcntl: fcntl[1]: Resource temporarily unavailable
> > PID=43490 has the lock
> > %
>
> What's your umask and what are the permissions on /tmp?

% ll / | grep tmp
drwxrwxrwt 14 root wheel 1024 10 5 17:19 tmp
% umask
022
% rm -f test
% touch test
% ll | grep test
-rw-r--r-- 1 daichi wheel 0 10 5 17:52 test
%

Elapsed time: 0.390 seconds