The OpenNET Project / Index page

[ новости /+++ | форум | теги | ]

Интерактивная система просмотра системных руководств (man-ов)

 ТемаНаборКатегория 
 
 [Cписок руководств | Печать]

flopen (3)
  • >> flopen (3) ( FreeBSD man: Библиотечные вызовы )

  • BSD mandoc
     

    NAME

    
    
    flopen
    
     - Reliably open and lock a file
    
     
    

    LIBRARY

    Lb libutil
    
     
    

    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 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)  

    HISTORY

    The flopen ();
    function first appeared in Fx 6.3 .  

    AUTHORS

    An -nosplit The function and this manual page were written by An Dag-Erling Sm/orgrav Aq [email protected] .


     

    Index

    NAME
    LIBRARY
    SYNOPSIS
    DESCRIPTION
    RETURN VALUES
    SEE ALSO
    HISTORY
    AUTHORS


    Поиск по тексту MAN-ов: 




    Партнёры:
    PostgresPro
    Inferno Solutions
    Hosting by Hoster.ru
    Хостинг:

    Закладки на сайте
    Проследить за страницей
    Created 1996-2024 by Maxim Chirkov
    Добавить, Поддержать, Вебмастеру