1RFIO_OPEN(3) Rfio Library Functions RFIO_OPEN(3)
2
3
4
6 rfio_open - opens a file
7
9 #include <sys/types.h>
10 #include "rfio_api.h"
11
12 int rfio_open (const char *path, int flags, int mode);
13
14 Under Linux, for large files:
15 #define _LARGEFILE64_SOURCE
16 #include <sys/types.h>
17 #include "rfio_api.h"
18
19 int rfio_open64 (const char *path, int flags, int mode);
20
21 For large files, under other systems:
22 #include <sys/types.h>
23 #include "rfio_api.h"
24
25 int rfio_open64 (const char *path, int flags, int mode);
26
28 rfio_open opens the file whose name is the string pointed to by path, a
29 character string containing the filename specification, and associates
30 a FILE stream with it.
31 flags are formed by ORing the following values:
32
33 O_RDONLY Open for reading only
34 O_WRONLY Open for writing only
35 O_RDWR Open for reading and writing
36 O_NDELAY Do not block on open
37 O_APPEND Append on each write
38 O_CREAT Create file if it does not exist
39 O_TRUNC Truncate size to 0
40 O_EXCL Error if create and file exists
41 O_LARGEFILE When size can be superior to 2GB-1.
42 See NOTES
43
44 mode specifies the permission bits to be set if the file is created.
45
46 Opening a file with O_APPEND set causes each write on the file to be
47 appended to the end. If O_TRUNC is specified and the file exists, the
48 file is truncated to zero length. If O_EXCL is set with O_CREAT, then
49 if the file already exists, the open returns an error. This can be
50 used to implement a simple exclusive access locking mechanism. If
51 O_EXCL is set and the last component of the pathname is a symbolic
52 link, the open will succeed even if the symbolic link points to an
53 existing name. If the O_NDELAY flag is specified and the open call
54 would result in the process being blocked for some reason (for example
55 waiting for a carrier on a dial-up line), the open returns immediately.
56 The first time the process attempts to perform IO on the open file, it
57 will block (not currently implemented). On systems that support the
58 Large Files, O_LARGEFILE in rfio_open allows files whose sizes cannot
59 be represented in 31 bits to be opened.
60
61
63 If successful, returns a non-negative integer which may be used to
64 refer to the file on subsequent rfio_write, rfio_read and rfio_close
65 calls. On failure, rfio_open returns -1 and the error code is stored
66 in serrno.
67
68
70 ENOENT The named file/directory does not exist or is a null path‐
71 name.
72
73 EACCES Search permission is denied on a component of the path
74 prefix.
75
76 EBUSY Device or resource busy. Happens if you try to open in
77 write mode a LCG file that is in an active migration
78 stream.
79
80 EFAULT path is a NULL pointer.
81
82 ENOTDIR A component of path prefix is not a directory.
83
84 ENAMETOOLONG The length of path exceeds CA_MAXPATHLEN or the length of
85 a path component exceeds CA_MAXNAMELEN.
86
87 SENOSHOST Host unknown.
88
89 SENOSSERV Service unknown.
90
91 SECOMERR Communication error.
92
94 Castor_limits(4),rfio_write(3),rfio_read(3),rfio_close(3)
95
97 On Irix, Tru64 and IA64 the 64 bit mode is the default one, open and
98 open64 are identical. The flag O_LARGEFILE is accepted on Irix and IA64
99 (where it has no effect) but not on Tru64. On all other platforms,
100 rfio_open with O_LARGEFILE is equivalent to a call to rfio_open64.
101
103 LCG Grid Deployment Team
104
105
106
107
108LCG $Date: 2005/03/31 13:13:03 $ RFIO_OPEN(3)