Re: dma(8): Fix race condition in multi-recipient delivery

看板DFBSD_submit作者時間16年前 (2009/07/20 02:32), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串8/11 (看更多)
flock locks are effective lockf locks but cover the ENTIRE range. It is not a good idea to try to combine them. Use one or the other. lockf locks (via fcntl) follow POSIX semanics, I believe, which means that when you close() a descriptor, ANY LOCK HELD BY THAT PROCESS ON THAT FILE will also be released, even if it was obtained by another descriptor. This is badly broken but its what POSIX says and what we have to do. If you are fork()ing you want to be sure that you only have one file descriptor open for the file that you intend to maintain a lock on. If you open/close the file within that same process the original lock on the still-open descriptor will be lost. For fcntl-based lockf locks. I believe flock() behaves more rationally. -Matt
文章代碼(AID): #1AOsQf7o (DFBSD_submit)
討論串 (同標題文章)
完整討論串 (本文為第 8 之 11 篇):
文章代碼(AID): #1AOsQf7o (DFBSD_submit)