OpenVZ Forum


Home » Mailing lists » Devel » Re: [PATCH] Use helpers to obtain task pid in printks (arch code)
Re: [PATCH] Use helpers to obtain task pid in printks (arch code) [message #19786] Mon, 27 August 2007 18:01 Go to next message
Joe Perches is currently offline  Joe Perches
Messages: 3
Registered: August 2007
Junior Member
On Mon, 2007-08-27 at 11:30 +0400, Pavel Emelyanov wrote:
> From: Alexey Dobriyan <adobriyan@openvz.org>
> 
> One of the easiest things to isolate is the pid printed in kernel
> log. There was a patch, that made this for arch-independent code,
> this one makes so for arch/xxx files.

Perhaps it would be worthwhile to standardize the printk
task information content? Maybe a format knob?

Maybe TASK_FMT/TASK_ARG(task)

#define TASK_FMT "%s"
#define TASK_ARG(tsk) ({char __buf[MAX_TASK_INFO]; print_task(tsk, buf, sizeof(__buf)); __buf})

char* print_task(const struct task_struct* tsk, char* buf, size_t size)
{
	char* p = buf;
	int task_knob = get_task_knob();
	*p++ = '[';
	if (task_knob & feature)
		p += snprintf(p, size - (p - buf), fmt, feature);
	[...]
	*p++ = ']';
	return buf;
}
EXPORT_SYMBOL(print_task)


_______________________________________________
Containers mailing list
Containers@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
Re: [PATCH] Use helpers to obtain task pid in printks (arch code) [message #19856 is a reply to message #19786] Thu, 30 August 2007 19:11 Go to previous message
Jan Engelhardt is currently offline  Jan Engelhardt
Messages: 18
Registered: August 2006
Junior Member
On Aug 27 2007 11:01, Joe Perches wrote:
>On Mon, 2007-08-27 at 11:30 +0400, Pavel Emelyanov wrote:
>> From: Alexey Dobriyan <adobriyan@openvz.org>
>> 
>> One of the easiest things to isolate is the pid printed in kernel
>> log. There was a patch, that made this for arch-independent code,
>> this one makes so for arch/xxx files.
>
>Perhaps it would be worthwhile to standardize the printk
>task information content? Maybe a format knob?
>
>Maybe TASK_FMT/TASK_ARG(task)
>
>#define TASK_FMT "%s"
>#define TASK_ARG(tsk) ({char __buf[MAX_TASK_INFO]; print_task(tsk, buf, sizeof(__buf)); __buf})

Except that __buf goes out of scope before printk() is called...



	Jan
-- 
_______________________________________________
Containers mailing list
Containers@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
Previous Topic: user namespaces config option
Next Topic: Re: [PATCH] Send quota messages via netlink
Goto Forum:
  


Current Time: Thu Aug 15 10:02:04 GMT 2024

Total time taken to generate the page: 0.02862 seconds