On Sat, 05.09.09 19:11, Florian Zumbiehl (florz@xxxxxxxx) wrote: > > All Unix locking APIs are broken in one way or the other. But if you > > use one then at least use fcntl(F_SETLK) which is the least broken. > > What exactly is broken in flock() (that affects this use)? The simple fact that fcntl() style locks are the ones that are least broken and using everything else is confusing since the different lock styles are independant of each other. So if you do use locking then use fcntl. Now, fcntl is broken in many ways. For example it is unusable for files that are accessible for other users. It is bound to a process and not to an fd, and hence useless in threads, and in libraries. The first close() breaks all locks of a process on a file even if it has more fds open to it. In this case you might be able to get away with a lot, but still that leaves that fcntl is POSIX and the least broken and is the only flavour of locking that should be used these days. Lennart -- Lennart Poettering Red Hat, Inc. lennart [at] poettering [dot] net http://0pointer.net/lennart/ GnuPG 0x1A015CC4 -- To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html