create a virtual proxy on a remote node
#include <sys/proxy.h> pid_t qnx_proxy_rem_attach( nid_t nid, pid_t proxy );
The qnx_proxy_rem_attach() function creates a virtual proxy on a remote node nid that allows any process on node nid to perform a Trigger() on the virtual proxy, just as if proxy were on that node. You must have already created proxy locally with qnx_proxy_attach().
When a process on remote node nid does a Trigger() on the virtual proxy, it causes a Trigger() to occur on proxy on your local node. Your program doesn't see any difference between a local Trigger() of a proxy, and a Trigger() on a virtual proxy on a remote node.
Note that if you specify your own node number or zero for nid, proxy is returned to you, and no virtual proxy is created.
The virtual proxy's process ID on the remote node, or -1 on failure. If an error occurs, errno is set.
This function may also set errno to any of the values listed for the qnx_vc_attach() function.
#include <stdio.h> #include <errno.h> #include <sys/proxy.h> #include <sys/types.h> pid_t proxy, vproxy; nid_t nid; void main() { nid = 2; if( ( proxy = qnx_proxy_attach( 0, 0, 0, -1 ) ) == -1 ) { printf( "qnx_proxy_attach() failed: " ); printf( "errno = %d\n", errno ); } if( ( vproxy = qnx_proxy_rem_attach( nid, proxy ) ) == -1 ) { printf( "qnx_proxy_rem_attach() failed: " ); printf( "errno = %d\n", errno ); } /* * now set up a virtual circuit to a remote * process on node "nid" and send it a message * telling it about vproxy so it can Trigger * on it to wake us up */ /* Finished with virtual proxy -- release it */ qnx_proxy_rem_detach( nid, vproxy ); }
QNX
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | Yes, but modifies errno |
Thread | Yes |
errno, qnx_proxy_attach(), qnx_proxy_rem_detach(), Trigger()