From owner-freebsd-hackers Fri Sep 1 16:10:58 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from gatekeeper.tsc.tdk.com (gatekeeper.tsc.tdk.com [207.113.159.21]) by hub.freebsd.org (Postfix) with ESMTP id E593D37B424 for ; Fri, 1 Sep 2000 16:10:55 -0700 (PDT) Received: from imap.gv.tsc.tdk.com (imap.gv.tsc.tdk.com [192.168.241.198]) by gatekeeper.tsc.tdk.com (8.8.8/8.8.8) with ESMTP id QAA07594; Fri, 1 Sep 2000 16:10:41 -0700 (PDT) (envelope-from gdonl@tsc.tdk.com) Received: from salsa.gv.tsc.tdk.com (salsa.gv.tsc.tdk.com [192.168.241.194]) by imap.gv.tsc.tdk.com (8.9.3/8.9.3) with ESMTP id QAA01332; Fri, 1 Sep 2000 16:10:41 -0700 (PDT) (envelope-from Don.Lewis@tsc.tdk.com) Received: (from gdonl@localhost) by salsa.gv.tsc.tdk.com (8.8.5/8.8.5) id QAA14949; Fri, 1 Sep 2000 16:10:41 -0700 (PDT) From: Don Lewis Message-Id: <200009012310.QAA14949@salsa.gv.tsc.tdk.com> Date: Fri, 1 Sep 2000 16:10:40 -0700 In-Reply-To: <20000901152443.K46859@ringwraith.office1.bg> References: <58A002A02C5ED311812E0050044517F00D25DB@erlangen01.atrada.de> <20000901152443.K46859@ringwraith.office1.bg> X-Mailer: Mail User's Shell (7.2.6 beta(5) 10/07/98) To: Peter Pentchev , Alexander Maret Subject: Re: Redirect stdout/stderr to syslog [OFF-TOPIC] Cc: "'freebsd-hackers@freebsd.org'" Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Sep 1, 3:24pm, Peter Pentchev wrote: } Subject: Re: Redirect stdout/stderr to syslog [OFF-TOPIC] } On Fri, Sep 01, 2000 at 02:13:19PM +0200, Alexander Maret wrote: } > > -----Ursprungliche Nachricht----- } > > Von: Peter Pentchev [mailto:roam@orbitel.bg] } > > Gesendet: Freitag, 1. September 2000 14:00 } > > pipe your stdout/stderr to logger(1), and you're all set. } > > You may even } > > specify a facility/level to log with. } > > } > } > Thanks for your quick answer but I would prefer to } > do it entirely in C without calling external progs. } > I could think of a solution forking another child process } > which does the syslog logging and redirecting stdout/stderr } > of the execvped program via IPC to this child. } > } > But is there any easier solution? } } No, I don't think you can do anything cheaper than a fork and } a pipe(2). popen(), as suggested in another message, is pretty } much the same. I don't think stdio has a hook to capture all } the data a process is sending to a stream, and pass it to some } routine - that would be perfect, but unfortunately, I am not } aware of such a thing. I might be wrong though. It's not very widely implemented, so any code using it won't be portable, but take a look at the man page for fuopen(3). To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message