Link two directories
#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 );
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The iofunc_link() helper function links directory attr to dattr for context ctp. It's similar to the iofunc_open() function:
The iofunc_link() function checks to see if the client (described by the optional info structure) has access to open the resource (name passed in the msg structure). The attr structure describes the resource's attributes, and the optional dattr structure defines the attributes of the parent directory (i.e. if dattr isn't NULL, it implies that the resource identified by attr is being created within the directory specified by dattr).
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(). It is, of course, more efficient to get the client info once, rather than calling this function with NULL every time.
If you pass NULL in info, the function returns information about a client's connection in info, and an error constant.
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):
Or:
The reply includes the following additional information:
struct _io_resmgr_link_extra { uint32_t nd; int32_t pid; int32_t chid; uint32_t handle; uint32_t flags; uint32_t file_type; uint32_t reserved[2]; }; typedef union _io_link_extra { struct _msg_info info; /* EXTRA_LINK (from client) */ void *ocb; /* EXTRA_LINK (from resmgr functions) */ char path[1]; /* EXTRA_SYMLINK */ struct _io_resmgr_link_extra resmgr; /* EXTRA_RESMGR_LINK */ } io_link_extra_t;
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |
ConnectClientInfo(), iofunc_attr_t, iofunc_client_info(), iofunc_open(), _msg_info, resmgr_context_t
Resource Managers chapter of Getting Started with QNX Neutrino