pathmgr_link()

Create a link

Synopsis:

#include <pthread.h>

int pathmgr_link( const char *path,
                  uint32_t nd,
                  pid_t pid,
                  int chid,
                  unsigned handle,
                  enum _file_type file_type,
                  unsigned flags );

Arguments:

path
The path that you want to link to, or NULL to link to /.
nd
The node descriptor of the node (e.g., ND_LOCAL_NODE for the local node) of the process you want to associate the link with; see Node descriptors,” below.
pid
The process ID to associate with the link, or 0 for the calling process.
chid
The channel ID to associate with the link.
handle
A handle to associate with the link.
file_type
The file type; one of the following (defined in <sys/ftype.h>):
flags
0, or a combination of the following:

For more information, see The flags argument,” below.

Library:

libc

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

Description:

The pathmgr_link() function creates a link in the process manager. The nd, pid, chid, and handle together identify who handles the specified path; for more information, see The client's view in the Resource Managers chapter of Getting Started with QNX Neutrino.

You can use pathmgr_unlink() to remove the link.


Note: The link isn't permanent and is lost when the system reboots.

The flags argument

The flags argument specifies additional information to control the pathname resolution:

PATHMGR_FLAG_AFTER
Force the path to be resolved after others with the same pathname at the same mountpoint.
PATHMGR_FLAG_BEFORE
Force the path to be resolved before others with the same pathname at the same mountpoint.
PATHMGR_FLAG_DIR
Treat the pathname as a directory and allow the resolving of longer pathnames. The _IO_CONNECT message contains the pathname passed to the client open() with the matching prefix stripped off. Without this flag, the pathname is treated as a simple file requiring an exact match.
Attached path Opened path PATHMGR_FLAG_DIR set PATHMGR_FLAG_DIR clear
/a/b /a/b Match "" Match ""
/a/b /a/b/c Match c No match
/a/b /a/b/c/d Match c/d No match
/a/b /a/bc No match No match

You can't attach a directory pathname that contains, as a subset, an existing file pathname. Likewise, you can't attach a file pathname that's a subset of an existing directory pathname.

Existing path New path New path allowed?
Directory /a/b Directory /a Yes
Directory /a/b Directory /a/b/c Yes
File /a/b Directory /a Yes
File /a/b Directory /a/b/c No; the directory is beneath a file
Directory /a/b File /a No; the directory is beneath a file
Directory /a/b File /a/b/c Yes
File /a/b File /a Yes
File /a/b File /a/b/c Yes
PATHMGR_FLAG_FTYPEALL
Handle requests for all file types. You must specify a registration file type of _FTYPE_ALL.
PATHMGR_FLAG_FTYPEONLY
Handle only requests for the specific filetype indicated. The pathname must be NULL.
PATHMGR_FLAG_OPAQUE
Don't resolve paths to mountpoints on a path shorter than this (i.e. find the longest match against all pathnames attached).
PATHMGR_FLAG_SELF
Allow requests to resolve back to this server.

Caution: Be very careful if you set PATHMGR_FLAG_SELF because it's possible for a deadlock to occur. For more information, see Robust implementations with Send/Receive/Reply in the Interprocess Communication (IPC) chapter of the System Architecture guide.

PATHMGR_FLAG_STICKY
No ID is associated with the path. You must use pathmgr_unlink() to remove the link.

Node descriptors

The nd (node descriptor) is a temporary numeric description of a remote node. For more information, see the Qnet Networking chapter of the System Architecture guide.

To: Use this function:
Compare two nd objects ND_NODE_CMP()
Convert a nd to text netmgr_ndtostr()
Convert text to a nd netmgr_strtond()

Returns:

A unique ID for the link, or -1 if an error occurred (errno is set).

Classification:

QNX Neutrino

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

See also:

pathmgr_symlink(), pathmgr_unlink(), resmgr_attach()