Query: flopen
OS: debian
Section: 3
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
FLOPEN(3) BSD Library Functions Manual FLOPEN(3)NAMEflopen -- reliably open and lock a fileLIBRARYUtility functions from BSD systems (libbsd, -lbsd)SYNOPSIS#include <sys/fcntl.h> #include <bsd/libutil.h> int flopen(const char *path, int flags); int flopen(const char *path, int flags, mode_t mode);DESCRIPTIONThe flopen() function opens or creates a file and acquires an exclusive lock on it. It is essentially equivalent with calling open() with the same parameters followed by flock() with an operation argument of LOCK_EX, except that flopen() will attempt to detect and handle races that may occur between opening / creating the file and locking it. Thus, it is well suited for opening lock files, PID files, spool files, mailboxes and other kinds of files which are used for synchronization between processes. If flags includes O_NONBLOCK and the file is already locked, flopen() will fail and set errno to EWOULDBLOCK. As with open(), the additional mode argument is required if flags includes O_CREAT.RETURN VALUESIf successful, flopen() returns a valid file descriptor. Otherwise, it returns -1, and sets errno as described in flock(2) and open(2).SEE ALSOerrno(2), flock(2), open(2)AUTHORSThe flopen function and this manual page were written by Dag-Erling Smorgrav <des@FreeBSD.org>.BSDJune 6, 2009 BSD
Related Man Pages |
---|
flopen(3) - debian |
pidfile(3) - debian |
flock(2) - osf1 |
pidfile_remove(3) - freebsd |
pidfile_write(3) - freebsd |
Similar Topics in the Unix Linux Community |
---|
files |
open files |
too many open files |
Function open() sets errno |