tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: flock(2): locking against itself?



>      Locks are on files, not file descriptors.

Except they aren't.  They're on open file table entries, something
remarkably difficult to describe in a way that doesn't just refer to
the kernel-internal mechanism behind it (which for _this_ list isn't a
big deal, but...).  If they were truly on files, rather than open file
table entries, then it wouldn't matter whether my test program opened
the file once or twice, since it's the same file either way.

> Applying flock() to an already locked (of this kernel file*) file is
> an attempt to upgrade, or downgrade (including unlock) the file,

Hm, okay, I can see how the second flock call in my test was taken as
an attempt to equalgrade (neither upgrade nor downgrade) the exclusive
lock to another exclusive lock.

I'll have to think more about my locking paradigm.

/~\ The ASCII				  Mouse
\ / Ribbon Campaign
 X  Against HTML		mouse%rodents-montreal.org@localhost
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B


Home | Main Index | Thread Index | Old Index