On Fri, Jan 24, 2003 at 04:58:05PM +0100, Roberto Nibali wrote:
Syslog-ng has been running on a couple of Unixes and nobody complained about EWOULDBLOCK. I think it is defined as EAGAIN on most platforms.
*Portability Note:* In many older Unix systems, this condition was indicated by `EWOULDBLOCK', which was a distinct error code different from `EAGAIN'. To make your program portable, you should check for both codes and treat them the same.
IIRC I tried but gcc then complained I have two case statements in my switch with the same value.
I have one last question to bother you. I'm scanning through your code and I've found following code snippet in src/afinet.c:do_init_afinet_dest(...):
self->conn_fd = io_connect(cfg->backend, fd, self->super.dest_addr, make_afsocket_dest_connected(cfg->backend, &self->super));
if (self->conn_fd) { return ST_OK | ST_GOON; } else { if (errno == ECONNREFUSED) { ^^^^^^^^^^^^^^^^^^^^^^^^^^ This yields different behaviour on Linux and Solaris for link state down and primary link flushed interfaces.
This case was added especially to handle Solaris. The fd here is set into non-blocking mode in which case Linux _always_ returns EINPROGRESS, the poll loop then checks for writability and calls the callback for afsocket_dest_connected. (probably defined in afsocket.c) On the other hand Solaris returned ECONNREFUSED when connecting to a local socket immediately regardless whether the fd was set into non-blocking mode. Thus I reinit when I get ECONNREFUSED or in the connected callback called from the main loop.
I'm talking about the ECONNREFUSED. Why do you only _reinit() when you get a connection refused and not all the time? Consider following usage: You start syslog-ng before the interface is up (link state up and primary address assigned). In your case you'd do no new _reinit(). What's the hitch in removing this 'if'-part?
Syslog-ng currently does not start if initialization fails. If the interface is not up or the routing table not complete syslog-ng might not start. This was intended at the time I implemented this code. This decision might not be the best but I wouldn't bother fixing those as I am currently rewriting syslog-ng from scratch. (see my announcement about the 1.9.x branch) -- Bazsi PGP info: KeyID 9AF8D0A9 Fingerprint CD27 CFB0 802C 0944 9CFD 804E C82C 8EB1