* Re: [Xen-changelog] [xen-unstable] xenstored: Do not write to stderr if we are daemonised! [not found] <200708011653.l71GrIcp032245@xenbits.xensource.com> @ 2007-08-01 18:03 ` John Levon 2007-08-01 18:12 ` Keir Fraser 2007-08-01 18:20 ` Daniel P. Berrange 0 siblings, 2 replies; 7+ messages in thread From: John Levon @ 2007-08-01 18:03 UTC (permalink / raw) To: xen-devel On Wed, Aug 01, 2007 at 09:53:17AM -0700, Xen patchbot-unstable wrote: > + > + /* Get ourselves a nice xenstored crash if these are used. */ > + stdin = NULL; > + stdout = NULL; > + stderr = NULL; You cannot assign to std* on Solaris, this becomes: (&__iob[0]) = 0; (&__iob[1]) = 0; (&__iob[2]) = 0; which obviously won't compile. regards, john ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Re: [Xen-changelog] [xen-unstable] xenstored: Do not write to stderr if we are daemonised! 2007-08-01 18:03 ` [Xen-changelog] [xen-unstable] xenstored: Do not write to stderr if we are daemonised! John Levon @ 2007-08-01 18:12 ` Keir Fraser 2007-08-01 18:22 ` John Levon 2007-08-01 22:36 ` Alan Cox 2007-08-01 18:20 ` Daniel P. Berrange 1 sibling, 2 replies; 7+ messages in thread From: Keir Fraser @ 2007-08-01 18:12 UTC (permalink / raw) To: John Levon, xen-devel On 1/8/07 19:03, "John Levon" <levon@movementarian.org> wrote: >> + >> + /* Get ourselves a nice xenstored crash if these are used. */ >> + stdin = NULL; >> + stdout = NULL; >> + stderr = NULL; > > You cannot assign to std* on Solaris, this becomes: > > (&__iob[0]) = 0; > (&__iob[1]) = 0; > (&__iob[2]) = 0; > > which obviously won't compile. Okay, I'll fix this by redirecting xprintf() to trace() and get rid of the NULL assignments. -- Keir ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Re: [Xen-changelog] [xen-unstable] xenstored: Do not write to stderr if we are daemonised! 2007-08-01 18:12 ` Keir Fraser @ 2007-08-01 18:22 ` John Levon 2007-08-01 22:36 ` Alan Cox 1 sibling, 0 replies; 7+ messages in thread From: John Levon @ 2007-08-01 18:22 UTC (permalink / raw) To: Keir Fraser; +Cc: xen-devel On Wed, Aug 01, 2007 at 07:12:22PM +0100, Keir Fraser wrote: > > You cannot assign to std* on Solaris, this becomes: > > > > (&__iob[0]) = 0; > > (&__iob[1]) = 0; > > (&__iob[2]) = 0; > > Okay, I'll fix this by redirecting xprintf() to trace() and get rid of the > NULL assignments. Thanks! BTW, you mentioned a new 3.1 release some time soon. Is there something we can usefully be doing to help this happen? (Certainly me doing some testing of 3.1 at all would help...) The bug fixes I care most about offhand are the ones that finish implementing the xen api. regards, john ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Re: [Xen-changelog] [xen-unstable] xenstored: Do not write to stderr if we are daemonised! 2007-08-01 18:12 ` Keir Fraser 2007-08-01 18:22 ` John Levon @ 2007-08-01 22:36 ` Alan Cox 1 sibling, 0 replies; 7+ messages in thread From: Alan Cox @ 2007-08-01 22:36 UTC (permalink / raw) To: Keir Fraser; +Cc: xen-devel, John Levon > Okay, I'll fix this by redirecting xprintf() to trace() and get rid of the > NULL assignments. You are guaranteed to be able to freopen() stdin/stdout/stderr and that is a portable C feature. This means you can divert the stdin/out/err to a log file to catch such accidents or at least avoid future problems by firing them down /dev/null. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Re: [Xen-changelog] [xen-unstable] xenstored: Do not write to stderr if we are daemonised! 2007-08-01 18:03 ` [Xen-changelog] [xen-unstable] xenstored: Do not write to stderr if we are daemonised! John Levon 2007-08-01 18:12 ` Keir Fraser @ 2007-08-01 18:20 ` Daniel P. Berrange 2007-08-01 18:32 ` Keir Fraser 1 sibling, 1 reply; 7+ messages in thread From: Daniel P. Berrange @ 2007-08-01 18:20 UTC (permalink / raw) To: John Levon; +Cc: xen-devel On Wed, Aug 01, 2007 at 07:03:23PM +0100, John Levon wrote: > On Wed, Aug 01, 2007 at 09:53:17AM -0700, Xen patchbot-unstable wrote: > > > + > > + /* Get ourselves a nice xenstored crash if these are used. */ > > + stdin = NULL; > > + stdout = NULL; > > + stderr = NULL; > > You cannot assign to std* on Solaris, this becomes: > > (&__iob[0]) = 0; > (&__iob[1]) = 0; > (&__iob[2]) = 0; > > which obviously won't compile. Yep, rather than closing FD's and setting the FILE* to NULL, the daeon code should re-open /dev/null for stdin/out/err which is the traditional approach for most UNIX daemons. if (dofork) { int devnull; devnull = open(_PATH_DEVNULL, O_RDWR); close(STDIN_FILENO); close(STDOUT_FILENO); close(STDERR_FILENO); dup2(devnull, STDIN_FILENO); dup2(devnull, STDOUT_FILENO); dup2(devnull, STDERR_FILENO); close(devnull); } (With error checking on open/close/dup2 of ccourse) Regards, Dan. -- |=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=| |=- Perl modules: http://search.cpan.org/~danberr/ -=| |=- Projects: http://freshmeat.net/~danielpb/ -=| |=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=| ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Re: [Xen-changelog] [xen-unstable] xenstored: Do not write to stderr if we are daemonised! 2007-08-01 18:20 ` Daniel P. Berrange @ 2007-08-01 18:32 ` Keir Fraser 2007-08-01 18:35 ` John Levon 0 siblings, 1 reply; 7+ messages in thread From: Keir Fraser @ 2007-08-01 18:32 UTC (permalink / raw) To: Daniel P. Berrange, John Levon; +Cc: xen-devel Good idea. Can't use _PATH_DEVNULL easily though, since it'll break Solaris again (no paths.h). Hardcoding /dev/null is not so bad -- the console daemon does this already. -- Keir On 1/8/07 19:20, "Daniel P. Berrange" <berrange@redhat.com> wrote: > Yep, rather than closing FD's and setting the FILE* to NULL, the daeon > code should re-open /dev/null for stdin/out/err which is the traditional > approach for most UNIX daemons. > > if (dofork) { > int devnull; > devnull = open(_PATH_DEVNULL, O_RDWR); > close(STDIN_FILENO); > close(STDOUT_FILENO); > close(STDERR_FILENO); > dup2(devnull, STDIN_FILENO); > dup2(devnull, STDOUT_FILENO); > dup2(devnull, STDERR_FILENO); > close(devnull); > } ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Re: [Xen-changelog] [xen-unstable] xenstored: Do not write to stderr if we are daemonised! 2007-08-01 18:32 ` Keir Fraser @ 2007-08-01 18:35 ` John Levon 0 siblings, 0 replies; 7+ messages in thread From: John Levon @ 2007-08-01 18:35 UTC (permalink / raw) To: Keir Fraser; +Cc: xen-devel, Daniel P. Berrange On Wed, Aug 01, 2007 at 07:32:59PM +0100, Keir Fraser wrote: > Good idea. Can't use _PATH_DEVNULL easily though, since it'll break Solaris > again (no paths.h). Hardcoding /dev/null is not so bad -- the console daemon > does this already. I'm somewhat bemused as to the purpose of _PATH_DEVNULL - is this different on Hurd or something? regards john ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2007-08-01 22:36 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <200708011653.l71GrIcp032245@xenbits.xensource.com>
2007-08-01 18:03 ` [Xen-changelog] [xen-unstable] xenstored: Do not write to stderr if we are daemonised! John Levon
2007-08-01 18:12 ` Keir Fraser
2007-08-01 18:22 ` John Levon
2007-08-01 22:36 ` Alan Cox
2007-08-01 18:20 ` Daniel P. Berrange
2007-08-01 18:32 ` Keir Fraser
2007-08-01 18:35 ` John Levon
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.