[Previous] [Contents] [Next]

ConnectClientInfo(), ConnectClientInfo_r()

Store information about a client connection

Synopsis:

#include <sys/neutrino.h>

int ConnectClientInfo( int scoid,
                       struct _client_info * info
                       int ngroups );

int ConnectClientInfo_r( int scoid,
                         struct _client_info * info
                         int ngroups );

Library:

libc

Description:

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

These calls store information about a client connection identified by process scoid in the info buffer. Each scoid refers to a particular process. The scoid is obtained from the struct _msg_info argument to MsgReceivev() or MsgInfo().

info structure

The parameters returned in info have at least the following members:

Member Description
uint32_t nd Client's node ID
pid_t pid Client'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. If the group array size is zero, the number of groups available in info.cred.ngroups is 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:

ConnectClientInfo()
If an error occurs, -1 is returned and errno is set. Any other value returned indicates success.
ConnectClientInfo_r()
EOK is returned on success. This function does NOT set errno. If an error occurs, any value in the Errors section may be returned.

Errors:

EFAULT
A fault occurred when the kernel tried to access the buffers provided.
EINVAL
Process doesn't have a connection scoid.

Classification:

QNX 6

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

See also:

ConnectServerInfo(), MsgInfo(), MsgReceivev(), ND_NODE_CMP(), netmgr_ndtostr(), netmgr_remote_nd(), netmgr_strtond()


[Previous] [Contents] [Next]