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 ok code for aix
#include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <string.h> #include <errno.h> #include <time.h> #include <procinfo.h> #include <sys/time.h> #include <sys/types.h> int main() { struct procentry64 procs; char arg0[64]; int pidc = getpid(); (void) getprocs64(procs, sizeof(struct procentry64), NULL, 0, &pidc, 1); /* this could work but search google AIX truncated command line in /usr/include/procinfo.h */ printf("process name %s\n",procs.pi_comm); /* get better result */ getargs(&procsinfo[numproc],sizeof(struct procsinfo),arg0,sizeof(arg0)); /* in order to have a NULL TERMINATED string */ arg0[sizeof(arg0)-1] = '\0'; printf("process name %s\n",arg0); return 0; }