Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!malgudi!uoft02.utoledo.edu!grx0736 From: grx0736@uoft02.utoledo.edu Newsgroups: comp.unix.internals Subject: Re: C program to get pid of process Message-ID: <1991Apr26.172515.3340@uoft02.utoledo.edu> Date: 26 Apr 91 17:25:15 EST Lines: 42 this follows my earlier mail regarding pid of running processes. I have tried writing a small program which looks somthing like : main(argc, argv) int argc; char **argv; { kvm_t *kd; struct proc *myproc; struct user *u; char ***arg; char ***env; int cmd_return; int mypid; scanf("%d", &mypid); kd = kvm_open(NULL, NULL, NULL, O_RDONLY, argv[0]); while(1) { myproc = kvm_nextproc(kd); if(myproc->p_pid == mypid) printf("your process found\n"); u = kvm_getu(kd, myproc); cmd_return = kvm_getcmd(kd, myproc, u, arg, env); } } the program gets the proc structures corresponding to all the processes, but when i call kvm_getcmd, nothing is being assigned to arg . Sun manuals say that after the call arg will point to the command infomation of the process corresponding to myproc. however, when i run this program, arg and env always point to nil. but the call to kvm_getcmd returns 0 (zero) indicating that the call was successful. any help in the above matter would be highly appreciated. sunil kulkarni