HP-UX (IA64) sendmsg() failed

nginx nginx-1.2.1
OS HP-UX B.11.23 U ia64
built by gcc 4.2.3

When I start the nginx server,it throws some errors.

The error.log contains
2012/06/11 16:46:07 [notice] 6820#0: using the “/dev/poll” event method
2012/06/11 16:46:07 [notice] 6820#0: nginx/1.2.1
2012/06/11 16:46:07 [notice] 6820#0: built by gcc 4.2.3
2012/06/11 16:46:07 [notice] 6820#0: getrlimit(RLIMIT_NOFILE):
10240:10240
2012/06/11 16:46:07 [notice] 6821#0: start worker processes
2012/06/11 16:46:07 [notice] 6821#0: start worker process 6822
2012/06/11 16:46:07 [notice] 6821#0: start worker process 6823
2012/06/11 16:46:07 [alert] 6821#0: sendmsg() failed (9: Bad file
number)
2012/06/11 16:46:07 [notice] 6821#0: start worker process 6824
2012/06/11 16:46:07 [alert] 6821#0: sendmsg() failed (9: Bad file
number)
2012/06/11 16:46:07 [alert] 6821#0: sendmsg() failed (9: Bad file
number)
2012/06/11 16:46:07 [notice] 6821#0: start worker process 6825
2012/06/11 16:46:07 [alert] 6821#0: sendmsg() failed (9: Bad file
number)
2012/06/11 16:46:07 [alert] 6821#0: sendmsg() failed (9: Bad file
number)
2012/06/11 16:46:07 [alert] 6821#0: sendmsg() failed (9: Bad file
number)

Someone help me.
Thank you very much!

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,227421,227421#msg-227421

Maybe this one:
http://mailman.nginx.org/pipermail/nginx/2007-January/000588.html

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,227421,227425#msg-227425

Hello!

On Mon, Jun 11, 2012 at 05:08:38AM -0400, wwwyq2003 wrote:

2012/06/11 16:46:07 [notice] 6820#0: getrlimit(RLIMIT_NOFILE):
number)
Thank you very much!
The following patch should help:

HG changeset patch

User Maxim D. [email protected]

Date 1339809190 -14400

Node ID 94e0eb86b0d0743f8ddbe946f142b35d6a606e2e

Parent 87049097aab36ec42513ccb8f015c3ce59edeff3

Fixed “sendmsg() failed” alerts on HP-UX.

HP-UX needs _HPUX_ALT_XOPEN_SOCKET_API to be defined to be able to
use various POSIX versions of networking functions. Notably sendmsg()
resulted in “sendmsg() failed (9: Bad file number)” alerts without it.

See xopen_networking(7) for more details.

diff --git a/auto/os/conf b/auto/os/conf
— a/auto/os/conf
+++ b/auto/os/conf
@@ -48,6 +48,7 @@ case “$NGX_PLATFORM” in
CORE_DEPS="$UNIX_DEPS $POSIX_DEPS"
CORE_SRCS="$UNIX_SRCS"
CC_AUX_FLAGS="$CC_AUX_FLAGS -D_XOPEN_SOURCE
-D_XOPEN_SOURCE_EXTENDED=1"

  •    CC_AUX_FLAGS="$CC_AUX_FLAGS -D_HPUX_ALT_XOPEN_SOCKET_API"
    

    ;;

    OSF1:*)
    diff --git a/src/os/unix/ngx_posix_config.h
    b/src/os/unix/ngx_posix_config.h
    — a/src/os/unix/ngx_posix_config.h
    +++ b/src/os/unix/ngx_posix_config.h
    @@ -12,6 +12,7 @@
    #if (NGX_HPUX)
    #define _XOPEN_SOURCE
    #define _XOPEN_SOURCE_EXTENDED 1
    +#define _HPUX_ALT_XOPEN_SOCKET_API
    #endif

Maxim D.