Here are some suggestions for improvements of the perl "flock" function:
1. It would be nice if "flock" did a flush.
I can't see why it shouldn't and it would make it easier to use. (cf recent problems of Lee Daniel Crocker).
2. On systems with F_SETLK/F_SETLKW it would be nice if "flock" used them instead of "lockf" for emulating "flock". This would allow differentiation of LOCK_SH and LOCK_EX (F_RDLCK and F_WRLCK).
3. If (2) was done why couldn't we add some extra arguments to "flock" to let it use the extra facilities of F_SETLK/F_SETLKW:
flock FILEHANDLE, type [ , len [ , offset [ , whence ]]]
len = length to lock, default = 0 => up to eof
offset = lock from here, default = 0
whence = see seek, default = SEEK_SET
On systems with flock instead of F_SETLK/F_SETLKW the 3 new arguments would have no effect (appart for error checking of course).
--
John Hughes <john@AtlanTech.COM> or <JH10@CalvaCom.FR>,
Atlantic Technologies Inc. Tel: +33-1-43204546
24 rue Montbrun, Fax: +33-1-43204579
75014 PARIS.
1. It would be nice if "flock" did a flush.
I can't see why it shouldn't and it would make it easier to use. (cf recent problems of Lee Daniel Crocker).
2. On systems with F_SETLK/F_SETLKW it would be nice if "flock" used them instead of "lockf" for emulating "flock". This would allow differentiation of LOCK_SH and LOCK_EX (F_RDLCK and F_WRLCK).
3. If (2) was done why couldn't we add some extra arguments to "flock" to let it use the extra facilities of F_SETLK/F_SETLKW:
flock FILEHANDLE, type [ , len [ , offset [ , whence ]]]
len = length to lock, default = 0 => up to eof
offset = lock from here, default = 0
whence = see seek, default = SEEK_SET
On systems with flock instead of F_SETLK/F_SETLKW the 3 new arguments would have no effect (appart for error checking of course).
--
John Hughes <john@AtlanTech.COM> or <JH10@CalvaCom.FR>,
Atlantic Technologies Inc. Tel: +33-1-43204546
24 rue Montbrun, Fax: +33-1-43204579
75014 PARIS.