Get information about a server connection
Synopsis:
#include <sys/neutrino.h>
int ConnectServerInfo( pid_t pid,
int coid,
struct _server_info* info );
int ConnectServerInfo_r( pid_t pid,
int coid,
struct _server_info* info );
Arguments:
- pid
- The process ID of the owner of the connection, or 0 to search for the connection in the current process.
- coid
- The connection ID of the connection.
- info
- NULL, or a pointer to a
_server_info
structure where the function can store information about the connection.
For more information, see below.
Library:
libc
Use the -l c option to
qcc
to link against this library.
This library is usually included automatically.
Description:
The ConnectServerInfo() and ConnectServerInfo_r()
kernel calls get information about the connection coid owned
by process pid, and store it in the structure pointed to by
info. If the process doesn't have a connection
coid, the call scans for the next higher connection and
returns it if present. Otherwise, -1 is returned. If you wish to
check for the existence of an exact connection, you must compare the
returned connection with the coid you requested.
These functions are identical except in the way they indicate errors.
See the Returns section for details.
If the info argument is NULL,
ConnectServerInfo() ignores connections with dead servers and
skips to the next coid.
If info is non-NULL, the function fills in
the _server_info structure;
for connections with dead servers, it turns on the
_NTO_COF_DEAD bit in the flags field of the structure.
_server_info structure
The _server_info structure that info points to
includes at least the following members:
- uint32_t nd
- The server's node descriptor, a temporary numeric description
of a remote node; ND_LOCAL_NODE (or 0) is the descriptor for
the local node.
For more information, see the
Qnet Networking
chapter of the System Architecture guide.
- pid_t pid
- The server's process ID.
- int32_t chid
- The server's channel ID.
- int32_t scoid
- The server's connection ID.
- int32_t coid
- The client's connection ID.
- int16_t flags
- Flags that indicate the properties of the connection.
The bits include:
- _NTO_COF_CLOEXEC — the connection will be
closed when your process calls an
exec*() function to start a new process.
- _NTO_COF_DEAD — the connection is to a dead server.
- _NTO_COF_INSECURE (QNX Neutrino 6.6 or later) — the connection is insecure.
The kernel sets this flag on a connection if the client program replaces its process image
(e.g., by calling exec*())
with a setuid or setgid binary.
Until the process that owns the channel clears this flag, calls to
MsgDeliverEvent()
with an event type of SIGEV_MEMORY or SIGEV_THREAD
fail with an error of EACCES.
Returns:
A matched coid.
If an error occurs:
- ConnectServerInfo() returns -1 and sets
errno.
- ConnectServerInfo_r() returns the negative of a value from the Errors section
and doesn't set errno.
Errors:
- EFAULT
- A fault occurred when the kernel tried to access the buffers provided.
- EINVAL
- Process pid doesn't have a connection >= coid.
- ESRCH
- The process indicated by pid doesn't exist.
Classification:
QNX Neutrino
Safety: |
|
Cancellation point |
Yes |
Interrupt handler |
No |
Signal handler |
Yes |
Thread |
Yes |