Subject: Re: [libssh2] [PATCH] AIX build fix

Re: [libssh2] [PATCH] AIX build fix

From: Tor Arntsen <tor_at_spacetec.no>
Date: Fri, 24 Nov 2006 11:10:33 +0100

On Nov 23, 23:43, Daniel Stenberg wrote:
>> #define events reqevents /* SVR3,4 pollfd member name */
>> #define revents rtnevents /* SVR3,4 pollfd member name */
>
>Now that's one pair of nasty defines!

Indeed.. dirty stuff. It makes perfectly fine locally-scoped names suddenly
become global. AIX has two different pollfd structs with differently named
fields, for 32 and 64 bits respectively. And they use the #defines to
re-adjust the field names.. there are obviously better ways to handle this,
but AIX seems to have had this since 4.3 at least. Maybe they have fixed
it in 5.3 (lots of other stuff is), but I'm still on 5.1 and can't check.

>Did you try to simply #undef events and revents in session.c after all the
>includes?

No, but something like that should work I guess. However, leaving .events
and .revents in libssh2.h would still lay an AIX developer open for trouble,*)
if for some reason that person tried to include <sys/poll.h> and <libssh2.h>
in the same file (directly or indirectly). So I think a private namespace
(as in the patch) would still be the best solution in principle, if it wasn't
for the API change.

-Tor

*) Obviously any AIX developer will get problems just by using the name
'events' in any code which includes <sys/poll.h>, with or without <libssh2.h>,
as it's not exactly an uncommon word..

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
libssh2-devel mailing list
libssh2-devel_at_lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libssh2-devel
Received on 2006-11-24