The Open Control Block (OCB) maintains the state information about a particular session involving a client and a resource manager. It's created during open() handling and exists until a close() is performed.
This structure is used by the iofunc layer helper functions. (In the Extending the POSIX-Layer Data Structures chapter, we'll show you how to extend this to include your own data).
The OCB structure contains at least the following:
typedef struct _iofunc_ocb {
IOFUNC_ATTR_T *attr;
int32_t ioflag;
off_t offset;
uint16_t sflag;
uint16_t flags;
} iofunc_ocb_t;
where the values represent:
| Open mode | ioflag value |
|---|---|
| O_RDONLY | _IO_FLAG_RD |
| O_RDWR | _IO_FLAG_RD | _IO_FLAG_WR |
| O_WRONLY | _IO_FLAG_WR |
Additionally, you can use flags in the range IOFUNC_OCB_FLAGS_PRIVATE (see <sys/iofunc.h>) for your own purposes. Your resource manager can modify this member.