iofunc_ocb_t

Open Control Block structure

Synopsis:

#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 == 64
    off_t                           offset;
 #else
    off64_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
#endif
    uint16_t                        sflag;
    uint16_t                        flags;
    void                            *reserved;
} iofunc_ocb_t;

Description:

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:

attr
A pointer to the OCB's attributes. By default, this structure is of type iofunc_attr_t , but you can redefine the IOFUNC_ATTR_T manifest if you want to use a different structure in your resource manager.
ioflag
The mode (e.g. reading, writing, blocking) that the resource was opened with. The open modes (as passed to open() on the client side) correspond to the ioflag values as follows:
Open mode ioflag value
O_RDONLY _IO_FLAG_RD
O_RDWR _IO_FLAG_RD | _IO_FLAG_WR
O_WRONLY _IO_FLAG_WR

This information is inherited from the io_connect_t structure that's available in the message passed to the open handler.

offset, offset_hi
The read/write offset into the resource (e.g. our current lseek() position within a file), defined in a variety of ways to suit 32- and 64-bit offsets. Your resource manager can modify this offset.
sflag
The sharing mode; see sopen() . This information is inherited from the io_connect_t structure that's available in the message passed to the open handler.
flags
When the 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.

Classification:

QNX Neutrino

Last modified: 2013-12-23

comments powered by Disqus