Chapter Contents

Previous

Next
getclientpid

getclientpid



Gets the Calling Application Process Identifier

Portability: SAS/C extension


SYNOPSIS
DESCRIPTION
RETURN VALUES
CAUTION
PORTABILITY
RELATED FUNCTIONS


SYNOPSIS

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

pid_t getclientpid(int domain, struct clientpid *clientpid);


int domain;                    /* the addressing domain               */
struct clientpid * clientpid;  /* pointer to the clientpid structure  */


DESCRIPTION

The getclientpid function is used to obtain the calling process's ID for input to the givesocket_pid and takesocket_pid functions.

The getclientpid function is similar to the getclientid function. However, it uses the clientpid structure instead and offers better performance and integrity.

The domain parameter contains the communications domain in which the sockets will be given and taken. If domain is 0 , then a default of AF_INET is used.

The clientpid parameter is a pointer to the following structure:

struct clientpid {
   int domain;                 /* addressing domain AF_INET          */
   char reserve4[4];           /* unused - set to binary zeros       */
   pid_t pid;                  /* client process id number           */
   char task[8];               /* unused - set to blanks (0x40)      */
   unsigned char flag;         /* options flag                       */
   char reserve3[3];           /* unused - set to binary zeros       */
   int sid;                    /* socket identifier                  */
   char reserve12[12];         /* unused - set to binary zeros       */
};

#define SO_CLOSE          0x01 /* used in clientpid structure        */


RETURN VALUES

If getclientpid succeeds, it returns the client's non-negative process ID. Otherwise, it returns a -1 , and sets errno to indicate the error.

Note:   

  1. The clientpid structure upon return will contain the following values:
    domain the domain of the socket to be taken, default = AF_INET.
    pid the process ID number of client process.
    All other fields in the clientpid structure are set to binary zeros (0x00).

  2. This function corresponds to the IBM BPX1GCL getclientid macro call when the FunctionCode=2. The purpose is strictly to provide input to the givesocket_pid and takesocket_pid functions.

  [cautionend]


CAUTION

The getclientpid function is available only for integrated sockets at OS/390 Version 1 Release 3 or later.


PORTABILITY

getclientid is not portable to UNIX operating systems. On a UNIX operating system, sockets can be transferred from parent to child processes when the child process has been created via the fork system call.


RELATED FUNCTIONS

getclientid, givesocket, takesocket, givesocket_pid, takesocket_pid


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.