[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: determining the program_invocation_name
From: |
Bastien ROUCARIES |
Subject: |
Re: determining the program_invocation_name |
Date: |
Sat, 25 Dec 2010 17:30:48 +0100 |
> Find attached a collection of the platform dependent code snippets.
> I added code for Cygwin, mingw (from progreloc.c), and OSF/1, and
> tested it on the various platforms.
See also http://stackoverflow.com/questions/799679
for bsd:
int mib[4];
mib[0] = CTL_KERN;
mib[1] = KERN_PROC;
mib[2] = KERN_PROC_PATHNAME;
mib[3] = -1;
char buf[1024];
size_t cb = sizeof(buf);
sysctl(mib, 4, buf, &cb, NULL, 0);
and under hpux see
http://htmlcoderhelper.com/get-full-path-of-executable-of-running-process-on-hpux/
and
http://nixdoc.net/man-pages/hp-ux/man2/pstat_getpathname.2.html
and
http://h21007.www2.hp.com/portal/site/dspp/menuitem.863c3e4cbcdc3f3515b49c108973a801?ciid=88086d6e1de021106d6e1de02110275d6e10RCRD
on irix we could get the inode of the exec file (no perfect but unique)
Thus it will be sufficient for human reporting
Bastien