Gets arguments of a process.
Standard C library (libc.a)
#include <procinfo.h> #include <sys/types.h>
int getargs (processBuffer, bufferLen, argsBuffer, argsLen)
struct procsinfo *processBuffer
or struct procentry64 *processBuffer;
The getargs subroutine returns a list of parameters that were passed to a command when it was started. Only one process can be examined per call to getargs.
The getargs subroutine uses the pi_pid field of processBuffer to determine which process to look for. bufferLen should be set to the size of struct procsinfo or struct procentry64. Parameters are returned in argsBuffer, which should be allocated by the caller. The size of this array must be given in argsLen.
On return, argsBuffer consists of a succession of strings, each terminated with a null character (ascii `\0'). Hence, two consecutive NULLs indicate the end of the list.
Note: The arguments may be changed asynchronously by the process, but results are not guaranteed to be consistent.
If successful, the getargs subroutine returns zero. Otherwise, a value of -1 is returned and the errno global variable is set to indicate the error.
The getargs subroutine
does not succeed if the following are true:
|EBADF||The specified process does not exist.|
|EFAULT||The copy operation to the buffer was not successful or the processBuffer or argsBuffer parameters are invalid.|
|EINVAL||The bufferLen parameter does not contain the size of a single procsinfo or procentry64 structure.||
This subroutine is part of the Base Operating System (BOS) Runtime.
The getevars (getevars Subroutine), getpid (getpid, getpgrp, or getppid Subroutine), getpgrp (getpid, getpgrp, or getppid Subroutine), getppid (getpid, getpgrp, or getppid Subroutine), getprocs or getthrds (getthrds Subroutine) subroutines.
The ps command.