Read link connect function handler

Updated: April 19, 2023

Prototype:

int (*readlink) ( resmgr_context_t *ctp,
                 io_readlink_t *msg,
                 RESMGR_HANDLE_T *handle,
                 void *reserved ) 

Classification:

Connect

Default handler:

none

Helper functions:

iofunc_readlink()

Client function:

readlink(), readlinkat()

Messages:

_IO_CONNECT with subtype _IO_CONNECT_READLINK

Data structure:

struct _io_connect {
  // internal fields (as described above)
  uint16_t path_len;
  uint8_t  extra_type;
  uint16_t extra_len;
  char     path [1];
};

struct _io_connect_link_reply {
  uint32_t reserved1;
  uint32_t file_type;
  uint8_t  eflag;
  uint8_t  reserved2[1];
  uint16_t chroot_len;
  uint32_t umask;
  uint16_t nentries;
  uint16_t path_len;
};

struct _io_connect_ftype_reply {
  uint16_t status;      /* Typically an errno */
  uint16_t reserved;
  uint32_t file_type;   /* _FTYPE_? in sys/ftype.h */
};

typedef union {
  struct _io_connect             connect;
  struct _io_connect_link_reply  link_reply;
  struct _io_connect_ftype_reply ftype_reply;
} io_readlink_t;

Description:

Responsible for reading the contents of a symbolic link as specified by the path member of the input structure. The bytes returned are the contents of the symbolic link; the status returned is the number of bytes in the reply. A valid return should be done only for a symbolic link; all other accesses should return an error code.

Returns:

The status via the helper macro _RESMGR_STATUS() and the data via message reply.

Referenced by:

resmgr_connect_funcs_t connect table

Permission checking:

The iofunc_readlink() function does not perform any permission checking.