Connect message types
Let's look at the general case for the io_open handler—it doesn't always correspond to the client's open() call! For example, let's consider the stat() and access() client function calls.
_IO_CONNECT_COMBINE_CLOSE
- Client call:
- stat()
- Message(s):
- _IO_CONNECT_COMBINE_CLOSE , _IO_STAT
- Callouts:
- io_open, io_lock_ocb, io_stat, io_unlock_ocb, io_close
The _IO_CONNECT_COMBINE_CLOSE message causes the io_open handler to be called. It then implicitly (at the end of processing for the combine message) causes the io_close_ocb handler to be called.
Optimizing the handling of _IO_CONNECT_COMBINE_CLOSE messages
- stat()/lstat()
- pathconf()
- chmod()
- chown()
- utime()/utime64()
Normally, to perform one of the above POSIX operations, the steps include creating an Open Control Block (OCB), performing a resource manager callout (eg. stat), and then closing the OCB (typically via close_dup and close_ocb). To save time, this handler combines the (open, specific callout, close) sequence, so that a single callout processes the entire operation without creating an OCB.
int (*combo) (resmgr_context_t *ctp,
io_open_t *msg1,
RESMGR_HANDLE_T *handle,
_resmgr_combomsgs_t *msg2)
where: - The io_open_t structure contains the open message with a path to resolve, if any.
- The _resmgr_combomsgs_t structure contains the specific operation to process (eg. stat()).
- Messages:
- _IO_STAT, _IO_UTIME, _IO_UTIME64, _IO_PATHCONF, _IO_CHMOD, _IO_CHOWN
- Returns:
- _RESMGR_DEFAULT
- The framework returns to its default method of handling connect-combine-close messages (eg. open, specific callout, close).
_IO_CONNECT_COMBINE
For the access() function, the client's C library will open a connection to the resource manager and perform a stat() call. Then, based on the results of the stat() call, the client's C library access() may perform an optional devctl() to get more information. In any event, because access() opened the device, it must also call close() to close it:
- Client call:
- access()
- Message(s):
- _IO_CONNECT_COMBINE , _IO_STAT, _IO_DEVCTL (optional), _IO_CLOSE
- Callouts:
- io_open, io_lock_ocb, io_stat, io_unlock_ocb, io_lock_ocb (optional), io_devctl (optional), io_unlock_ocb (optional), io_close
