delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-apps/2000/07/13/21:27:57

Mailing-List: contact cygwin-apps-help AT sourceware DOT cygnus DOT com; run by ezmlm
Sender: cygwin-apps-owner AT sourceware DOT cygnus DOT com
List-Subscribe: <mailto:cygwin-apps-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin-apps/>
List-Post: <mailto:cygwin-apps AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-apps-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/lists.html#faqs>
Delivered-To: mailing list cygwin-apps AT sources DOT redhat DOT com
Message-ID: <007f01bfed33$65263120$f7c723cb@lifelesswks>
From: "Robert Collins" <robert DOT collins AT itdomain DOT com DOT au>
To: "cygapp" <cygwin-apps AT sourceware DOT cygnus DOT com>
Subject: syslog access violation
Date: Fri, 14 Jul 2000 11:32:35 +1000
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 5.00.2919.6700
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700

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;
}

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019