This is the mail archive of the cygwin-apps@sources.redhat.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: syslog access violation


Oops.. just found the #define for debug_printf.... I'll be able to answer my
onw question now...


----- Original Message -----
From: "Robert Collins" <robert.collins@itdomain.com.au>
To: "cygapp" <cygwin-apps@sourceware.cygnus.com>
Sent: Friday, July 14, 2000 11:32 AM
Subject: syslog access violation


> Hi everyone,
>     I posted a week or so about a problem with daemon (squid), when it
> closed fd(2). I've tracked that down a bit more as there were remaining
> problems, and found that fd(1) and fd(2) can't be closed by the daemon or
> syslog dies, either that or something called by syslog. I haven't got gdb
> attaching to the daemon properly yet so I have been // code lines..
arghh...
>
> The question is:
> Looking through syslog.cc, debug_printf is used quite a bit. Does this
write
> to fd 1 or 2?
> Call me silly but I can't find the code for debug_printf to check
myself...
>
> I wrote a test package that does a similar call sequence to the daemon,
but
> it doesn't stackdump or access violate, so I assume it must be a
combination
> of other activies undertaken by the child process...
>
>
>
> #include <stdio.h>
> #include <sys/syslog.h>
>
> int main (int argc, char **argv)
> {
> int i;
> int pid,status;
>
>    openlog("testparent", LOG_PID | LOG_NDELAY | LOG_CONS, LOG_LOCAL4);
>    if ((pid = fork()) < 0)
>        syslog(LOG_ALERT, "fork failed: %m");
>    else if (pid > 0)
>        exit(0);
>
> closelog();
> for(i=0;i<8192;i++)
> close(i);
> if ((pid=fork()) == 0){
> openlog("test",LOG_PID|LOG_NDELAY|LOG_CONS, LOG_LOCAL4);
> syslog(LOG_ALERT,"syslog call from test");
> }
> openlog("test",LOG_PID|LOG_NDELAY|LOG_CONS, LOG_LOCAL4);
> syslog(LOG_ALERT,"syslog call from test");
> pid=waitpid(-1,&status,0);
> syslog(LOG_ALERT,"syslog call from test");
>
> return 0;
> }
>
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]