__getclientid() — Get the PID identifier for the calling application

Standards

Standards / Extensions C or C++ Dependencies
z/OS® UNIX both  

Format

#define _OPEN_SYS_SOCK_EXT
#include <sys/socket.h>
#include <sys/types.h>

int __getclientid(int domain, struct clientid *clientid);

General description

The __getclientid() function call returns the process identifier (PID) by which the calling application is known to the TCP/IP address space. The clientid is used in the givesocket() and takesocket() calls. Use the __getclientid() function call to transfer sockets between the caller and the selected application. The __getclientid() function provides improved performance and integrity over the getclientid() function for applications that use the output of __getclientid() as input clientids for givesocket() and takesocket().
Parameter
Description
domain
The address domain requested.
clientid
The pointer to a clientid structure to be filled.
The clientid structure:
      struct clientid {
         int domain;
         union  {
           char name[8];
           struct {
             int NameUpper;
             pid_t pid;
           } c_pid;
         } c_name;
         char subtaskname[8];

         struct  {
           char type;
           union  {
              char specific[19];
              struct  {
                char unused[3];
                int SockToken;
              } c_close;
           } c_func;
         } c_reserved;
      };
Element
Description
domain
The input domain value returned in the domain field of the clientid structure.
c_pid.pid
Is the label in the clientid structure that is filled in by the function call to the PID of the requester (caller of __getclientid()). It should be left as set because it is used by the takesocket() and givesocket() functions.
subtaskname
Blanks
c_reserved
Binary zeros

Returned value

If successful, __getclientid() returns 0.

If unsuccessful, __getclientid() returns -1 and sets errno to one of the following values:
Error Code
Description
EFAULT
Using the clientid parameter as specified would result in an attempt to access storage outside the caller's address space, or storage not modifiable by the caller.

Related information