Make filesystem node connect function handler

Updated: April 19, 2023

Prototype:

int (*mknod) ( resmgr_context_t *ctp,
               io_mknod_t *msg,
               RESMGR_HANDLE_T *handle,
               void *reserved ) 

Classification:

Connect

Default handler:

none

Helper functions:

iofunc_mknod()

Client functions:

mknod(), mknodat(), mkdir(), mkdirat(), mkfifo(), mkfifoat()

Messages:

_IO_CONNECT, subtype _IO_CONNECT_MKNOD

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_mknod_t;

Description:

Creates a new filesystem entry point. The message is issued to create a file, named by the path member, using the filetype encoded in the mode member (from the “internal fields” part of the struct _io_connect structure, not shown).
This is really used only for the mkfifo(), mkdir(), and mknod() client functions.

Returns:

The status via the helper macro _RESMGR_STATUS().

Referenced by:

resmgr_connect_funcs_t connect table

Permission checking:

QNX Neutrino does not use block and character device nodes for access to device drivers; instead, it relies on device drivers to register as resource managers. Therefore, mknod() is restricted to creating files, directories, and FIFOs. The helper function iofunc_mknod() checks for write access in the parent directory.