-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathGETPID.C
48 lines (42 loc) · 1.64 KB
/
GETPID.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/* GPD.C -- 01/02/85 -- ES = 7.00 */
/*=========================================================*
* GETPID() -- Get the calling PID from the ENVIRON *
* table. PID is returned as a LONG. *
* K&R standard. *
* Usage: *
* LONG pid; *
* *
* pid = getpid(); *
*---------------------------------------------------------*
* VERSION DATE AUTHOR COMMENTS *
*---------------------------------------------------------*
* 0.01 09/19/84 cpg First Try. *
* 0.20 01/02/85 cpg Modified for QALIB.*
*=========================================================*
* INCLUDES: */
#include "portab.h"
#define E_SUCCESS 0L
#define E_TAB_NO 01
#define ET_BUFSIZ 32
EXTERN LONG s_get();
struct environ
{
LONG std_out; /* fnum for stdout */
LONG std_in; /* " " stdin */
LONG std_err; /* " " stderr */
LONG ovr_ly; /* " " loading prog. */
BYTE user,group;
WORD f_id; /* process family ID */
LONG pid; /* process ID (current) */
WORD rn_id; /* requestor node ID */
WORD rf_id; /* requestor family ID */
LONG r_pid; /* requestor process ID */
} en_ptr;
LONG getpid()
{
LONG sg_ret;
if( ( sg_ret = s_get(E_TAB_NO,0L,&en_ptr,ET_BUFSIZ)) < E_SUCCESS )
{
return( sg_ret );
} else return( en_ptr.pid );
}