Le jeudi 16 décembre 2010 16:50:50, Bastien ROUCARIES a écrit : > Le dimanche 12 décembre 2010 06:38:24, Peter O'Gorman a écrit : > > On 12/11/2010 11:09 PM, Bastien ROUCARIES wrote: > > > On Sun, Dec 12, 2010 at 10:04 AM, Peter O'Gorman<pe...@pogma.com> > > > wrote: > > > > > > for aix and hpux i have posted some code snipped > > > > hpux code works for me once I change the typo'ed getppid to getpid. > > > > I can't find the AIX code you mention. > > > > Peter > On IRIX we could get program name using this code:
#include <sys/proc.h> /* needed for process state constants */ #include <sys/statvfs.h> #include <sys/types.h> #include <stdlib.h> #include <stdio.h> int main() { char pathpid[256]; struct statvfs svfs; int pfd; struct prpsinfo psbuf; /* check if proc is mounted */ if( statvfs("/proc", &svfs) == -1 ) return 77; snprintf(pathpid, sizeof(pathpid),"/proc/pinfo/%i",getpid()); pfd = open( pathbuf, O_RDONLY ); if(pfd == -1) return 77; if( ioctl(psdata, PIOCPSINFO, &psbuf) == -1 ) return 77; close(pfd) ; printf("command name %s\n",psbuf.pr_fname); return 0; }