file-create-locked.h revision 715fa0c143cf457c94bbac7554767c28413cf680
c6a57378d3c54988f525f81e19c0c5d132a0770dTimo Sirainen /* 0 = try locking without waiting */
c6a57378d3c54988f525f81e19c0c5d132a0770dTimo Sirainen /* 0 = 0600 */
c6a57378d3c54988f525f81e19c0c5d132a0770dTimo Sirainen /* 0 = default */
c6a57378d3c54988f525f81e19c0c5d132a0770dTimo Sirainen /* 0 = default */
f7539a17ea306191b53b8f5e752e228937df9ec3Timo Sirainen/* Either open an existing file and lock it, or create the file locked.
f7539a17ea306191b53b8f5e752e228937df9ec3Timo Sirainen The creation is done by creating a temp file and link()ing it to path.
f7539a17ea306191b53b8f5e752e228937df9ec3Timo Sirainen If link() fails, opening is retried again. Returns fd on success,
f7539a17ea306191b53b8f5e752e228937df9ec3Timo Sirainen -1 on error. errno is preserved for the last failed syscall, so most
f7539a17ea306191b53b8f5e752e228937df9ec3Timo Sirainen importantly ENOENT could mean that the directory doesn't exist and EAGAIN
f7539a17ea306191b53b8f5e752e228937df9ec3Timo Sirainen means locking timed out. */
2615df45a8027948a474abe5e817b34b0499c171Timo Sirainenint file_create_locked(const char *path, const struct file_create_settings *set,
2615df45a8027948a474abe5e817b34b0499c171Timo Sirainen const char **error_r);