[PATCH 01/12] define a new set of functions for error and debug logging

Oren Laadan orenl at librato.com
Tue Nov 3 08:58:35 PST 2009



serue at us.ibm.com wrote:
> From: Serge E. Hallyn <serue at us.ibm.com>
> 
> The checkpoint context now includes buffers for an expanded
> format and for messages to be written out.  A mutex protects
> these buffers as they are being built up and written out.
> ckpt_msg() will write general informative (debug) messages to
> syslog and an optional user-provided logfile.  ckpt_err() will
> write errors to the same places, and, if it is a checkpoint
> operation, also to the checkpoint image.
> 
> (This is intended to implement Oren's suggestion verbatim)
> 
> Signed-off-by: Serge E. Hallyn <serue at us.ibm.com>

[...]

> +void _ckpt_msg_complete(struct ckpt_ctx *ctx)
> +{
> +	int ret;
> +
> +	if (ctx->kflags & CKPT_CTX_CHECKPOINT) {
> +		ret = ckpt_write_obj_type(ctx, NULL, 0, CKPT_HDR_ERROR);

The _ckpt_msg_... interface is (will be?) used also for non-errors.
So writing and error record should also depend on ctx->errno, to be
set by someone before (ckpt_err ?)

> +		if (!ret)
> +			ret = ckpt_write_string(ctx, ctx->msg, ctx->msglen);
> +		if (ret < 0)
> +			printk(KERN_NOTICE "c/r: error string unsaved (%d): %s\n",
> +			       ret, ctx->msg+1);
> +	}
> +#if 0
> +	if (ctx->logfile) {
> +		mm_segment_t fs = get_fs();
> +		set_fs(KERNEL_DS);
> +		ret = _ckpt_kwrite(ctx->logfile, ctx->msg+1, ctx->msglen-1);
> +		set_fs(fs);
> +	}
> +#endif

This piece perhaps belongs to another patch ?

[...]

Oren.



More information about the Containers mailing list