rfio_open(3) opens a file

SYNOPSIS

#include <sys/types.h>
#include "rfio_api.h"

int rfio_open (const char *path, int flags, int mode);

Under Linux, for large files:
#define _LARGEFILE64_SOURCE
#include <sys/types.h>
#include "rfio_api.h"

int rfio_open64 (const char *path, int flags, int mode);

For large files, under other systems:
#include <sys/types.h>
#include "rfio_api.h"

int rfio_open64 (const char *path, int flags, int mode);

DESCRIPTION

rfio_open opens the file whose name is the string pointed to by path, a character string containing the filename specification, and associates a FILE stream with it.
flags are formed by ORing the following values:

        O_RDONLY        Open for reading only
        O_WRONLY        Open for writing only
        O_RDWR          Open for reading and writing
        O_NDELAY        Do not block on open
        O_APPEND        Append on each write
        O_CREAT         Create file if it does not exist
        O_TRUNC         Truncate size to 0
        O_EXCL          Error if create and file exists
        O_LARGEFILE     When size can be superior to 2GB-1. 
                        See NOTES


mode specifies the permission bits to be set if the file is created.

Opening a file with O_APPEND set causes each write on the file to be appended to the end. If O_TRUNC is specified and the file exists, the file is truncated to zero length. If O_EXCL is set with O_CREAT, then if the file already exists, the open returns an error. This can be used to implement a simple exclusive access locking mechanism. If O_EXCL is set and the last component of the pathname is a symbolic link, the open will succeed even if the symbolic link points to an existing name. If the O_NDELAY flag is specified and the open call would result in the process being blocked for some reason (for example waiting for a carrier on a dial-up line), the open returns immediately. The first time the process attempts to perform IO on the open file, it will block (not currently implemented). On systems that support the Large Files, O_LARGEFILE in rfio_open allows files whose sizes cannot be represented in 31 bits to be opened.

RETURN VALUE

If successful, returns a non-negative integer which may be used to refer to the file on subsequent rfio_write, rfio_read and rfio_close calls. On failure, rfio_open returns -1 and the error code is stored in serrno.

ERRORS

ENOENT
The named file/directory does not exist or is a null pathname.
EACCES
Search permission is denied on a component of the path prefix.
EBUSY
Device or resource busy. Happens if you try to open in write mode a LCG file that is in an active migration stream.
EFAULT
path is a NULL pointer.
ENOTDIR
A component of path prefix is not a directory.
ENAMETOOLONG
The length of path exceeds CA_MAXPATHLEN or the length of a path component exceeds CA_MAXNAMELEN.
SENOSHOST
Host unknown.
SENOSSERV
Service unknown.
SECOMERR
Communication error.

NOTES

On Irix, Tru64 and IA64 the 64 bit mode is the default one, open and open64 are identical. The flag O_LARGEFILE is accepted on Irix and IA64 (where it has no effect) but not on Tru64. On all other platforms, rfio_open with O_LARGEFILE is equivalent to a call to rfio_open64.

AUTHOR

LCG Grid Deployment Team