Re: [patch 1/3] add basic accounting fields to taskstats

From: Shailabh Nagar
Date: Wed Aug 02 2006 - 11:29:52 EST

Jay Lan wrote:
Balbir Singh wrote:

Jay Lan wrote:

+#define TASK_COMM_LEN 16

We should find a way to keep this in sync with with the definition
in linux/sched.h (won't we a warning if both this header and
linux/sched.h are included together?)

I do not know how to sync it up. This header linux/taskstats.h is
meant to be included by userspace programs. If an application
happens to include linux/sched.h, which includes linux/time.h,
the application will very likely have compilation errors because
the "struct timespec" declaration in <linux/time.h> and <time.h>
are conflicting.

The <linux/acct.h> defines it to
#define ACCT_COMM 16

I can change our define to TS_COMM_LEN with remakes saying it
should be in sync with the TAKS_COMM_LEN defined in linux/sched.h.

This seems like a good enough way to do it. There's no real need for
the taskstats comm length to remain exactly in sync with the task struct's
comm length (by way of trying to include sched.h etc.) though avoiding the
compile error by renaming is desirable as Balbir pointed out.

Moreover, TASK_COMM_LEN in linux/sched.h isn't likely to change much -
if it increases and csa_acct users also really need the extra info provided,
taskstats can always be changed and version bumped up. If the size decreases
there's no harm done (strncpy should be sufficient protection).


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at