mirror of
https://git.FreeBSD.org/ports.git
synced 2024-11-11 23:25:17 +00:00
37 lines
1.6 KiB
Plaintext
37 lines
1.6 KiB
Plaintext
|
|
This is my first alpha release of File::Lock, my version of the code
|
|
greatfully provided by Jarrko. I've mucked about with it quite a bit,
|
|
and there are a few policy decisions you might not agree with:
|
|
|
|
All of the locking functions (see t/* for full details),
|
|
File::lock::(lockf/flock/fcntl) are not exported from File::Lock. They all
|
|
take the same set of arguments: FileHandle, mode, pos, whence, length.
|
|
(Except for lockf, which doesn't take the position arguments.) Mode is two
|
|
characters, and can be "wb" for write-lock/non-blocking, or "rn", for
|
|
read-lock/blocking. Most other characters will work fine. (Look in typemap)
|
|
pos, whence, and length default to "the whole file". Use "u" to unlock a
|
|
handle.
|
|
|
|
The only OO interface is via "new File::Lock()" which uses
|
|
File::Lock::fcntl. If it were working properly, then the lock would be
|
|
unlocked on destruction. But it isn't.
|
|
|
|
File::Lock::lockfile isn't written yet, but will be.
|
|
|
|
You can use a mode of "t" or "i" to get info/test a lock. fcntl in array context
|
|
will return an array consisting of all the usual fcntl data. In any other case, a single
|
|
letter is returned, "u", "w", or "r", for the detected locking mode. (or unlocked.)
|
|
|
|
All calls return true if successful. Currently no mucking about with errno is done, so it
|
|
might not be the same for the same condition on all systems.
|
|
|
|
If you need real fcntl() and it's constants, use Fcntl. File::Lock does
|
|
optionally export SEEK_*, and LOCK_EX|UN|SH, though. (I don't remember why,
|
|
though, on the latter.)
|
|
|
|
Any comments, complaints, or bug patches would be greatly appreciated.
|
|
|
|
--
|
|
Kenneth Albanowski (kjahds@kjahds.com, CIS: 70705,126)
|
|
|