rf_setattr(3P4)
NAME
rf_setattr − set attributes of realtime file
SYNOPSIS
#include <rtfiles.h>
int rf_setattr(fildes, reqattr, reqwhich, actattr, actwhich)
int fildes, reqwhich, ∗actwhich;
struct rf_attrbuf ∗reqattr, ∗actattr;
DESCRIPTION
The rf_setattr function sets one or more realtime attributes associated with the file specified by fildes.
The reqwhich argument specifies which of the attributes shall be set. This is done using the logical OR of the following flags:
ATB_ALLOC
Preallocation size.
ATB_ALLOCFLAGS
Preallocation flags.
ATB_CACHEFLAGS
Caching flags.
ATB_DIOFLAGS
Direct I/O flags.
ATB_DIOSIZE
Direct I/O transfer size.
ATB_ALL
All of the above flags.
The reqattr and actattr arguments point to structures of type rf_attrbuf.
The requested attributes of the file are specified in the rf_attrbuf structure specified by the reqattr argument.
The resulting attributes of the file are stored in actattr upon successful completion of the function. See rf_getattr.
The rf_attrbuf structure is declared in the <rtfiles.h> header file. The structure has the following members:
off_t atb_alloc;
int atb_allocflags;
int atb_cacheflags;
int atb_dioflags;
unsigned atb_diosize;
The field atb_alloc contains the size, in bytes, to extend the file by. Upon return, it contains the actual file extension size.
atb_allocflags contains flags which pertain to file space allocation:
ATB_SEQ
Allocate file space optimized for sequential access.
ATB_ADVSEQ
Allocate file space optimized for sequential access, if possible.
atb_cacheflags contains flags that pertain to the type of caching desired:
ATB_CACHENOREUSE
Recently accessed blocks are not likely to be accessed in the near future.
ATB_CACHERANDOM
Blocks will be accessed randomly.
ATB_CACHESEQUENTIAL
Blocks will be access sequentially.
atb_dioflags contains flags for direct I/O:
ATB_DIOENABLE
Enable direct I/O for subsequent read and write operations.
The field atb_diosize contains the direct I/O transfer size in bytes. This should not be specified on CX systems since a single direct I/O transfer size is not required.
The actwhich argument points to a flags word. This uses the same flags as reqwhich. Upon successful completion, actwhich will indicate which actual attributes were different from the requested attributes. In other words, if a flag is set in actwhich then the corresponding field of the actattr structure does not match the corresponding field of the reqattr structure. Upon unsuccessful completion, actwhich will indicate all requested attributes that were found to be invalid or in conflict with other attributes.
RETURN VALUE
Upon successful completion, the function rf_setattr returns a value of 0. The resultant attributes will be stored in the rf_attrbuf pointed to by actattr. The flags word actwhich will indicate which of the resultant attributes are different from the requested attributes.
Upon unsuccessful completion, rf_setattr returns a value of -1 and sets errno to indicate the error. The flags word pointed to by actwhich will indicate any attributes that were in error.
ERRORS
Under the following conditions, the function rf_setattr fails and sets errno to:
[EBADF] The fildes argument is not a valid file descriptor.
[EFBIG] Preallocation was requested and the specified size is too large.
[EINVAL] The rf_setattr function in not supported for the specified file or file system.
[EINVAL] One or more of the requested attributes was not valid or in conflict with an attribute specified on another open instance of this file. Upon return, actwhich will indicate which parameters were found to be in error. No attributes were changed.
[ENOSPC] Preallocation was requested and there is insufficient space on the file system for the requested size.
SEE ALSO
rf_create(3P4), rf_getattr(3P4).
NOTES
The attribute ATB_CACHENOREUSE is not supported on CX systems.
A file in direct mode does not use the cache. None of the cache flags may be set.
WARNING
rf_setattr is based on IEEE Draft Standard P1003.4/D12. This is an unapproved draft, subject to change. Use of information contained in this unapproved draft is at your own risk. This interface will change to reflect any changes made by future drafts of POSIX 1003.4.
CX/UX Programmer’s Reference Manual