Qp0wChkPid()--Check Status for Process ID
Syntax
#include <sys/types.h> #include <qp0wpid.h> int Qp0wChkPid(pid_t pid, QP0W_PID_Data_T *pidinfo);
Service Program Name: QP0WPID
Default Public Authority: *USE
Threadsafe: Yes
The Qp0wChkPid() function returns the status and process table entry information for the process specified by the process ID pid.
Parameters
- pid
- (Input) The process ID of the process whose process table information is to
be returned. When pid has a value of binary 0, the process table
information for the current process is returned.
- *pidinfo
- (Output) A pointer to the QP0W_PID_Data_T structure. The process table entry information for the process identified by pid is stored in the location pointed to by the pidinfo parameter.
The structure QP0W_PID_Data_T is defined in <qp0wpid.h> header file as follows:
typedef struct QP0W_PID_Data_T { pid_t pid; pid_t ppid; pid_t pgrp; int status; unsigned int exit_status; } QP0W_PID_Data_T;
The members of the QP0W_PID_Data_T structure are as follows:
pid_t pid; | The process ID of the process. |
||||||||
pid_t ppid; | The process ID of the parent process. If
ppid has a value of binary 1, there is no parent process
associated with the process. |
||||||||
pid_t pgrp; | The process group ID of the process. |
||||||||
int status; | A collection of flag bits that describe the
current state of the process. The following flag bits can be set in
status:
|
||||||||
unsigned int exit_status; | Exit status of the process. This member only has
meaning if the status has been set to
QP0W_PID_TERMINATED. See the wait() function
for a description of the exit status for a process. |
Authorities
The process calling Qp0wChkPid() must have the appropriate authority to the process being examined. A process is allowed to examine the process table information for a process if at least one of the following conditions is true:
- The process is calling Qp0wChkPid() for its own
process.
- The process has *JOBCTL special authority defined in the process user
profile or in a current adopted user profile.
- The process is the parent of the process (the process being examined has a
parent process ID equal to the process ID of the process calling
Qp0wChkPid()).
- The real or effective user ID of the process matches the real or effective user ID of the process calling Qp0wChkPid().
Return Value
0 | Qp0wChkPid() was successful. | ||||||
value | Qp0wChkPid() was not successful.
The value returned indicates one of the following errors. Under some
conditions, value could indicate an error other than those listed
here.
|
Usage Notes
The Qp0wChkPid() function provides an IBM® i-specific way to obtain the process table information for the specified process.
Related Information
- The <sys/types.h> file (see Header Files for UNIX®-Type Functions)
- The <qp0wpid.h> file (see Header
Files for UNIX-Type Functions)
- The <signal.h> file (see Header
Files for UNIX-Type Functions)
- getpgrp()--Get Process Group ID
- getpid()--Get Process ID
- getppid()--Get Process ID of Parent Process
- Qp0wGetPgrp()--Get Process Group ID
- Qp0wGetPid()--Get Process ID
- Qp0wGetPPid()--Get Process ID of Parent
Process
- wait()--Wait for Child Process to End
API introduced: V3R6