iofunc_client_info_able()
Return information about a client connection, including abilities
Synopsis:
#include <sys/iofunc.h>
int iofunc_client_info_able ( resmgr_context_t * ctp,
const int ioflag,
struct _client_info ** info,
int flags,
struct _client_able abilities[],
const int nable );
Arguments:
- ctp
- A pointer to a resmgr_context_t structure that the resource-manager library uses to pass context information between functions.
- ioflag
- Zero, or the constant O_REALIDS. This argument is passed in the _IO_OPEN message during an open request. If you specify O_REALIDS, iofunc_client_info_able() swaps the real and effective values of the user and group IDs before returning. This is a QNX OS extension, to swap real and effective user and group IDs in an atomic operation.
- 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, or NULL if the _client_info structure is not required. For more information, see ConnectClientInfoExt(). If this argument is not NULL, the iofunc_client_info_able() function sets the _NTO_CI_UNABLE bit in the flags member if the client doesn't have all the indicated abilities.
- 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 ID
- abilities
- An array of struct _client_able structures that specifies the abilities that the client must have; see ConnectClientInfoAble().
- nable
- The number of entries in the abilities array. Currently, the maximum supported value is 100.
Library:
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
Description:
The iofunc_client_info_able() function fetches the info structure for the client, including its abilities. It calls ConnectClientInfoAble() to gather the information, based on the server connection ID found in ctp->info.scoid. If the info argument is not NULL, the function also gets information about that client connection, allocates a buffer, stores the information in the buffer, and stores a pointer to the buffer in the location that info points to. Use iofunc_client_info_ext_free() to free this buffer.
A server should test if the client has a specific ability only when it receives a request to perform a task that requires this ability, and not any sooner. For an explanation of why this is so, see the ConnectClientInfoAble() description.
Call iofunc_client_info_ext_free() to free the _client_info structure when you're done with it.
Returns:
- EOK
- Successful completion.
- EINVAL
-
One of the following occured:
- The client process is no longer valid.
- Either _NTO_CLIENTINFO_GETGROUPS or _NTO_CLIENTINFO_GETTYPEID was set in flags and info was NULL.
- O_REALIDS was set in ioflags and info was NULL.
- ENOMEM
- The function couldn't allocate the memory for the _client_info structure.
Classification:
Safety: | |
---|---|
Cancellation point | No |
Signal handler | Yes |
Thread | Yes |