[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: libposix stuff
From: |
Bastien ROUCARIES |
Subject: |
Re: libposix stuff |
Date: |
Tue, 9 Nov 2010 13:31:03 +0100 |
User-agent: |
KMail/1.13.5 (Linux/2.6.34-1-amd64; KDE/4.4.5; x86_64; ; ) |
Le lundi 8 novembre 2010 23:09:47, Bruce Korb a écrit :
> On 11/08/10 13:29, Ralf Wildenhues wrote:
> >> [...] "a.out" format:
> >> char *program_name;
> >>
> >> this on a line by itself was both a declaration and a definition.
> >
> > On OS X that may just be the case because libtool forces -fno-common
> > (for some good reason, but I tend to forget what it was), which disables
> > common sections.
>
> I didn't think my memory was getting that bad.....
>
> Then what is the solution? It would not feel right to require programs
> that are asking for "libposix" to also call a non-posix function just
> because it is convenient for the error POSIX module. If it is only OS X,
> then I would think that this would work:
>
> char * program_name;
> #ifdef OSX //whatever
> #pragma weak program_invocation_name // program_name not being
> program_name. #endif
>
> requiring a call to set_program_name just seems so wrong for a posix lib.
For weak section under macosx see :
- http://developer.apple.com/library/mac/#technotes/tn2002/tn2064.html
-
http://stackoverflow.com/questions/274753/how-to-make-weak-linking-work-with-gcc
BTW it is not possible to replace program_invocation_name by a call to a
function like errno/__errno_location and
thus use a dynamic buffer allocated on the first run of the function and call
sysctl to get argv[0] on self
It will also allow to use the pstat command under hpux
(http://docs.hp.com/en/B2355-90682/pstat.2.html)
pst_ucomm field is the name of the program.
Bastien
- Re: error.c has an unnecessary dependency on "program_name", (continued)
- Re: libposix stuff, Bruce Korb, 2010/11/08
- Re: libposix stuff, Gary V. Vaughan, 2010/11/08
- Re: libposix stuff, Ralf Wildenhues, 2010/11/08
- Re: libposix stuff, Bruce Korb, 2010/11/08
- Re: libposix stuff, Eric Blake, 2010/11/08
- Re: libposix stuff, Bruce Korb, 2010/11/08
- Re: libposix stuff, Thien-Thi Nguyen, 2010/11/09
- Re: libposix stuff,
Bastien ROUCARIES <=
- Re: libposix stuff, Bastien ROUCARIES, 2010/11/15
- Re: libposix stuff, Bastien ROUCARIES, 2010/11/22