[PATCH user-cr] Allow for logfile for kernel debug messages (v2)

Matt Helsley matthltc at us.ibm.com
Wed Oct 21 22:48:53 PDT 2009


On Wed, Oct 21, 2009 at 05:46:40PM -0400, Oren Laadan wrote:
> 
> Serge E. Hallyn wrote:
> > If unspecified, -1 will be sent for logfd to the kernel, and there
> > will be no debug log.   If specified, then checkpoint and restart
> > debug msgs will be sent to the logfile.
> 
> The new interface will cover error reporting, so when run without '-l'
> both 'checkpoint' and 'restart' (unless asked to run extra silently)
> need to provide a pipe to the syscall, and if an error occurs, display
> pull the error reason from the pipe and print it.

Of course if more than a pipe buf's worth of error data needs to be 
transferred then that scheme won't work very cleanly --
checkpoint/restart would always be a multi-task operation. (I just ran
into this issue with self-checkpoint.)

> 
> > 
> > Logfile is specified using -l LOGFILE or --logfile=LOGFILE, i.e.
> > 
> > 	checkpoint $pid -o ckpt.out -l ckpt.debug
> > 	restart -l rstr.debug -i ckpt.out
> > 
> > Changelog:
> > 	oct 21: take a --logall flag
> > 
> > Signed-off-by: Serge E. Hallyn <serue at us.ibm.com>
> > ---
> >  checkpoint.c |   34 ++++++++++++++++++++++++++++++----
> >  restart.c    |   47 +++++++++++++++++++++++++++++++++++++++++------
> >  2 files changed, 71 insertions(+), 10 deletions(-)
> > 
> > diff --git a/checkpoint.c b/checkpoint.c
> > index c116daf..553132c 100644
> > --- a/checkpoint.c
> > +++ b/checkpoint.c
> > @@ -32,6 +32,8 @@ static char usage_str[] =
> >  "\tOptions:\n"
> >  "  -h,--help             print this help message\n"
> >  "  -o,--output=FILE      write data to FILE instead of standard output\n"
> > +"  -l,--logfile=FILE     write kernel debug data to FILE (default=nowhere)\n"
> 
> Can the user ask to append the data to a file ?
> 
> Also, I'm thinking of adding --output-fd=FD (and then --logfile-fd=FD)
> to allow a user to first create suitable fds and then exec the program
> (that will allow to easily redirect input/output without adding endless
> options).

I like the output-fd idea. It means you don't need to be able to ask to
append -- it's implicit in the file position of the passed file
descriptor.

Cheers,
	-Matt Helsley


More information about the Containers mailing list