Updated: April 19, 2023

Verify a client's ability to open or to create a resource


#include <sys/iofunc.h>

int iofunc_open( resmgr_context_t *ctp,
                 io_open_t *msg,
                 iofunc_attr_t *attr,
                 iofunc_attr_t *dattr,
                 struct _client_info *info );


A pointer to a resmgr_context_t structure that the resource-manager library uses to pass context information between functions.
A pointer to the io_open_t structure that contains the message that the resource manager received; see below.
NULL, or a pointer to an iofunc_attr_t structure that describes the resource being opened if dattr is NULL or that will be initialized if dattr is non-NULL.
NULL, or a pointer to the iofunc_attr_t structure that describes the characteristics of the parent directory.
NULL, or a pointer to a _client_info structure that contains the information about a client connection. For information about this structure, see ConnectClientInfo().



Use the -l c option to qcc to link against this library. This library is usually included automatically.


The iofunc_open() function is a helper function for resource managers that implement open(). It checks to see if the client (described by the optional info structure) has access to open the resource identified by attr if dattr is NULL, or it creates a file in the directory identified by dattr if dattr is non-NULL.

In the first case, attr must be non-NULL and point to a structure that describes the resource's attributes.

In the second case, a file is being created in the directory described by the structure that dattr points to. If attr is non-NULL, the attribute structure that it points to gets initialized. If attr is NULL, no initialization is done; only access validation is done.

The info argument can be passed as NULL, in which case iofunc_open() obtains the client information itself via a call to iofunc_client_info_ext(). It is, of course, more efficient to get this information once, rather than calling this function with info set to NULL every time.

io_open_t structure

The io_open_t structure holds the _IO_CONNECT message received by the resource manager:

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

This message structure is a union of an input message (coming to the resource manager), _io_connect, and two possible output or reply messages (going back to the client):


Successful completion.
The requested synchronized modes (O_SYNC, O_DSYNC, O_RSYNC) aren't supported (i.e, IOFUNC_PC_SYNC_IO isn't set in the device's mount configuration). Or, both attr and dattr are NULL (see the description for more details).
There was an error, as defined by the POSIX semantics for the open call. This error should be returned to the next higher level.


QNX Neutrino

Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes