mbox-lock.c revision a0a763f0361201d1ef354f7a2bfa2fa0e53af402
1057N/A/* Copyright (C) 2002 Timo Sirainen */ 660N/A/* assume stale dotlock if mbox file hasn't changed for 5 seconds */ 2506N/A/* abort trying to get lock after 30 seconds */ 2557N/A/* remove lock after 10 mins */ 2095N/A /* don't bother with the temp files as we'd just leave them lying 2095N/A around. besides, postfix also relies on O_EXCL working so we 2095N/A /* lock exists, see if it's too old */ 2095N/A /* see if there's been any changes in mbox */ 2557N/A /* no changes for a while, assume stale lock */ 2557N/A /* make .lock file first to protect overwriting the file */ 2095N/A /* now we need to have the file itself locked. open it if needed. */ 2437N/A /* make sure we don't keep mmap() between locks - there could have 2437N/A been changes to file size which would break things. or actually 2543N/A it'd break only if file was shrinked+grown back to exact size,