Virtual Memory access
Jit Keong Tan
jit at SLIC.CELLBIO.DUKE.EDU
Wed Jun 5 05:16:56 AEST 1991
Is there a system call similar to the kvm_getu on SUN ?
Man page on SUN follows:
KVM_GETU(3K) KERNEL VM LIBRARY FUNCTIONS KVM_GETU(3K)
NAME
kvm_getu, kvm_getcmd - get the u-area or invocation argu-
ments for a process
SYNOPSIS
#include <kvm.h>
#include <sys/param.h>
#include <sys/user.h>
#include <sys/proc.h>
struct user *kvm_getu(kd, proc)
kvm_t *kd;
struct proc *proc;
int kvm_getcmd(kd, proc, u, arg, env)
kvm_t *kd;
struct proc *proc;
struct user *u;
char ***arg;
char ***env;
DESCRIPTION
kvm_getu() 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.
kd is a pointer to a kernel identifier returned by
kvm_open(3K). proc is a pointer to a copy (in the current
process' address space) of a proc structure (obtained, for
instance, by a prior kvm_nextproc(3K) call). As a side
effect, kvm_getu() sets the address space used to resolve
user addresses in subsequent kvm_read() and kvm_write()
calls to be the space belonging to proc.
kvm_getcmd() constructs a list of string pointers that
represent the command arguments and environment that were
used to initiate the process specified by proc.
kd is a pointer to a kernel identifier returned by
kvm_open(3K). u is a pointer to a copy (in the current pro-
cess' address space) of a user structure (obtained, for
instance, by a prior kvm_getu() call). If arg is not NULL,
then the command line arguments 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,
then 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(3V) and should be freed (by a call to free (see
Sun Release 4.1 Last change: 1 July 1990 1
KVM_GETU(3K) KERNEL VM LIBRARY FUNCTIONS KVM_GETU(3K)
malloc(3V)) when no longer needed. Both the string pointers
and the strings themselves are deallocated when freed.
Since the environment and command line arguments may have
been modified by the user process, there is no guarantee
that it will be possible to reconstruct the original command
at all. Thus, kvm_getcmd() will make the best attempt pos-
sible, returning -1 if the user process data is unrecogniz-
able.
Thanks in advance.
--------------------------------------------------------
Jit Keong Tan | internet: jit at slic.cellbio.duke.edu
(919) 684-8098 | bitnet : tan00001 at dukemc.bitnet
--------------------------------------------------------
U.S. Mail:
Duke University Medical Center
Department Of Cell Biology
Box 3709
Nanaline Duke Bldg, Rm. 349
Durham, NC 27710
More information about the Comp.sys.sgi
mailing list