libowfat Documentation - open.a

open_append - open a file for appending
open_excl - open a file for exclusive writing
open_read - open a file for reading
open_trunc - open a file for writing
open_write - open a file for writing

Table of Contents

Synopsis

#include <open.h>
extern int open_append(const char *filename); extern int open_excl(const char *filename); extern int open_read(const char *filename); extern int open_trunc(const char *filename); extern int open_write(const char *filename);

Description

open_append opens the file filename for appending write-only use and returns the file handle. If it does not exist, it will be created with mode 0600. If there was an error opening or creating the file, open_append returns -1 and sets errno accordingly. All write operations will append after the last byte, regardless of previous calls to lseek(2) or other processes also appending to the same file.

open_excl opens the file filename for writing and returns the file handle. 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 reliably 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).

open_read opens the file filename for reading and returns the file handle. If there was an error opening the file, open_read returns -1 and sets errno accordingly.

open_trunc opens the file filename for write-only use and returns the file handle. If the file exists, it will be truncated to zero bytes length. If it does not exist, it will be created with mode 0644. If there was an error opening or creating the file, open_trunc returns -1 and sets errno accordingly.

open_write opens the file filename for write-only use and returns the file handle. If the file does not exist, it will be created with mode 0644. If there was an error opening or creating the file, open_write returns -1 and sets errno accordingly.

Tino Reichardt <der@mcmilk.de>, Felix von Leitner <der@fefe.de>
Version: 5.2, Date: 2001/05/26