X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Date: Wed, 2 Dec 2009 16:23:15 +0100 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: 1.7.0-67: syslog() not working properly - possible bug in writev() ? Message-ID: <20091202152315.GS8059@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <1NFlZ1-0LCxsG0 AT fwd11 DOT aul DOT t-online DOT de> <20091202100433 DOT GQ8059 AT calimero DOT vinschen DOT de> <1NFn3Y-2JTP6W0 AT fwd06 DOT aul DOT t-online DOT de> <20091202141753 DOT GR8059 AT calimero DOT vinschen DOT de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20091202141753.GR8059@calimero.vinschen.de> User-Agent: Mutt/1.5.20 (2009-06-14) Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com On Dec 2 15:17, Corinna Vinschen wrote: > On Dec 2 12:07, Christian Franke wrote: > > Corinna Vinschen wrote: > > > On Dec 2 10:31, Christian Franke wrote: > > > > I presume that the root of the problem is that the > > > > > > > > writev(fd, { {"< PRI >", . }, { "MSG", . } }, 2) > > > > used within syslog() sends "< PRI >" and "MSG" in > > > > two separate datagrams to /dev/log. > > > > > > > > > > Probably not. The "kernel:" message is generated if something is > > > available on /dev/kmsg, which shouldn't be the case. The only message > > > type generated there are exceptions catched by Cygwin. I'll have a > > > look into it. Thanks for the report. > > > > > > > > > > Another test: > > > > This sends one UDP package on 1.5, but two on 1.7: > > > > int sd = socket(AF_LOCAL, SOCK_DGRAM, 0); > > > > struct sockaddr_un sa; sa.sun_family = AF_LOCAL; > > strcpy(sa.sun_path, "/dev/log"); > > connect(sd, (struct sockaddr *)&sa, sizeof(sa)); > > > > struct iovec iv[2] = { { "<1>", 3 }, { "test: text", 10 } }; > > writev(sd, iv, 2); > > Yes, but... why is that a problem for syslog-ng? Shouldn't it have > to expect that a message comes in multiple UDP packages? Hmm. Ok, it's definitely a problem in Cygwin. Fortunately one which is easy to fix. The send() function splits messages into chunks to avoid the problem from KB 823764. However, it's not correc to do this for datagram sockets, so I added code to avoid this. The "kernel:" tag was also a Cygwin problem, apparently. The default facility is set to 0, which is equivalent to LOG_KERN. The "kernel:" is added by syslog-ng in this case. I changed vsyslog() so that LOG_KERN messages from user space are not possible anymore since the default facility is always set to LOG_USER if it's not set to some other non-LOG_KERN value already. Thanks for the report, Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple