Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

kvm_getcmd(3kvm) [sunos man page]

kvm_getu(3KVM)						    Kernel VM Library Functions 					    kvm_getu(3KVM)

NAME
kvm_getu, kvm_getcmd - get the u-area or invocation arguments for a process SYNOPSIS
cc [ flag... ] file... -lkvm [ library...] #include <kvm.h> #include <sys/param.h> #include <sys/user.h> #include <sys/proc.h> struct user *kvm_getu(kvm_t *kd, struct proc *proc); int kvm_getcmd(kvm_t *kd, struct proc *proc, struct user *u, char ***arg, char ***env); DESCRIPTION
The kvm_getu() function reads the u-area of the process specified by proc to an area of static storage associated with kd and returns a pointer to it. Subsequent calls to kvm_getu() will overwrite this static area. The kd argument is a pointer to a kernel descriptor returned by kvm_open(3KVM). The proc argument is a pointer to a copy in the current process's address space of a proc structure, obtained, for instance, by a prior kvm_nextproc(3KVM) call. The kvm_getcmd() function constructs a list of string pointers that represent the command arguments and environment that were used to ini- tiate the process specified by proc. The kd argument is a pointer to a kernel descriptor returned by kvm_open(3KVM). The u argument is a pointer to a copy in the current process's address space of a user structure, obtained, for instance, by a prior kvm_getu() call. If arg is not NULL, the command line argu- ments are formed into a null-terminated array of string pointers. The address of the first such pointer is returned in arg. If env is not NULL, the environment is formed into a null-terminated array of string pointers. The address of the first of these is returned in env. The pointers returned in arg and env refer to data allocated by malloc() and should be freed by a call to free() when no longer needed. See malloc(3C). Both the string pointers and the strings themselves are deallocated when freed. Since the environment and command line arguments might have been modified by the user process, there is no guarantee that it will be possi- ble to reconstruct the original command at all. The kvm_getcmd() function will make the best attempt possible, returning -1 if the user process data is unrecognizable. RETURN VALUES
On success, kvm_getu() returns a pointer to a copy of the u-area of the process specified by proc. On failure, it returns NULL. The kvm_getcmd() function returns 0 on success and -1 on failure. If -1 is returned, the caller still has the option of using the command line fragment that is stored in the u-area. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Stable | +-----------------------------+-----------------------------+ |MT-Level |Unsafe | +-----------------------------+-----------------------------+ SEE ALSO
kvm_nextproc(3KVM), kvm_open(3KVM), kvm_kread(3KVM), malloc(3C), libkvm(3LIB), attributes(5) NOTES
On systems that support both 32-bit and 64-bit processes, the 64-bit implementation of libkvm ensures that the arg and env pointer arrays for kvm_getcmd() are translated to the same form as if they were 64-bit processes. Applications that wish to access the raw 32-bit stack directly can use kvm_uread(). See kvm_read(3KVM). SunOS 5.10 2 May 2002 kvm_getu(3KVM)

Check Out this Related Man Page

kvm_nextproc(3KVM)					    Kernel VM Library Functions 					kvm_nextproc(3KVM)

NAME
kvm_nextproc, kvm_getproc, kvm_setproc - read system process structures SYNOPSIS
cc [ flag... ] file... -lkvm [ library...] #include <kvm.h> #include <sys/param.h> #include <sys/time.h> #include <sys/proc.h> struct proc *kvm_nextproc(kvm_t *kd); int kvm_setproc(kvm_t *kd); struct proc *kvm_getproc(kvm_t *kd, pid_t pid); DESCRIPTION
The kvm_nextproc() function reads sequentially all of the system process structures from the kernel identified by kd (see kvm_open(3KVM)). Each call to kvm_nextproc() returns a pointer to the static memory area that contains a copy of the next valid process table entry. There is no guarantee that the data will remain valid across calls to kvm_nextproc(), kvm_setproc(), or kvm_getproc(). If the process structure must be saved, it should be copied to non-volatile storage. For performance reasons, many implementations will cache a set of system process structures. Since the system state is liable to change between calls to kvm_nextproc(), and since the cache may contain obsolete information, there is no guarantee that every process structure returned refers to an active process, nor is it certain that all processes will be reported. The kvm_setproc() function rewinds the process list, enabling kvm_nextproc() to rescan from the beginning of the system process table. This function will always flush the process structure cache, allowing an application to re-scan the process table of a running system. The kvm_getproc() function locates the proc structure of the process specified by pid and returns a pointer to it. Although this function does not interact with the process table pointer manipulated by kvm_nextproc(), the restrictions regarding the validity of the data still apply. RETURN VALUES
On success, kvm_nextproc() returns a pointer to a copy of the next valid process table entry. On failure, it returns NULL. On success, kvm_getproc() returns a pointer to the proc structure of the process specified by pid. On failure, it returns NULL. The kvm_setproc() function returns 0 on success and -1 on failure. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Stable | +-----------------------------+-----------------------------+ |MT-Level |Unsafe | +-----------------------------+-----------------------------+ SEE ALSO
kvm_getu(3KVM), kvm_open(3KVM), kvm_kread(3KVM), attributes(5) SunOS 5.10 2 May 2002 kvm_nextproc(3KVM)
Man Page