Change file mode I/O function handler

Prototype:

int (*chmod) ( resmgr_context_t *ctp,
               io_chmod_t *msg,
               RESMGR_OCB_T *ocb ) 

Classification:

I/O function

Default handler:

iofunc_chmod_default()

Helper functions:

iofunc_ability_check(), iofunc_chmod()

Client functions:

chmod(), fchmod()

Messages:

_IO_CHMOD

Data structure:

struct _io_chmod {
  uint16_t type;
  uint16_t combine_len;
  mode_t   mode;
};

typedef union {
  struct _io_chmod i;
} io_chmod_t;
Description: Responsible for changing the mode for the resource identified by the passed ocb to the value specified by the mode message member.

Returns:

The status via the helper macro _RESMGR_STATUS().

Referenced by:

resmgr_io_funcs_t I/O table

Permission checking:

The default implementation iofunc_chmod_default() calls the helper function iofunc_chmod() to check that the client is the owner of the file (i.e., that it has the same user ID) and that it's not a read-only filesystem. The helper function also prevents the user from setting the sticky bit and the set group ID bit unless it is root.