[syslog-ng] Re: HP-UX pipe read errors

Andy G. avwadf002 at sneakemail.com
Thu Apr 27 00:25:48 CEST 2006


On 04/25/06 09:08, Andrew Gill wrote:
> Hello,
> 
> I'm new to syslog-ng and am trying to configure it to run on HP-UX 10.20
> and 11.11.  It seems to have problems reading from the /dev/log pipe.
> Each time a message is received on the pipe, syslog-ng hits an I/O error
> and closes the filehandle, and no more messages are received.  However,
> the first message is always processed correctly.
> 
> Here is my syslog-ng.conf:
>     source src {
>     pipe("/dev/log" pad_size(2048));
>     internal();
>     };
> 
>     destination d_file {
>     file("/var/adm/syslog-ng/messages"
>         owner(root)
>         group(systaff)
>         perm(0640)
>     );
>     };
> 
>     destination d_net {
>     tcp(testy port(1514));
>     };
> 
>     log {
>     source(src);
>     destination(d_file);
>     destination(d_net);
>     };
> 
> When I run syslog-ng in the foreground with debug and verbose options,
> this is what I see:
> 
>     io.c: Preparing fd 3 for reading
>     io.c: connecting using fd 6
>     connecting fd 6 to inetaddr testy, port 1514
>     syslog-ng version 1.6.10 starting
>     io.c: Preparing fd 6 for writing
>     io.c: Preparing fd 7 for writing
>     io.c: do_read: read() failed (errno 11), Resource temporarily
> unavailable
>       fd = 3, buffer = 00098b0, length = 2048
>     Marking fd 3 for closing.
>     Closing fd 3.
> 
> The do_read line is when the message is received.  syslog-ng continues
> to run, and internal messages (e.g. STATS) continue to show up on the
> local host and the remote loghost.
> 
> Any thoughts would be greatly appreciated.
> 
> -Andy
> 
> 

I think I figured this out...in libol's src/io.c an assumption is made that EAGAIN == EWOULDBLOCK, but this is not the case for HP-UX.

 > egrep "EAGAIN|EWOULD" /usr/include/sys/errno.h
#define        EAGAIN          11      /* No more processes            */
#define EWOULDBLOCK             246     /* Operation would block */

I applied the following change to src/io.c and recompiled libol, and it works correctly now.

-Andy

-- io.c.orig      Mon Mar 13 10:01:31 2006
+++ io.c        Mon Mar 13 10:01:31 2006
@@ -361,6 +361,7 @@
        case EINTR:
          continue;  /* FIXME: Is it really worth looping here,
                      * instead of in the select loop? */
+       case EAGAIN:
        case EWOULDBLOCK:  /* aka EAGAIN */
          return 0;
        case EPIPE:
@@ -415,6 +416,7 @@
                        continue;  /* FIXME: Is it really worth looping here,
                                    * instead of in the select loop? */
                case EWOULDBLOCK:  /* aka EAGAIN */
+               case EAGAIN:
                        return 0;
                case EPIPE:
                        werror("io.c: recvfrom() returned EPIPE! Treating it as EOF.\n");


More information about the syslog-ng mailing list