Create or open files


Detailed Description

The open family of functions provide wrappers around open(2) with different flags.


Functions

int open_append (const char *filename)
 open file in append mode
int open_excl (const char *filename)
 open file exclusively
int open_read (const char *filename)
 open file for reading
int open_rw (const char *filename)
 open file for reading and writing
int open_trunc (const char *filename)
 open and truncate file for reading and writing
int open_write (const char *filename)
 open file for writing


Function Documentation

int open_append ( const char *  filename  ) 

open file in append mode

Parameters:
filename file to open
Returns:
filedescriptor on success, -1 otherwise with errno set
See also:
Create or open files

Definition at line 21 of file open_append.c.

00022 {
00023         return open(filename, O_WRONLY|O_NONBLOCK|O_APPEND|O_CREAT, 0666);
00024 }

int open_excl ( const char *  filename  ) 

open file exclusively

Parameters:
filename file to open
Returns:
filedescriptor on success, -1 otherwise with errno set
See also:
Create or open files

Definition at line 21 of file open_excl.c.

00022 {
00023         return open(filename, O_WRONLY|O_NONBLOCK|O_CREAT|O_EXCL, 0666);
00024 }

int open_read ( const char *  filename  ) 

open file for reading

Parameters:
filename file to open
Returns:
filedescriptor on success, -1 otherwise with errno set
See also:
Create or open files

Definition at line 21 of file open_read.c.

Referenced by chroot_mkdirp(), chroot_secure_chdir(), and mkdirp().

00022 {
00023         return open(filename, O_RDONLY|O_NONBLOCK);
00024 }

int open_rw ( const char *  filename  ) 

open file for reading and writing

Parameters:
filename file to open
Returns:
filedescriptor on success, -1 otherwise with errno set
See also:
Create or open files

Definition at line 21 of file open_rw.c.

00022 {
00023         return open(filename, O_RDWR|O_NONBLOCK|O_CREAT, 0666);
00024 }

int open_trunc ( const char *  filename  ) 

open and truncate file for reading and writing

Parameters:
filename file to open
Returns:
filedescriptor on success, -1 otherwise with errno set
See also:
Create or open files

Definition at line 21 of file open_trunc.c.

00022 {
00023         return open(filename, O_WRONLY|O_NONBLOCK|O_CREAT|O_TRUNC, 0666);
00024 }

int open_write ( const char *  filename  ) 

open file for writing

Parameters:
filename file to open
Returns:
filedescriptor on success, -1 otherwise with errno set
See also:
Create or open files

Definition at line 21 of file open_write.c.

00022 {
00023         return open(filename, O_WRONLY|O_NONBLOCK|O_CREAT, 0666);
00024 }


Generated on Tue Jun 19 20:38:45 2007 for lucid by  doxygen 1.5.2