reopen 384802
thanks

On Sep 22, SZALAY Attila <[EMAIL PROTECTED]> wrote:

> > I do not understand. Datagram sockets are connectionless, and our
> > default syslog daemon appears to cope with them.
> Not exactly.
> If you use only the syslog(3) function, you are right, but if you open a
> connection to syslog with openlog(3) in the begining of your application
> then you will be in trouble when syslog-ng listen in unix-dgram and have
> been reloaded. At least with the version 1.6.X of syslog-ng.
No. As you can verify using the attached program, the same system calls
are used no matter if you use openlog(3) or not.

> It's possible that in version 2.0 the syslog-ng could keep unix-dgram
> connections between reload, but I'm too conservative to change it. (If
There are no connections, datagram sockets are connectionless.

> you read the Changelog you could recognize the time when I
> changes /dev/log from unix-stream to unix-dgram. And the funny thins
> _is_ that because of this change I have to restart every daemon which
> send log messages. Because the running daemons couldn't recognize that
> unix-dgram /dev/log is no more.
Looks like your troubles were unrelated.
It can be easily verified using the attached test program, which creates
a datagram socket, that when the syslog daemon is restarted while it is
running the socket is reopened:

send(3, "<29>Sep 22 19:59:18 syslogtest: "..., 39, MSG_NOSIGNAL) = -1 
ECONNREFUSED (Connection refused)
close(3)                                = 0
socket(PF_FILE, SOCK_DGRAM, 0)          = 3
fcntl64(3, F_SETFD, FD_CLOEXEC)         = 0
connect(3, {sa_family=AF_FILE, path="/dev/log"}, 16) = 0
send(3, "<29>Sep 22 19:59:18 syslogtest: "..., 39, MSG_NOSIGNAL) = 39


> So, the thruth is that I'm not too brave to do this change. (I have to
> test a lot of daemons, before I could accept this change back.)
This does not justify closing the bug.


#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
#include <syslog.h>


int main (int argc, char *argv[])
{
    int counter = 0;

    openlog("syslogtest", 0, LOG_DAEMON);

    while (1) {
        syslog(LOG_NOTICE, "test: %d", counter++);
        sleep(1);
    }

    exit(0);
}


-- 
ciao,
Marco

Attachment: signature.asc
Description: Digital signature

Reply via email to