Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
open_excl(3)		   Library Functions Manual		  open_excl(3)

NAME
       open_excl - open	a file for exclusive writing

SYNTAX
       #include	<libowfat/open.h>

       int open_excl(const char	*filename);

DESCRIPTION
       open_excl opens the file	filename for writing and returns the file han-
       dle.   The  file	 may not exist before the call to open_excl.  The file
       will be created with mode 0600.

       If there	was an error creating the file,	open_excl returns -1 and  sets
       errno accordingly.

       Since open_excl relies on the O_EXCL flag to open, it does not work re-
       liably over NFS (the NFS	protocol is broken) and	must be	emulated using
       a  lock	file  (create a	file with a unique file	name and link(2) it to
       the lock	file.  Then stat the lock file and see if the  link  count  is
       2).

SEE ALSO
       open(2),	  open_append(3),   open_read(3),  open_rw(3),	open_trunc(3),
       open_write(3), openreadclose(3),	readclose(3), readclose_append(3)

								  open_excl(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=libowfat_open_excl&sektion=3&manpath=FreeBSD+Ports+14.3.quarterly>

home | help