Subject: Re: lwp id in ktrace
To: Emmanuel Dreyfus <>
From: Christos Zoulas <>
List: tech-kern
Date: 12/01/2003 12:30:32
On Dec 1,  3:52pm, (Emmanuel Dreyfus) wrote:
-- Subject: Re: lwp id in ktrace

| What's wrong with shortening the name string so that we get enough extra
| bytes to point to a xheader record? Having the old binary displaying
| shorter names is better than having it displaying nothing...

That is a cute idea. Do we really need the backwards compatibility though,
at the expense of making the file a lot larger? There is of course the
following hack that gives backwards compatibility and lwpid if < 64K:

struct ktr_header {
	int	ktr_len;		/* length of buf */
	u_short	ktr_lwpid;		/* lwp id */
	u_short	ktr_type;		/* trace record type */
	u_short	ktr_lwpid;		/* lwp id */
	pid_t	ktr_pid;		/* process id */
	char	ktr_comm[MAXCOMLEN+1];	/* command name */
	struct	timeval ktr_time;	/* timestamp */
	void   *ktr_buf;

Which is not that ugly, retains backwards compatibility and works unless
you have more than 64K of lwps.