iofunc_link()

Updated: October 26, 2022

Link two directory entries

Synopsis:

#include <sys/iofunc.h>

int iofunc_link( resmgr_context_t* ctp,
                 io_link_t* msg,
                 iofunc_attr_t* attr,
                 iofunc_attr_t* dattr,
                 struct _client_info* info );

Arguments:

ctp
A pointer to a resmgr_context_t structure that the resource-manager library uses to pass context information between functions.
msg
A pointer to the io_link_t structure that contains the message that the resource manager received; see below.
attr
A pointer to the iofunc_attr_t structure that describes the characteristics of the resource.
dattr
A pointer to the iofunc_attr_t structure that describes the characteristics of the parent directory.
info
NULL, or a pointer to a _client_info structure that contains information about the client. For information about this structure, see ConnectClientInfo().

Library:

libc

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

Description:

The iofunc_link() helper function creates a link from a new object in dattr to the existing object attr. A resource manager uses this routine when creating a new filename inside dattr which will be hard linked to attr. The iofunc_link() function checks to see if the client (described by the optional info structure) has permission to create a new name entry inside dattr. The attr structure describes the resource's attributes, and the dattr structure defines the attributes of the parent directory.

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

The io_link_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_link_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):

Returns:

EOK
Success.
EBADFSYS.
NULL was passed in attr or dattr.
EINVAL
The client process is no longer valid.
ENOMEM
The function couldn't allocate the memory for the _client_info structure.
EPERM
The group ID or owner ID didn't match.

Classification:

QNX Neutrino

Safety:  
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes