bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can't build libposix


From: Bastien ROUCARIES
Subject: Re: Can't build libposix
Date: Thu, 16 Dec 2010 18:11:43 +0100
User-agent: KMail/1.13.5 (Linux/2.6.36; KDE/4.4.5; x86_64; ; )

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<address@hidden> 
> > > 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;
}




reply via email to

[Prev in Thread] Current Thread [Next in Thread]