io_lseek()

int io_lseek ( resmgr_context_t *ctp,
               io_lseek_t *msg,
               RESMGR_OCB_T *ocb ) 

Classification: I/O

Default handler: iofunc_lseek_default()

Helper functions: iofunc_lseek()

Client functions: lseek(), fseek(), rewinddir()

Messages: _IO_LSEEK

Data structure:

struct _io_lseek {
  uint16_t         type;
  uint16_t         combine_len;
  short            whence;
  uint16_t         flags;
  uint64_t         offset;
};

typedef union {
  struct _io_lseek i;
  uint64_t         o;
} io_lseek_t;

Description: Handles the client's lseek() function. Note that a resource manager that handles directories will also need to interpret the _IO_LSEEK message for directory operations. The whence and offset parameters are passed from the client's lseek() function. The routine should adjust the OCB's offset parameter after interpreting the whence and offset parameters from the message and should return the new offset or an error.

The only currently defined flag is _IO_LSEEK_IGNORE_NON_SEEKABLE. The client sets this flag if it wants the resource manager to ignore the request if lseek operations aren't supported (for example, an aio_read() on a pipe). In this case, the resource manager shouldn't change the offset.

Returns: The status via the helper macro _RESMGR_STATUS(), and optionally (if no error and if not part of a combine message) the current offset.