Lines Matching refs:lfp
156 int lfp; in lock_is_real() local
161 lfp = open(lockfile, O_RDONLY); in lock_is_real()
162 if (lfp < 0) { in lock_is_real()
169 count = read(lfp, pid_buf, sizeof(pid_buf)-1); in lock_is_real()
174 close(lfp); in lock_is_real()
177 close(lfp); in lock_is_real()
206 int lfp = -1; in lock_pid_file() local
216 lfp = open(lockfile, O_RDWR | O_CREAT | O_EXCL, 0644); in lock_pid_file()
217 if (lfp < 0) { in lock_pid_file()
237 written = write(lfp, pid_buf, towrite); in lock_pid_file()
239 lfp = open(lockfile, O_RDWR | O_CREAT, 0644); in lock_pid_file()
240 if (lfp < 0) { in lock_pid_file()
247 if (-1 == flock(lfp, LOCK_EX | LOCK_NB)) { in lock_pid_file()
251 close(lfp); in lock_pid_file()
256 close(lfp); in lock_pid_file()
262 if (-1 == ftruncate(lfp, 0)) { in lock_pid_file()
266 close(lfp); in lock_pid_file()
272 written = write(lfp, pid_buf, towrite); in lock_pid_file()
278 } else if (-1 == fsync(lfp)) { in lock_pid_file()
286 close(lfp); in lock_pid_file()
291 lock_pid_file_fd = lfp; in lock_pid_file()