[Previous]
[Contents]
[Next]

qnx_sid_query()

get information on a session ID

Synopsis:

#include <sys/sidinfo.h>
int qnx_sid_query( pid_t proc_pid,
                   int sid,
                   struct _sidinfo *bufptr );

Description:

The qnx_sid_query() function returns a structure of information on a session associated with sid on the node identified by proc_pid. If proc_pid is zero, the current node is used. To query another node proc_pid should be passed as a virtual circuit to the process manager on that node.

/* Attach a vc to the process manager on node 4 */
proc_pid = qnx_vc_attach( 4, PROC_PID, 0, 0 );

The sid is a small positive integer.


Note: If you ask for information on a session ID that isn't in use, information is returned on the next monotonically greater ID. This automatic search for the next existing session ID provides a convenient method of obtaining information on all sessions.

Returns:

A session ID on success. If no session with an ID greater than or equal to sid exists, -1 is returned and errno is set.

Errors:

EINVAL
There's no session with a session ID that is greater than sid.
ESRCH
The proc_pid is invalid.

Examples:

#include <stdio.h>
#include <sys/sidinfo.h>
#include <errno.h>

void main()
  {
    int id;
    struct _sidinfo buf;

    printf( "List of sessions on this node:\n" );
    for( id = 0;
       ( id = qnx_sid_query( 0, id, &buf ) ) != -1;
       ++id )
      printf( "Sid %d Pid %d\n", buf.sid, buf.pid );
  }

Classification:

QNX

Safety:
Interrupt handler No
Signal handler Yes, but modifies errno
Thread Yes

See also:

errno, qnx_vc_attach(), setsid()


[Previous]
[Contents]
[Next]