int io_write ( resmgr_context_t *ctp,
               io_write_t *msg,
               RESMGR_OCB_T *ocb ) 

Classification: I/O

Default handler: iofunc_write_default()

Helper functions: iofunc_write_verify()

Client functions: write(), fwrite(), etc.

Messages: _IO_WRITE

Data structure:

struct _io_write {
  uint16_t         type;
  uint16_t         combine_len;
  uint32_t         nbytes;
  uint32_t         xtype;
  uint32_t         zero;

typedef union {
  struct _io_write i;
} io_write_t;

Description: This message handler is responsible for getting data that the client wrote to the resource manager. It gets passed the number of bytes the client is attempting to write in the nbytes member; the data implicitly follows the input data structure (unless the xtype override is _IO_XTYPE_OFFSET; see "A simple io_write() example" below!) The implementation will need to re-read the data portion of the message from the client, using resmgr_msgreadv() or the equivalent. The return status is the number of bytes actually written or an errno.

Note that the helper function iofunc_write_verify() should be called to ascertain that the file was opened in a mode compatible with writing. Also, the iofunc_sync_verify() function should be called to verify if the data needs to be synchronized to the medium.

Returns: The status via the helper macro _IO_SET_WRITE_NBYTES().

For an example, take a look at "A simple io_write() example" below.