PERFORCE change 97172 for review

John Birrell jb at FreeBSD.org
Mon May 15 00:55:06 UTC 2006


http://perforce.freebsd.org/chv.cgi?CH=97172

Change 97172 by jb at jb_freebsd2 on 2006/05/15 00:54:02

	Synthesize a 'lwpsinfo_t' from a 'struct thread' for no other reason that
	to pass some more tests. I don't really understand why 'curlwpsinfo' is
	necessary. Perhaps that is just conevient on Solaris. As far as FreeBSD
	is concerned, why not just use 'curthread'?

Affected files ...

.. //depot/projects/dtrace/src/cddl/lib/libdtrace/psinfo.d#2 edit

Differences ...

==== //depot/projects/dtrace/src/cddl/lib/libdtrace/psinfo.d#2 (text+ko) ====

@@ -56,10 +56,39 @@
 	pr_addr = 0;
 };
 
+typedef struct lwpsinfo {
+	id_t	pr_lwpid;	/* thread ID. */
+	int	pr_flag;	/* thread flags. */
+	int	pr_pri;		/* thread priority. */
+	char	pr_state;	/* numeric lwp state */
+	char	pr_sname;	/* printable character for pr_state */
+	short	pr_syscall;	/* system call number (if in syscall) */
+	uintptr_t
+		pr_addr;	/* internal address of lwp */
+	uintptr_t
+		pr_wchan;	/* sleep address */
+} lwpsinfo_t;
+
+#pragma D binding "1.0" translator
+translator lwpsinfo_t < struct thread *T > {
+	pr_lwpid = T->td_tid;
+	pr_pri = T->td_priority;
+	pr_flag = T->td_flags;
+	pr_state = 0; /* XXX */
+	pr_sname = '?'; /* XXX */
+	pr_syscall = 0; /* XXX */
+	pr_addr = (uintptr_t)T;
+	pr_wchan = (uintptr_t)T->td_wchan;
+};
+
 inline psinfo_t *curpsinfo = xlate <psinfo_t *> (curthread->td_proc);
 #pragma D attributes Stable/Stable/Common curpsinfo
 #pragma D binding "1.0" curpsinfo
 
+inline lwpsinfo_t *curlwpsinfo = xlate <lwpsinfo_t *> (curthread);
+#pragma D attributes Stable/Stable/Common curlwpsinfo
+#pragma D binding "1.0" curlwpsinfo
+
 /*
  * ppid, uid and gid are used frequently enough to merit their own inlines...
  */


More information about the p4-projects mailing list