Store information about a client connection
#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 );
- A server connection ID that identifies the client process that you want to get information about. This client is typically a process that's made a connection to the server to try to access a resource. You can get it from the _msg_info argument to MsgReceivev() or MsgInfo() .
- A pointer to a _client_info structure that the function can fill with information about the client. For more information, see below.
- The size of the caller's grouplist in the credential part of the _client_info structure. If you make it smaller than NGROUPS_MAX, you might get information only about a subset of the groups.
Use the -l c option to qcc to link against this library. This library is usually included automatically.
These calls get information about a client connection identified by scoid, and store it in the buffer that info points to.
These functions can handle no more than NGROUPS_MAX supplementary groups. For more groups, use ConnectClientInfoExt() instead.
The ConnectClientInfo() and ConnectClientInfo_r() functions are identical except in the way they indicate errors. See the Returns section for details.
A server uses these functions to determine whether or not a client has permission to access a resource. For example, in a resource manager, it would be called on an open() connection request.
The _client_info structure has at least the following members:
- uint32_t nd
- The client's node descriptor, a temporary numeric description of a remote node; ND_LOCAL_NODE (or 0) is the descriptor for the local node.
- pid_t pid
- The client's process ID.
- pid_t sid
- Used internally by Qnet.
- _NTO_CI_ENDIAN_BIG — the client is on a big-endian machine.
- _NTO_CI_BKGND_PGRP — the client's process group is in the background.
- _NTO_CI_ORPHAN_PGRP — the client's process group has been orphaned.
- _NTO_CI_STOPPED — the client is stopped.
- _NTO_CI_UNABLE — used internally.
- _NTO_CI_FULL_GROUPS — indicates that the client information contains the full group list. Set by ConnectClientInfoExt(), but not ConnectClientInfo().
- struct _cred_info cred
- The user and group ID credentials; a _cred_info structure that includes at least
the following members:
- uid_t ruid
- The real user ID of the sending process.
- uid_t euid
- The effective user ID of the sending process.
- uid_t suid
- The saved user ID of the sending process.
- gid_t rgid
- The real group ID of the sending process.
- gid_t egid
- The effective group ID of the sending process.
- gid_t sgid
- The saved group ID of the sending process.
- uint32_t ngroups
- The number of groups actually stored in grouplist.
- gid_t grouplist[NGROUPS_MAX]
- The supplementary group IDs of the sending process.
The ngroups argument to ConnectClientInfo() indicates the size of the grouplist array. If the group array size is zero, the ngroups member of the _cred_info is set to the number of groups available.
The only difference between these functions is the way they indicate errors:
- If an error occurs, the function returns -1 and sets errno . Any other value returned indicates success.
- EOK is returned on success. This function does NOT set errno. If an error occurs, the function can return any value in the Errors section.
- A fault occurred when the kernel tried to access the buffers provided.
- Process doesn't have a connection scoid.
Last modified: 2013-12-23