flopen man page on DragonFly

Man page or keyword search:  
man Server   44335 pages
apropos Keyword Search (all sections)
Output format
DragonFly logo
[printable version]

FLOPEN(3)		 BSD Library Functions Manual		     FLOPEN(3)

NAME
     flopen — Reliably open and lock a file

LIBRARY
     System Utilities Library (libutil, -lutil)

SYNOPSIS
     #include <sys/fcntl.h>
     #include <libutil.h>

     int
     flopen(const char *path, int flags);

     int
     flopen(const char *path, int flags, mode_t mode);

DESCRIPTION
     The 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 an fcntl() F_SETLK or F_SETLKW operation with
     lock type F_WRLCK, 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 VALUES
     If successful, flopen() returns a valid file descriptor.  Otherwise, it
     returns -1, and sets errno as described in fcntl(2) and open(2).

SEE ALSO
     errno(2), fcntl(2), open(2)

HISTORY
     The flopen() function first appeared in FreeBSD 6.3.

AUTHORS
     The flopen function and this manual page were written by Dag-Erling
     Smørgrav ⟨des@FreeBSD.org⟩.

BSD			       December 27, 2008			   BSD
[top]

List of man pages available for DragonFly

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net