Структура блока открытого контекста
#include <sys/iofunc.h>typedef struct _iofunc_ocb {IOFUNC_ATTR_T *attr;int32_t ioflag;#if !defined(_IOFUNC_OFFSET_BITS) || _IOFUNC_OFFSET_BITS == 64#if _FILE_OFFSET_BITS - 0 == 64off_t offset;#elseoff64_t offset;#endif#elif _IOFUNC_OFFSET_BITS - 0 == 32#if !defined(_FILE_OFFSET_BITS) || _FILE_OFFSET_BITS == 32#if defined(__LITTLEENDIAN__)off_t offset;off_t offset_hi;#elif defined(__BIGENDIAN__)off_t offset_hi;off_t offset;#else#error endian not configured for system#endif#else#if defined(__LITTLEENDIAN__)int32_t offset;int32_t offset_hi;#elif defined(__BIGENDIAN__)int32_t offset_hi;int32_t offset;#else#error endian not configured for system#endif#endif#else#error _IOFUNC_OFFSET_BITS value is unsupported#endifuint16_t sflag;uint16_t flags;void *reserved;} iofunc_ocb_t;
The iofunc_ocb_t
structure is an Open Control Block, a block of data that's established by a resource manager during its handling of the client's open() function.
A resource manager creates an instance of this structure whenever a client opens a resource. For example, iofunc_open_default() calls iofunc_ocb_calloc() to allocate an OCB. The OCB exists until the client closes the file descriptor associated with the open operation. The resource manager passes this structure to all of the functions that implement the I/O operations for the file descriptor.
The iofunc_ocb_t
structure includes the following members:
IOFUNC_ATTR_T
manifest if you want to use a different structure in your resource manager. Open mode | ioflag value |
---|---|
O_RDONLY | _IO_FLAG_RD |
O_RDWR | _IO_FLAG_RD | _IO_FLAG_WR |
O_WRONLY | _IO_FLAG_WR |
io_connect_t
structure that's available in the message passed to the open handler. io_connect_t
structure that's available in the message passed to the open handler. IOFUNC_OCB_PRIVILEGED
bit is set, a privileged process (i.e. root) performed the open(). Additionally, you can use flags in the range defined by IOFUNC_OCB_FLAGS_PRIVATE
(see <sys/iofunc.h>
) for your own purposes. Your resource manager can modify these flags. ЗОСРВ «Нейтрино»
iofunc_attr_t, iofunc_ocb_calloc(), iofunc_open_default(), open()
Предыдущий раздел: Описание API системной библиотеки