develooper Front page | perl.perl5.porters | Postings from December 2010

getsockopt issues

Thread Next
From:
H.Merijn Brand
Date:
December 17, 2010 03:08
Subject:
getsockopt issues
Message ID:
20101217120821.021c8cfe@pc09.procura.nl
After way too many hours of debugging, I finally found - with a little
help from the postgres developers - a real annoying issue with sockets
on HP-UX 11.31, which I think is worthwhile sharing with you as it can
or might happen on other architectures as well.

Unix knows about two types of sockets ...

    Default DSB sockets:

      int getsockopt (
          int         s,
          int         level,
          int         optname,
          void       *optval,
          int        *optlen
          );

    UNIX 03 Only (X/Open Sockets):

      int getsockopt (
          int                    s,
          int                    level,
          int                    optname,
          void       *__restrict optval,
          socklen_t  *__restrict optlen
          );

Some background information can be found in 'man 7 xopen_networking:

 NAME
      xopen_networking - X/Open Networking Interfaces

 DESCRIPTION
      X/Open has defined Sockets and IP Address Resolution interfaces in
      X/Open CAE Specification, Networking Services, Issue 4 (UNIX 95),
      X/Open CAE Specification, Networking Services, Issue 5 (UNIX 98), and
      The Single UNIX Specification, Version 3, System Interfaces (UNIX 03).

      X/Open has also defined XTI in X/Open CAE Specification, Networking
      Services, Issue 4 (UNIX 95) and X/Open CAE Specification, Networking
      Services, Issue 5 (UNIX 98).  Beginning in UNIX 03, XTI is no longer
      part of The Single UNIX Specification.

      For more information on the specifications or a detailed description
      of the X/Open Networking Interfaces, please refer to the above
      specifications at The Open Group website, http://www.opengroup.org.

      Prior to HP-UX 11i v3, HP-UX is certified to UNIX 95 on PA-RISC and
      Integrity systems.  Beginning with HP-UX 11i v3, HP-UX is certified to
      UNIX 95 on PA-RISC systems and to UNIX 95 and UNIX 03 on Integrity
      systems.

etc etc

Now for the problem ...

Perl by default uses the default BSD sockets if nothing is specified to
do different. All tests pass, and everything works fine, as all
compiled perl modules will use the same default BSD sockets. Until ...

DBD::Pg starts failing to connect, whereas postgres' own test suite
passes all tests. What happened?

Postgres build process has put two extra defines in a template for
HP-UX, that makes the build process use the xopen socket system. Now
libpg.so expects xopen calls, and perl doesn't. Bang!

I've just rebuilt perl-5.12.2 with those extra requirements and all
tests passed. I will now install all the modules I also installed on
5.10.1 and test if everything still works. If so, and DBD::Pg will now
also pass (as well as all my other DBD's, like DBD::Oracle for which I
fear the worst), I will most likely apply a patch to hints/hpux.sh to
make xopen sockets the default on HP-UX 11.31 and up.

-- 
H.Merijn Brand  http://tux.nl      Perl Monger  http://amsterdam.pm.org/
using 5.00307 through 5.12 and porting perl5.13.x on HP-UX 10.20, 11.00,
11.11, 11.23 and 11.31, OpenSuSE 10.1, 11.0 .. 11.3 and AIX 5.2 and 5.3.
http://mirrors.develooper.com/hpux/           http://www.test-smoke.org/
http://qa.perl.org      http://www.goldmark.org/jeff/stupid-disclaimers/

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About