change polling parameters for a virtual circuit
#include <sys/kernel.h>
#include <sys/vc.h>
int qnx_vc_poll_parm( pid_t vid,
struct _vc_poll_parm_set *parm_ptr );
The qnx_vc_poll_parm() function attempts to change the virtual circuit polling parameters to those pointed to by parm_ptr, on the node where the process manager may be communicated with using process ID vid.
If you wish to change the poll parameters on your local node, simply use PROC_PID for vid. If you wish to change the polling parameters on a remote node, you must attach a virtual circuit to the process manager on that remote node, using the qnx_vc_attach() function, and use its returned value for vid.
You should examine <sys/vc.h> for the appropriate definition of the _vc_poll_parm_set structure. It contains at least the following members:
If you don't wish to change a parameter, simply set it to -1 and the process manager will ignore it. Also, it's considered good form to set all the zero* members of the _vc_poll_parm_set structure to zero to allow cleanly for future extensions to the structure.
The qnx_vc_poll_parm() function returns a zero on success. Note that if zero is returned, the process manager has written all of the current virtual circuit poll parameters into the buffer pointed to by parm_ptr. A -1 is returned on failure, and errno is set.
If any of the following conditions occurs, the qnx_vc_poll_parm() function returns -1, and sets errno to the corresponding value:
#include <stdio.h>
#include <errno.h>
#include <sys/vc.h>
#include <sys/kernel.h>
void main()
{
pid_t vid;
struct _vc_poll_parm_set poll_parm;
/*
* change the maximum permitted virtual circuit
* idle time to 10 minutes ( 600 seconds ), leave
* all other poll parameters unchanged
*/
poll_parm.poll_period = -1;
poll_parm.idle_time = -1;
poll_parm.max_idle_time = 600;
poll_parm.num_polls = -1;
poll_parm.num_qpkts = -1;
poll_parm.zero1 = 0;
poll_parm.zero2 = 0;
/*
* could call qnx_vc_attach() here, if we wanted to
* change the poll parameters on another node
*/
vid = PROC_PID;
if( qnx_vc_poll_parm( vid, &poll_parm ) != 0 ) {
printf( "error: process manager set errno = %d\n",
errno );
}
/*
* if we want, we can now look at poll_parm, which
* the process manager has loaded with all of the
* current poll parameter values
*/
}
QNX
| Safety: | |
|---|---|
| Interrupt handler | No |
| Signal handler | Yes, but modifies errno |
| Thread | Yes |
If you wish to change the poll parameters, your program must run as root.
errno, qnx_vc_attach(), netpoll utility