GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  FLOPEN (3)

NAME

flopen - Reliably open and lock a file

CONTENTS

Library
Synopsis
Description
Return Values
See Also
Authors

LIBRARY


.Lb libutil

SYNOPSIS


.In sys/fcntl.h
.In 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 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 VALUES

If successful, flopen returns a valid file descriptor. Otherwise, it returns -1, and sets errno as described in flock(2) and open(2).

SEE ALSO

errno(2), flock(2), open(2)

AUTHORS


.An -nosplit The flopen function and this manual page were written by
.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org .
Search for    or go to Top of page |  Section 3 |  Main Index


Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.