[Previous]
[Contents]
[Next]

qnx_fd_query()

query a file descriptor

Synopsis:

#include <sys/fd.h>
int qnx_fd_query( pid_t proc_pid, pid,
                  int fd,
                  struct _fd_entry *buf );

Description:

The qnx_fd_query() function returns an entry from the file descriptor table for process pid's file descriptor fd on the node indicated by proc_pid. If proc_pid and pid are zero, the current process is used. If just 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. For example,

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

The fd is a small positive integer. If you ask for information on an fd that isn't in use, information is returned on the next monotonically greater fd. This automatic search for the next existing fd provides a convenient method of obtaining information on all handlers.

Returns:

A file descriptor on success. If no file descriptor greater than or equal to fd exists, -1 is returned and errno is set.

Errors:

EINVAL
There's no file descriptor that's greater than or equal to fd.
ESRCH
The process pid doesn't exist.

Examples:

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


void main()
  {
    int fd;
    struct _fd_entry buf;

    printf( "File descriptors for this process:\n" );
    for( fd = 0;
       ( fd = qnx_fd_query( 0, 0, fd, &buf ) ) != -1;
       ++fd )
      printf( "Fd %d Server pid %d\n", fd, buf.pid );
   }

Classification:

QNX

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

See also:

errno, qnx_fd_attach(), qnx_fd_detach(), qnx_vc_attach()


[Previous]
[Contents]
[Next]