[Previous] [Contents] [Next]

ConnectServerInfo(), ConnectServerInfo_r()

Store information about a 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 );

Library:

libc

Description:

The ConnectServerInfo() and ConnectServerInfo_r() functions are identical except in the way they indicate errors. See the Returns section for details.

These kernel calls store information about the connection coid owned by process pid into 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.

info structure

The parameters returned in info at least the following members:

Member Description
uint32_t nd Server's's node ID
pid_t pid Server's process ID
struct _cred_info cred User and group ID credentials

cred structure

The cred member has at least the following members:

Member Description
uid_t ruid Real user-ID of sending process.
uid_t euid Effective user-ID of sending process.
uid_t suid Saved user-ID of sending process.
gid_t rgid Real group-ID of sending process.
gid_t egid Effective group-ID of sending process.
gid_t sgid Saved group-ID of sending process.
uint32_t ngroups Number of groups in grouplist.
gid_t grouplist[NGROUPS_MAX] Supplementary group-IDs of sending process.

The ngroups argument indicates the size of the callers grouplist in the credential. Making it smaller than NGROUPS_MAX may result in a subset of the groups being returned.

This call is used by a server to check if a client has permissions to access a resource. In a resource manager, it would be called on an open() request.

uint32_t nd

The nd node descriptor is a magic cookie.

To: Use this function:
Compare two nd objects ND_NODE_CMP()
Convert a nd to text netmgr_ndtostr()
Convert text to a nd netmgr_strtond()

Returns:

The only difference between these functions is the way they indicate errors:

ConnectServerInfo()
A matched coid. If an error occurs, -1 is returned and errno is set.
ConnectServerInfo_r()
A matched coid. This function does NOT set errno. If an error occurs, the negative of a value from the Errors section is returned.

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 6

Safety:
Cancellation point Yes
Interrupt handler No
Signal handler Yes
Thread Yes

See also:

ConnectAttach(), ConnectClientInfo(), MsgInfo(), MsgReceivev(), ND_NODE_CMP(), netmgr_ndtostr(), netmgr_remote_nd(), netmgr_strtond()


[Previous] [Contents] [Next]