.\" This manpage has been automatically generated by docbook2man
.\" from a DocBook document. This tool can be found at:
.\"
.\" Please send any bug reports, improvements, comments, patches,
.\" etc. to Steve Cheng .
.TH "GFS_PIO_OPEN" "3" "27 June 2010" "Gfarm" ""
.SH NAME
gfs_pio_open \- open a file in the Gfarm file system
.SH SYNOPSIS
.sp
\fB#include
.sp
gfarm_error_t gfs_pio_open (const char * \fIgfarm_url\fB, int \fIflags\fB, GFS_File * \fIgfp\fB);
\fR
.SH "DESCRIPTION"
.PP
\fBgfs_pio_open()\fR opens a file in the Gfarm
file system specified by \fIgfarm_url\fR,
and returns a \fIGFS_File\fR structure
to the address pointed by \fIgfp\fR\&.
\fIgfarm_url\fR is a path name in the Gfarm file
system, or a Gfarm URL in the form of gfarm://metaserver:port/path/name.
.PP
Values of \fIflags\fR are constructed by a
bitwise-inclusive-OR of the following list. Exactly one of the first
three values should be specified:
.TP
\fBGFARM_FILE_RDONLY\fR
Open for reading only.
.TP
\fBGFARM_FILE_WRONLY\fR
Open for writing only.
.TP
\fBGFARM_FILE_RDWR\fR
Open for reading and writing.
.TP
\fBGFARM_FILE_TRUNC\fR
If the file already exist and is a regular file, it will be
truncated to length 0 if the open mode allows writing.
.SH "RETURN VALUES"
.TP
\fBGFARM_ERR_NO_ERROR\fR
The function terminated successfully.
.TP
\fBGFARM_ERR_IS_A_DIRECTORY\fR
\fIgfarm_url\fR refers to a directory.
.TP
\fBGFARM_ERR_IS_A_SYMBOLIC_LINK\fR
\fIgfarm_url\fR refers to a symbolic link.
.TP
\fBGFARM_ERR_OPERATION_NOT_PERMITTED\fR
\fIgfarm_url\fR refers to not a regular file.
.TP
\fBGFARM_ERR_NO_SUCH_OBJECT\fR
A component used as a directory in \fIgfarm_url\fR does not exist.
.TP
\fBGFARM_ERR_NOT_A_DIRECTORY\fR
A component used as a directory in \fIgfarm_url\fR is not, in fact, a
directory.
.TP
\fBGFARM_ERR_PERMISSION_DENIED\fR
The requested access to the file is not allowed, or one of the
directories in \fIgfarm_url\fR did not allow search (execute)
permission. Or, the authentication to the metadata server fails.
.TP
\fBGFARM_ERR_NO_MEMORY\fR
Insufficient memory was available.
.TP
\fBGFARM_ERR_INVALID_ARGUMENT\fR
\fIflags\fR
is not valid.
.TP
\fBGFARM_ERR_GFARM_URL_HOST_IS_MISSING\fR
\fIgfarm_url\fR
does not include a metadata server.
.TP
\fBGFARM_ERR_GFARM_URL_PORT_IS_MISSING\fR
\fIgfarm_url\fR
does not include a port number of the metadata server.
.TP
\fBGFARM_ERR_UNKNOWN_HOST\fR
The metadata server cannot be resolved.
.TP
\fBGFARM_ERR_TOO_MANY_OPEN_FILES\fR
The process opens too many files.
.TP
\fBGFARM_ERR_TOO_MANY_OPEN_FILES_IN_SYSTEM\fR
The system limit on the total number of open files has been reached.
.TP
\fBGFARM_ERR_NETWORK_IS_UNREACHABLE\fR
Network is unrechable.
.TP
\fBGFARM_ERR_OPERATION_TIMED_OUT\fR
Connetion timeout occurs.
.TP
\fBGFARM_ERR_PROTOCOL\fR
Protocol error occurs.
.TP
\fBGFARM_ERR_BROKEN_PIPE\fR
Connection to the metadata server is broken.
.TP
\fBGFARM_ERR_PROTOCOL_NOT_SUPPORTED\fR
Specified authentication protocol is not supported.
.TP
\fBGFARM_ERR_AUTHENTICATION\fR
User authentication failed when connecting to the metadata server.
.TP
\fBOthers\fR
An error except the above occurred. The reason is shown by
\fBgfarm_error_string\fR(3)\&.
.SH "SEE ALSO"
.PP
\fBgfs_pio_close\fR(3),
\fBgfs_pio_create\fR(3),
\fBgfs_pio_eof\fR(3),
\fBgfs_pio_error\fR(3),
\fBgfs_pio_flush\fR(3),
\fBgfs_pio_getc\fR(3),
\fBgfs_pio_getline\fR(3),
\fBgfs_pio_open\fR(3),
\fBgfs_pio_putc\fR(3),
\fBgfs_pio_putline\fR(3),
\fBgfs_pio_puts\fR(3),
\fBgfs_pio_read\fR(3),
\fBgfs_pio_seek\fR(3),
\fBgfs_pio_ungetc\fR(3),
\fBgfs_pio_write\fR(3)