Re: PostgreSQL X/Open Socket / BSD Socket Issue on HP-UX

Поиск
Список
Период
Сортировка
От MUHAMMAD ASIF
Тема Re: PostgreSQL X/Open Socket / BSD Socket Issue on HP-UX
Дата
Msg-id BAY164-W55AF2AFC937E1D3C5B488BFF0C0@phx.gbl
обсуждение исходный текст
Ответ на Re: PostgreSQL X/Open Socket / BSD Socket Issue on HP-UX  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: PostgreSQL X/Open Socket / BSD Socket Issue on HP-UX
Список pgsql-hackers
Very sorry for late reply.
You are right, _xpg_ socket functionality is not available in older systems, it is available in hp-ux 11.23 version
throughpatch HCO_35744 . HPUX 10.20 is very old machine (1996). I am using latest HPUX B.11.31 machine, I don't have
accessto older systems. -D_XOPEN_SOURCE_EXTENDED make the postgres build X/Open Socket enabled including connector's
i.elibpq. Now if system default 64bit perl (BSD Socket) try to use libpq (X/Open Socket) it will end up in unexpected
resultsor errors . HP-UX don't allow mixing of X/Open Socket objects and BSD Socket objects in the same 64bit binary,
HPtried to fix this issue through -D_HPUX_ALT_XOPEN_SOCKET_API on later version of OS. It seems nice that if postgres
adoptthis fix at least for connectors (PFA patch, minor change in src/interfaces/libpq/Makefile) and so that users on
laterhp-ux boxes don't trouble with these socket issues  and connect their applications to database server with the
helpof libpq without the fear of X/Open Socket or BSD Socket complexity. On older system defining
_HPUX_ALT_XOPEN_SOCKET_APIshould do no effects or issues. Thanks. 
( http://docstore.mik.ua/manuals/hp-ux/en/B2355-60130/xopen_networking.7.html )..................
HP-UX provides two styles of Sockets API:
    - default BSD Sockets    -X/Open Sockets
These two styles of Sockets API have the same function names but they have differences in semantics and argument types.
Forexample, the optlen field in X/Open getsockopt() is size_t type, while BSD getsockopt() is int type. In 64 bit mode,
size_tis 64 bit and int is still 32 bit. 
Linking objects compiled to X/Open Sockets specification and objects compiled to BSD Sockets specification in the same
programusing the linkage method in method A would erroneously resolve BSD Sockets calls to X/Open Sockets functions in
theXnet library. As a result, the program may result in application core dumps or unexpected Socket errors when it is
run.These symptoms commonly occur when BSD Sockets accept(), getpeername(), getsockname(), getsockopt(), recvfrom(),
sendmsg(),and recvmsg() are called. 
..................
Best Regards,Muhammad Asif Naeem

----------------------------------------
> To: anaeem.it@hotmail.com
> CC: pgsql-hackers@postgresql.org
> Subject: Re: [HACKERS] PostgreSQL X/Open Socket / BSD Socket Issue on HP-UX
> Date: Tue, 20 Sep 2011 18:06:55 -0400
> From: tgl@sss.pgh.pa.us
>
> MUHAMMAD ASIF <anaeem.it@hotmail.com> writes:
> > I faced similar issue as discussed in
"http://postgresql.1045698.n5.nabble.com/Fwd-DBD-Pg-on-HP-UX-11-31-64bit-td3305163.html".
> > (man xopen_networking - http://docstore.mik.ua/manuals/hp-ux/en/B2355-60130/xopen_networking.7.html) ... There are
twoways to obtain X/Open Sockets functionality:     * Method A is in compliance with X/Open compilation specification.
 * Method B slightly deviates from X/Open compilation specification. However, Method B allows a program to include both
objectscompiled to X/Open Sockets specification and objects compiled to BSD Sockets specification. ... 
> > PostgreSQL support X/Open Sockets. Apache web server (2.2.15, /opt/hpws22/apache) and Perl (5.8.8, /opt/perl_64)
areBSD Socket applications that are default with the OS. I tried Method B (It provides wrapper _xpg_ socket functions
thatallows using X/Open socket objects and BSD socket objects in the same binary) to build PostgreSQL 9.1 code, I
LD_PRELOADthe generated libpq binary, without any other change both perl and apache work fine with postgresql now,and
itis easy to implement too. We just need to build the source code with "-D_XOPEN_SOURCE=600
-D_HPUX_ALT_XOPEN_SOCKET_API"and link binary with libc. PFA patch. Thanks. 
>
> AFAICT, the proposed patch will break things on at least some versions
> of HPUX. You can't just arbitrarily remove the reference to -lxnet,
> at least not without explaining to us why the existing comment about it
> is wrong. Likewise, removing -D_XOPEN_SOURCE_EXTENDED isn't
> acceptable without a whole more supporting evidence than you've
> provided. (I'm fairly certain that the latter will break the build on
> my old HPUX 10.20 box, for example.)
>
> regards, tom lane

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Heikki Linnakangas
Дата:
Сообщение: Re: WIP: SP-GiST, Space-Partitioned GiST
Следующее
От: Alexander Korotkov
Дата:
Сообщение: Re: WIP: SP-GiST, Space-Partitioned GiST