ConnectClientInfoExt()
Get extended information about a client connection
Synopsis:
#include <sys/neutrino.h>
int ConnectClientInfoExt( int scoid,
struct _client_info ** info,
int flags );
Arguments:
- scoid
- A server connection ID that identifies the client process that you want to get information about, or -1 to get information about the calling process. 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().
- info
- The address of a location where the function can store a pointer to a _client_info structure that the function can fill with information about the client. For more information, see below.
- flags
- Zero or more of the following:
- _NTO_CLIENTINFO_GETGROUPS — get the supplementary group IDs
- _NTO_CLIENTINFO_GETTYPEID — results in the type identifier being returned immediately after the last returned supplementary group
Library:
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
Description:
This call gets information about a client connection identified by scoid, allocates a buffer, stores the information in the buffer, and stores a pointer to the buffer in the location that info points to. Use ClientInfoExtFree() to free this buffer.
A server uses this function 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 ConnectClientInfoExt() function is an extended version of ConnectClientInfo() that can handle more than NGROUPS_MAX supplementary groups.
_client_info structure
The _client_info structure has at least the following members:
- pid_t pid
- The client's process ID.
- flags
-
- _NTO_CI_BKGND_PGRP — the client's process group is in the background.
- _NTO_CI_CHROOT — chroot() has been applied to the client process.
- _NTO_CI_ENDIAN_BIG — the client is on a big-endian machine.
- _NTO_CI_FULL_GROUPS — indicates that the client information contains the full group list. Set by ConnectClientInfoExt(), but not ConnectClientInfo().
- _NTO_CI_ORPHAN_PGRP — the client's process group has been orphaned.
- _NTO_CI_STOPPED — the client is stopped.
- _NTO_CI_TYPE_ID — the array of supplemetary group IDs is followed by the type ID.
- _NTO_CI_UNABLE — the client doesn't have the required abilities; see ConnectClientInfoAble(), procmgr_ability(), and procmgr_ability_create().
- struct _cred_info cred
- A _cred_info
structure that describes the user and group ID credentials of the sending process.
Note:The grouplist array in this structure doesn't include the primary group ID (unless it was also added as a supplementary group).
Returns:
0, or -1 if an error occurred (errno is set).
Errors:
- EFAULT
- A fault occurred when the kernel tried to access the buffers provided.
- EINVAL
- The process doesn't have a connection scoid.
- ENOMEM
- The function couldn't allocate the memory for the _client_info structure.
Classification:
Safety: | |
---|---|
Cancellation point | No |
Signal handler | Yes |
Thread | Yes |