vxfs_nattr_open - open a named data stream
cc -I /opt/VRTS/include -L /opt/VRTS/lib-l vxfsutil -ldl
int vxfs_nattr_open(int fd, char *path, int *oflag, int mode);
The vxfs_nattr_open() function returns an open file descriptor for the named data stream pointed to by path for the file descriptor fd. vxfs_nattr_open() operates like the open() call, except that the path is interpreted as a named data stream to the file descriptor fd.Opening a named data stream with a prefix of $vxfs: fails with the EINVAL error. The $vxfs: prefix is reserved by Veritas.
If the path is set to "." (dot), the returned file descriptor points to the named data stream directory.
Values for oflag are constructed by a bit-wise inclusive or of flags from the following list (defined in <fcntl.h>). Applications must specify one of the following three file access modes for oflag:
O_RDONLY Open for reading only. O_WRONLY Open for writing only. O_RDWR Open for reading and writing.
Any combination of the following can be used:
O_APPEND If specified, the file offset is set to the end of the file before each write operation. O_CREAT Creates the named data stream. If the file already exists, O_CREAT has no effect except as described under O_EXCL below. O_EXCL If O_CREAT and O_EXCL are set, vxfs_nattr_open() fails if the file exists. If O_CREAT is not set, the effect is undefined. O_DSYNC Write I/O operations on the file descriptor complete as defined by synchronized I/O data integrity guarantees. O_RSYNC Read I/O operations on the file descriptor complete at the same level of data integrity specified by the O_DSYNC and O_SYNC flags.
If either O_DSYNC or O_SYNC and O_RSYNC are set in oflags, all I/O operations on the file descriptor complete as defined by synchronized I/O data integrity guarantees.Some flag values can be set following vxfs_nattr_open() similar to that of the fcntl function.
O_SYNC If O_SYNC is set on a named data stream, write operations to that file cause the process to block until the data is written to the underlying hardware. O_TRUNC If the file exists and is successfully opened with O_RDWR or O_WRONLY, the file length is truncated to zero. The result of using O_TRUNC with O_RDONLY is undefined. O_LARGEFILE If O_LARGEFILE is specified, the named data stream is created with support for large files.
The behavior of "" (null string) for named data stream interfaces is same as "." (dot). If a user specifies "" as the path name of a file, the string is treated as "." and the named data stream directory file descriptor is returned.
strings do not correspond to the current directory and parent directory,
as they do in POSIX UNIX standards.
This allows users to create files with these names.
users should use appropriate names for named data streams that
will not be confusing when read from the POSIX UNIX name space perspective.
Upon successful completion, vxfs_nattr_open() opens the file and returns a non-negative integer representing the lowest numbered unused file descriptor. Otherwise, -1 is returned, errno is set to indicate the error, and no files are created or modified.
EACCES Search permission does not exist on the attribute directory. The file exists but the permissions specified by oflag are insufficient. The file does not exist and write permission is insufficient for the attribute directory associated with the file descriptor, or the file exists and the write permission is insufficient for the file. O_TRUNC is specified and the user does not have write permission. EDQUOT The file does not exist. O_CREAT was specified and the user quota of inodes or disk blocks was exceeded on the file system where the file was being created. EEXIST The O_CREAT and O_EXCL flags are set and the named data stream already exists. ENOTSUP The value of oflag is not valid. The file system disk layout version does not support named data streams. EMFILE OPEN_MAX file descriptors are currently open in the calling process. ENFILE The maximum number of files are open on the system. ENOENT The O_CREAT flag is not set and the named file does not exist. The O_CREAT flag is set and either the path does not exist or the path points to an empty string. ENOMEM The path argument names a STREAMS file and the system is unable to allocate resources. ENOSPC There is insufficient space in the directory or file system to create the file. O_CREAT is specified and the file does not exist. ENAMETOOLONG The path name resolution of a symbolic link produced an intermediate result whose length exceeded PATH_MAX. EOVERFLOW The named file is a regular file and either O_LARGEFILE is not set or the size of the file cannot be represented correctly in an object of type off_t. O_LARGEFILE is set and the size of the file cannot be represented correctly in an object of type off64_t.
fcntl(2), vxfs_nattr_link(3), vxfs_nattr_rename(3), vxfs_nattr_unlink(3) vxfs_nattr_utimes(3)