resmgr_pathname()

Updated: April 19, 2023

Return the pathname associated with an ID

Synopsis:

#include <sys/iofunc.h>
#include <sys/resmgr.h>

int resmgr_pathname( int id,
                     unsigned flags, 
                     char* path, 
                     int maxbuf );

Arguments:

id
The link ID that resmgr_attach() returned.
flags
Flags that affect the operation:
  • _RESMGR_PATHNAME_LOCALPATH — get a shortened pathname that's usable only on the local machine. By default, this function gets a globally unique pathname.
path
A pointer to a buffer where the function can store the path name.
maxbuf
The size of the buffer.

Library:

libc

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

Description:

The resmgr_pathname() function returns the pathname associated with an id that's returned from resmgr_attach(), it's also the ctp->id value of all the resmgr callout functions.

If the id was obtained from calling resmgr_attach() with _RESMGR_FLAG_DIR specified, then the path name includes a trailing slash.

By default, this function calls:

netmgr_ndtostr(ND2S_DIR_SHOW, nd, buf, sizeofbuf)

If you specify _RESMGR_PATHNAME_LOCALPATH, it calls

netmgr_ndtostr(ND2S_DIR_SHOW|ND2S_LOCAL_STR, nd, buf, sizeofbuf)

to return a shortened path that's usable on your local node only. This is useful for display.

Returns:

The length of the path, including the terminating NUL character, or -1 if an error occurs (errno is set).

Errors:

EFAULT
A fault occurred in a server's address space when it tried to access the caller's message buffers.
ESRCH
The thread indicated by ctp->rcvid doesn't exist or its connection is detached.
ESRVRFAULT
A fault occurred when the kernel tried to access the buffers provided.

Classification:

QNX Neutrino

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