Duplicate a file descriptor I/O function handler

Prototype

int (*dup) ( resmgr_context_t *ctp,
             io_dup_t *msg,
             RESMGR_OCB_T *ocb ) 

Classification:

I/O

Default handler:

NULL—handled by base layer

Helper functions:

none

Client functions:

dup(), dup2(), fcntl(), fork(), spawn*(), vfork()

Messages:

_IO_DUP

Data structure:

struct _io_dup {
  uint16_t           type;
  uint16_t           combine_len;
  struct _msg_info32 info;
  uint32_t           reserved;
  uint32_t           key;
};

typedef union {
  struct _io_dup   i;
} io_dup_t;

Description:

This is the dup() message handler. As with the close duplicate OCB I/O function handler, you won't likely handle this message yourself. Instead, the base-layer library handles it.

Returns:

The status via the helper macro _RESMGR_STATUS().

Referenced by:

resmgr_io_funcs_t I/O table

Permission checking:

The default functionality and permission checking is handled by the base layer (regardless of whether you use the default implementation). The base layer verifies one of the following conditions:
  • the process requesting a dup() is the same as the process that opened the original file descriptor
  • the MsgKeyData() is valid
  • the client has the dynamic ability iofunc/dup (IOFUNC_ABILITY_DUP) (using iofunc_ability_check())
There are no additional permission checks that need to be performed in a resource manager that implements this function.