Duplicate a file descriptor I/O function handler

QNX SDP8.0Getting Started with the QNX OSDeveloperUser

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*()

Messages:

_IO_DUP

Data structure:

struct _io_dup {
  uint16_t             type;
  uint16_t             combine_len;
  struct _msg_info_hdr info;
  dupfd_handle_t       handle;
};

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 message has a valid dupfd handle (see dupfd_register())
  • the client has the custom 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.
Page updated: