harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexey Varlamov" <alexey.v.varla...@gmail.com>
Subject Re: [porting] FreeBSD (rambling)
Date Fri, 26 Jan 2007 17:43:41 GMT
2007/1/26, Tim Ellison <t.p.ellison@gmail.com>:
> Mark Hindess wrote:
> > There is one slightly odd failure.  The hyerror last error message is
> > not null at startup.  I suspect it is the nls catalog that is not found
> > because there is no way to find the executable name.  (The portlib
> > executable name function only works if either:
> >
> > a) we are on linux (and /proc is mounted)
> >
> > b) we pass in argv[0]
> >
> > but clearly a) isn't true and at the point of the call argv[0] isn't
> > available.  I'm not sure how to fix this.  (If we insist that /proc
> > is mounted on FreeBSD we might resolve it here but /proc is a little
> > different on FreeBSD *and* it is not mounted by default.  Besides this
> > isn't really a generic solution.)
>
> Don't know the answer off the top of my head, and a quick grep around
> the APR code implies that they don't provide an equivalent to
> hysysinfo_get_executable_name.  Still may be worth asking over there
> (I'll proxy for you if you don't get round to it), or in an equivalent
> forum.

Well, we alredy iterated on this problem, and I recall some solution
was proposed but not verified, quoting the message:
-----------------------------------------
Well, with a bit of googling I've managed to obtain the following snippet [1]:
       if (dladdr( addr, &info ) != 0)
       {
               strncpy( path, info.dli_fname, PATH_MAX );
               *(strrchr( path, '/' )) = '\0';
       }

"The dladdr() function shall query the dynamic linker for information
about the shared object containing the address addr." [2]
Moreover, google reports about "dladdr" in a variety of manuals,
including BSD, SGI, MacOS, Solaris etc, I've listed some of the links
below.
So this  looks like a silver bullet for us :)

[1] http://lists.trolltech.com/qt-interest/2003-11/msg00380.html
[2] http://refspecs.freestandards.org/LSB_3.0.0/LSB-Core-generic/LSB-Core-generic/baselib-dladdr-3.html
[3] http://developer.apple.com/documentation/Darwin/Reference/ManPages/man3/dladdr.3.html
[4] http://docs.sun.com/app/docs/doc/816-5168/6mbb3hr4c?a=view
----------------------------------------
I tried the snippet on a microtest on SUSE9, it worked.

Alexey

>
> Regards,
> Tim
>

Mime
View raw message