getclientid() — Get the 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 identifier by which
the calling application is known to the TCP/IP address space. The clientid can
be used in the givesocket() and takesocket() calls. However, this
function is supplied for use by existing programs that depend on the
address space name returned. Even for these programs it is recommended
that the name be saved for its later use and the __getclientid() function
be issued to reconstruct the clientid structure for use by givesocket()
and takesocket().
- Parameter
- Description
- domain
- The address domain requested.
- clientid
- The pointer to a clientid structure to be filled.
The clientid structure is filled in by the call and returned as follows:
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_name.name
- The application program's address space name, left-justified and padded with blanks.
- subtaskname
- The calling program's task identifier.
- c_reserved
- Specifies 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.