svn commit: r186702 - user/netchild/linuxulator-dtrace/src/sys/compat/linux

Alexander Leidinger netchild at FreeBSD.org
Fri Jan 2 13:56:46 UTC 2009


Author: netchild
Date: Fri Jan  2 13:56:45 2009
New Revision: 186702
URL: http://svn.freebsd.org/changeset/base/186702

Log:
  - Add some more dtrace probes.
  - Convert my dtrace scripts to a 2-clause BSD license.
  - Extend the dtrace scripts with lock profiling statistics code
    and unsupported linuxulator functionality messages.
  - Remove some superflous function prototypes.
  
  This is only compile tested.

Modified:
  user/netchild/linuxulator-dtrace/src/sys/compat/linux/check_emul_lock.d
  user/netchild/linuxulator-dtrace/src/sys/compat/linux/check_error.d
  user/netchild/linuxulator-dtrace/src/sys/compat/linux/linux_sysctl.c
  user/netchild/linuxulator-dtrace/src/sys/compat/linux/linux_time.c
  user/netchild/linuxulator-dtrace/src/sys/compat/linux/linux_uid16.c
  user/netchild/linuxulator-dtrace/src/sys/compat/linux/stats_timing.d

Modified: user/netchild/linuxulator-dtrace/src/sys/compat/linux/check_emul_lock.d
==============================================================================
--- user/netchild/linuxulator-dtrace/src/sys/compat/linux/check_emul_lock.d	Fri Jan  2 13:48:02 2009	(r186701)
+++ user/netchild/linuxulator-dtrace/src/sys/compat/linux/check_emul_lock.d	Fri Jan  2 13:56:45 2009	(r186702)
@@ -13,8 +13,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission
  *
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
@@ -34,6 +32,8 @@
  * Check if the emul lock is correctly acquired/released:
  *  - no recursive locking
  *  - no unlocking of already unlocked one
+ *
+ * Print stacktrace if the emul_lock is longer locked than about 10sec or more.
  */
 
 linuxulator*::emul_locked
@@ -47,6 +47,11 @@ linuxulator*::emul_locked
 linuxulator*::emul_locked
 {
 	++check[probeprov, arg0];
+
+	ts = timestamp;
+	spec = speculation();
+	printf("Stacktrace of last lock operation of the emul_lock:\n");
+	stack();
 }
 
 linuxulator*::emul_unlock
@@ -61,6 +66,14 @@ linuxulator*::emul_unlock
 
 linuxulator*::emul_unlock
 {
+	discard(spec);
+	spec = 0;
 	--check[probeprov, arg0];
 }
 
+tick-10s
+/spec != 0 && timestamp - ts >= 9999999000/
+{
+	commit(spec);
+	spec = 0;
+}

Modified: user/netchild/linuxulator-dtrace/src/sys/compat/linux/check_error.d
==============================================================================
--- user/netchild/linuxulator-dtrace/src/sys/compat/linux/check_error.d	Fri Jan  2 13:48:02 2009	(r186701)
+++ user/netchild/linuxulator-dtrace/src/sys/compat/linux/check_error.d	Fri Jan  2 13:56:45 2009	(r186702)
@@ -13,8 +13,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission
  *
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
@@ -30,11 +28,35 @@
  * $FreeBSD$
  */
 
-/* Report error conditions. */
+/*
+ * Report error conditions:
+ *  - emulation errors (unsupportet stuff, unknown stuff, ...)
+ *  - kernel errors (resource shortage, ...)
+ *  - programming errors (errors which can happen, but should not happen)
+ */
 
 linuxulator*:emul:proc_exit:child_clear_tid_error,
 linuxulator*:emul:proc_exit:futex_failed,
-linuxulator*:emul:linux_schedtail:copyout_error
+linuxulator*:emul:linux_schedtail:copyout_error,
+linuxulator*:time:linux_clock_gettime:conversion_error,
+linuxulator*:time:linux_clock_gettime:gettime_error,
+linuxulator*:time:linux_clock_gettime:copyout_error,
+linuxulator*:time:linux_clock_settime:conversion_error,
+linuxulator*:time:linux_clock_settime:settime_error,
+linuxulator*:time:linux_clock_settime:copyout_error,
+linuxulator*:time:linux_clock_getres:conversion_error,
+linuxulator*:time:linux_clock_getres:gettime_error,
+linuxulator*:time:linux_clock_getres:copyout_error,
+linuxulator*:time:linux_nanosleep:conversion_error,
+linuxulator*:time:linux_nanosleep:nanosleep_error,
+linuxulator*:time:linux_nanosleep:copyout_error,
+linuxulator*:time:linux_nanosleep:copyin_error,
+linuxulator*:time:linux_clock_nanosleep:copyin_error,
+linuxulator*:time:linux_clock_nanosleep:conversion_error,
+linuxulator*:time:linux_clock_nanosleep:copyout_error,
+linuxulator*:time:linux_clock_nanosleep:nanosleep_error,
+linuxulator*:sysctl:handle_string:copyout_error,
+linuxulator*:sysctl:linux_sysctl:copyin_error
 {
 	printf("ERROR: %s in %s:%s:%s\n", probename, probeprov, probemod, probefunc);
 	stack();
@@ -42,7 +64,8 @@ linuxulator*:emul:linux_schedtail:copyou
 }
 
 linuxulator*:util:linux_driver_get_name_dev:nullcall,
-linuxulator*:util:linux_driver_get_major_minor:nullcall
+linuxulator*:util:linux_driver_get_major_minor:nullcall,
+linuxulator*:time:linux_clock_getres:nullcall
 {
 	printf("WARNING: %s:%s:%s:%s in application %s, maybe an application error?\n", probename, probeprov, probemod, probefunc, execname);
 	stack();
@@ -56,3 +79,30 @@ linuxulator*:util:linux_driver_get_major
 	/* ustack(); */ /* needs to be enabled when PID tracing is available in FreeBSD dtrace */
 }
 
+linuxulator*:time:linux_to_native_clockid:unknown_clockid
+{
+	printf("INFO: Application %s tried to use unknown clockid %d. Please report this to freebsd-emulation at FreeBSD.org.\n", execname, arg0);
+}
+
+linuxulator*:time:linux_to_native_clockid:unsupported_clockid,
+linuxulator*:time:linux_clock_nanosleep:unsupported_clockid
+{
+	printf("WARNING: Application %s tried to use unsupported clockid (%d), this may or may not be a problem for the application.\nPatches to support this clockid are welcome on the freebsd-emulation at FreeBSD.org mailinglist.\n", execname, arg0);
+}
+
+linuxulator*:time:linux_clock_nanosleep:unsupported_flags
+{
+	printf("WARNING: Application %s tried to use unsupported flags (%d), this may or may not be a problem for the application.\nPatches to support those flags are welcome on the freebsd-emulation at FreeBSD.org mailinglist.\n", execname, arg0);
+}
+
+linuxulator*:sysctl:linux_sysctl:wrong_length
+{
+	printf("ERROR: Application %s issued a sysctl which failed the length restrictions.\nThe length passed is %d, the min length supported is 1 and the max length supported is %d.\n", execname, arg0, arg1);
+	stack();
+	/* ustack(); */
+}
+
+linuxulator*:sysctl:linux_sysctl:unsupported_sysctl
+{
+	printf("ERROR: Application %s issued an unsupported sysctl (%s).\nPatches to support this sysctl are welcome on the freebsd-emulation at FreeBSD.org mailinglist.\n", execname, arg0);
+}

Modified: user/netchild/linuxulator-dtrace/src/sys/compat/linux/linux_sysctl.c
==============================================================================
--- user/netchild/linuxulator-dtrace/src/sys/compat/linux/linux_sysctl.c	Fri Jan  2 13:48:02 2009	(r186701)
+++ user/netchild/linuxulator-dtrace/src/sys/compat/linux/linux_sysctl.c	Fri Jan  2 13:56:45 2009	(r186702)
@@ -30,12 +30,15 @@
 __FBSDID("$FreeBSD$");
 
 #include "opt_compat.h"
+#include "opt_kdtrace.h"
 
 #include <sys/param.h>
+#include <sys/kernel.h>
 #include <sys/lock.h>
 #include <sys/malloc.h>
 #include <sys/mutex.h>
 #include <sys/proc.h>
+#include <sys/sdt.h>
 #include <sys/sysctl.h>
 #include <sys/systm.h>
 #include <sys/sbuf.h>
@@ -49,6 +52,7 @@ __FBSDID("$FreeBSD$");
 #endif
 
 #include <compat/linux/linux_util.h>
+#include <compat/linux/linux_dtrace.h>
 
 #define	LINUX_CTL_KERN		1
 #define	LINUX_CTL_VM		2
@@ -65,23 +69,59 @@ __FBSDID("$FreeBSD$");
 #define	LINUX_KERN_OSREV	3
 #define	LINUX_KERN_VERSION	4
 
+LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE);
+LIN_SDT_PROBE_DEFINE(sysctl, handle_string, entry);
+LIN_SDT_PROBE_ARGTYPE(sysctl, handle_string, entry, 0,
+    "struct l___sysctl_args *");
+LIN_SDT_PROBE_ARGTYPE(sysctl, handle_string, entry, 1, "char *");
+LIN_SDT_PROBE_DEFINE(sysctl, handle_string, copyout_error);
+LIN_SDT_PROBE_ARGTYPE(sysctl, handle_string, copyout_error, 0, "int");
+LIN_SDT_PROBE_DEFINE(sysctl, handle_string, return);
+LIN_SDT_PROBE_ARGTYPE(sysctl, handle_string, return, 0, "int");
+LIN_SDT_PROBE_DEFINE(sysctl, linux_sysctl, entry);
+LIN_SDT_PROBE_ARGTYPE(sysctl, linux_sysctl, entry, 0,
+    "struct l___sysctl_args *");
+LIN_SDT_PROBE_DEFINE(sysctl, linux_sysctl, copyin_error);
+LIN_SDT_PROBE_DEFINE(sysctl, linux_sysctl, wrong_length);
+LIN_SDT_PROBE_ARGTYPE(sysctl, linux_sysctl, wrong_length, 0,
+    "int");
+LIN_SDT_PROBE_ARGTYPE(sysctl, linux_sysctl, wrong_length, 1,
+    "int");
+LIN_SDT_PROBE_DEFINE(sysctl, linux_sysctl, unsupported_sysctl);
+LIN_SDT_PROBE_ARGTYPE(sysctl, linux_sysctl, unsupported_sysctl, 0,
+    "char *");
+LIN_SDT_PROBE_DEFINE(sysctl, linux_sysctl, return);
+LIN_SDT_PROBE_ARGTYPE(sysctl, linux_sysctl, return, 0, "int");
+
 static int
 handle_string(struct l___sysctl_args *la, char *value)
 {
 	int error;
 
+	LIN_SDT_PROBE(sysctl, handle_string, entry, la, value, 0, 0, 0);
+
 	if (la->oldval != 0) {
 		l_int len = strlen(value);
 		error = copyout(value, PTRIN(la->oldval), len + 1);
 		if (!error && la->oldlenp != 0)
 			error = copyout(&len, PTRIN(la->oldlenp), sizeof(len));
-		if (error)
+		if (error) {
+			/* XXX: Separate probes for the 2 copyouts? */
+			LIN_SDT_PROBE(sysctl, handle_string, copyout_error,
+			    error, 0, 0, 0, 0);
+			LIN_SDT_PROBE(sysctl, handle_string, return, error,
+			    0, 0, 0, 0);
 			return (error);
+		}
 	}
 
-	if (la->newval != 0)
+	if (la->newval != 0) {
+		LIN_SDT_PROBE(sysctl, handle_string, return, ENOTDIR, 0, 0, 0,
+		    0);
 		return (ENOTDIR);
+	}
 
+	LIN_SDT_PROBE(sysctl, handle_string, return, 0, 0, 0, 0, 0);
 	return (0);
 }
 
@@ -92,17 +132,34 @@ linux_sysctl(struct thread *td, struct l
 	struct sbuf *sb;
 	l_int *mib;
 	int error, i;
+	char *sysctl_string;
+
+	LIN_SDT_PROBE(sysctl, linux_sysctl, entry, args->args, 0, 0, 0, 0);
 
 	error = copyin(args->args, &la, sizeof(la));
-	if (error)
+	if (error) {
+		LIN_SDT_PROBE(sysctl, linux_sysctl, copyin_error, error, 0,
+		    0, 0, 0);
+		LIN_SDT_PROBE(sysctl, linux_sysctl, return, error, 0, 0, 0,
+		    0);
 		return (error);
+	}
 
-	if (la.nlen <= 0 || la.nlen > LINUX_CTL_MAXNAME)
+	if (la.nlen <= 0 || la.nlen > LINUX_CTL_MAXNAME) {
+		LIN_SDT_PROBE(sysctl, linux_sysctl, wrong_length, la.nlen,
+		    LINUX_CTL_MAXNAME, 0, 0, 0);
+		LIN_SDT_PROBE(sysctl, linux_sysctl, return, ENOTDIR, 0, 0, 0,
+		    0);
 		return (ENOTDIR);
+	}
 
 	mib = malloc(la.nlen * sizeof(l_int), M_TEMP, M_WAITOK);
 	error = copyin(PTRIN(la.name), mib, la.nlen * sizeof(l_int));
 	if (error) {
+		LIN_SDT_PROBE(sysctl, linux_sysctl, copyin_error, error, 0,
+		    0, 0, 0);
+		LIN_SDT_PROBE(sysctl, linux_sysctl, return, error, 0, 0, 0,
+		    0);
 		free(mib, M_TEMP);
 		return (error);
 	}
@@ -116,6 +173,8 @@ linux_sysctl(struct thread *td, struct l
 		case LINUX_KERN_VERSION:
 			error = handle_string(&la, version);
 			free(mib, M_TEMP);
+			LIN_SDT_PROBE(sysctl, linux_sysctl, return, error, 0,
+			    0, 0, 0);
 			return (error);
 		default:
 			break;
@@ -128,16 +187,23 @@ linux_sysctl(struct thread *td, struct l
 	sb = sbuf_new(NULL, NULL, 20 + la.nlen * 5, SBUF_AUTOEXTEND);
 	if (sb == NULL) {
 		linux_msg(td, "sysctl is not implemented");
+		LIN_SDT_PROBE(sysctl, linux_sysctl, unsupported_sysctl,
+		    "ENOMEM", 0, 0, 0, 0);
 	} else {
 		sbuf_printf(sb, "sysctl ");
 		for (i = 0; i < la.nlen; i++)
 			sbuf_printf(sb, "%c%d", (i) ? ',' : '{', mib[i]);
 		sbuf_printf(sb, "} is not implemented");
 		sbuf_finish(sb);
-		linux_msg(td, "%s", sbuf_data(sb));
+		sysctl_string = sbuf_data(sb);
+		linux_msg(td, "%s", sysctl_string);
+		LIN_SDT_PROBE(sysctl, linux_sysctl, unsupported_sysctl,
+		    sysctl_string, 0, 0, 0, 0);
 		sbuf_delete(sb);
 	}
 
 	free(mib, M_TEMP);
+
+	LIN_SDT_PROBE(sysctl, linux_sysctl, return, ENOTDIR, 0, 0, 0, 0);
 	return (ENOTDIR);
 }

Modified: user/netchild/linuxulator-dtrace/src/sys/compat/linux/linux_time.c
==============================================================================
--- user/netchild/linuxulator-dtrace/src/sys/compat/linux/linux_time.c	Fri Jan  2 13:48:02 2009	(r186701)
+++ user/netchild/linuxulator-dtrace/src/sys/compat/linux/linux_time.c	Fri Jan  2 13:56:45 2009	(r186702)
@@ -43,10 +43,13 @@ __KERNEL_RCSID(0, "$NetBSD: linux_time.c
 #endif
 
 #include "opt_compat.h"
+#include "opt_kdtrace.h"
 
 #include <sys/param.h>
+#include <sys/kernel.h>
 #include <sys/ucred.h>
 #include <sys/mount.h>
+#include <sys/sdt.h>
 #include <sys/signal.h>
 #include <sys/stdint.h>
 #include <sys/syscallsubr.h>
@@ -63,33 +66,154 @@ __KERNEL_RCSID(0, "$NetBSD: linux_time.c
 #include <machine/../linux/linux_proto.h>
 #endif
 
-static void native_to_linux_timespec(struct l_timespec *,
-				     struct timespec *);
-static int linux_to_native_timespec(struct timespec *,
-				     struct l_timespec *);
-static int linux_to_native_clockid(clockid_t *, clockid_t);
+#include <compat/linux/linux_dtrace.h>
+
+LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE);
+LIN_SDT_PROBE_DEFINE(time, native_to_linux_timespec, entry);
+LIN_SDT_PROBE_ARGTYPE(time, native_to_linux_timespec, entry, 0,
+    "struct l_timespec *");
+LIN_SDT_PROBE_ARGTYPE(time, native_to_linux_timespec, entry, 1,
+    "struct timespec *");
+LIN_SDT_PROBE_DEFINE(time, native_to_linux_timespec, return);
+LIN_SDT_PROBE_DEFINE(time, linux_to_native_timespec, entry);
+LIN_SDT_PROBE_ARGTYPE(time, linux_to_native_timespec, entry, 0,
+    "struct timespec *");
+LIN_SDT_PROBE_ARGTYPE(time, linux_to_native_timespec, entry, 1,
+    "struct l_timespec *");
+LIN_SDT_PROBE_DEFINE(time, linux_to_native_timespec, return);
+LIN_SDT_PROBE_ARGTYPE(time, linux_to_native_timespec, return, 0,
+    "int");
+LIN_SDT_PROBE_DEFINE(time, linux_to_native_clockid, entry);
+LIN_SDT_PROBE_ARGTYPE(time, linux_to_native_clockid, entry, 0,
+    "clockid_t *");
+LIN_SDT_PROBE_ARGTYPE(time, linux_to_native_clockid, entry, 1,
+    "clockid_t");
+LIN_SDT_PROBE_DEFINE(time, linux_to_native_clockid, unsupported_clockid);
+LIN_SDT_PROBE_ARGTYPE(time, linux_to_native_clockid, unsupported_clockid, 0,
+    "clockid_t");
+LIN_SDT_PROBE_DEFINE(time, linux_to_native_clockid, unknown_clockid);
+LIN_SDT_PROBE_ARGTYPE(time, linux_to_native_clockid, unknown_clockid, 0,
+    "clockid_t");
+LIN_SDT_PROBE_DEFINE(time, linux_to_native_clockid, return);
+LIN_SDT_PROBE_ARGTYPE(time, linux_to_native_clockid, return, 0, "int");
+LIN_SDT_PROBE_DEFINE(time, linux_clock_gettime, entry);
+LIN_SDT_PROBE_ARGTYPE(time, linux_clock_gettime, entry, 0, "clockid_t");
+LIN_SDT_PROBE_ARGTYPE(time, linux_clock_gettime, entry, 1,
+    "struct l_timespec *");
+LIN_SDT_PROBE_DEFINE(time, linux_clock_gettime, conversion_error);
+LIN_SDT_PROBE_ARGTYPE(time, linux_clock_gettime, conversion_error, 0, "int");
+LIN_SDT_PROBE_DEFINE(time, linux_clock_gettime, gettime_error);
+LIN_SDT_PROBE_ARGTYPE(time, linux_clock_gettime, gettime_error, 0, "int");
+LIN_SDT_PROBE_DEFINE(time, linux_clock_gettime, copyout_error);
+LIN_SDT_PROBE_ARGTYPE(time, linux_clock_gettime, copyout_error, 0, "int");
+LIN_SDT_PROBE_DEFINE(time, linux_clock_gettime, return);
+LIN_SDT_PROBE_ARGTYPE(time, linux_clock_gettime, return, 0, "int");
+LIN_SDT_PROBE_DEFINE(time, linux_clock_settime, entry);
+LIN_SDT_PROBE_ARGTYPE(time, linux_clock_settime, entry, 0, "clockid_t");
+LIN_SDT_PROBE_ARGTYPE(time, linux_clock_settime, entry, 1,
+    "struct l_timespec *");
+LIN_SDT_PROBE_DEFINE(time, linux_clock_settime, conversion_error);
+LIN_SDT_PROBE_ARGTYPE(time, linux_clock_settime, conversion_error, 0, "int");
+LIN_SDT_PROBE_DEFINE(time, linux_clock_settime, settime_error);
+LIN_SDT_PROBE_ARGTYPE(time, linux_clock_settime, settime_error, 0, "int");
+LIN_SDT_PROBE_DEFINE(time, linux_clock_settime, copyin_error);
+LIN_SDT_PROBE_ARGTYPE(time, linux_clock_settime, copyin_error, 0, "int");
+LIN_SDT_PROBE_DEFINE(time, linux_clock_settime, return);
+LIN_SDT_PROBE_ARGTYPE(time, linux_clock_settime, return, 0, "int");
+LIN_SDT_PROBE_DEFINE(time, linux_clock_getres, entry);
+LIN_SDT_PROBE_ARGTYPE(time, linux_clock_getres, entry, 0, "clockid_t");
+LIN_SDT_PROBE_ARGTYPE(time, linux_clock_getres, entry, 1,
+    "struct l_timespec *");
+LIN_SDT_PROBE_DEFINE(time, linux_clock_getres, nullcall);
+LIN_SDT_PROBE_DEFINE(time, linux_clock_getres, conversion_error);
+LIN_SDT_PROBE_ARGTYPE(time, linux_clock_getres, conversion_error, 0, "int");
+LIN_SDT_PROBE_DEFINE(time, linux_clock_getres, getres_error);
+LIN_SDT_PROBE_ARGTYPE(time, linux_clock_getres, getres_error, 0, "int");
+LIN_SDT_PROBE_DEFINE(time, linux_clock_getres, copyout_error);
+LIN_SDT_PROBE_ARGTYPE(time, linux_clock_getres, copyout_error, 0, "int");
+LIN_SDT_PROBE_DEFINE(time, linux_clock_getres, return);
+LIN_SDT_PROBE_ARGTYPE(time, linux_clock_getres, return, 0, "int");
+LIN_SDT_PROBE_DEFINE(time, linux_nanosleep, entry);
+LIN_SDT_PROBE_ARGTYPE(time, linux_nanosleep, entry, 0,
+    "const struct l_timespec *");
+LIN_SDT_PROBE_ARGTYPE(time, linux_nanosleep, entry, 1,
+    "struct l_timespec *");
+LIN_SDT_PROBE_DEFINE(time, linux_nanosleep, conversion_error);
+LIN_SDT_PROBE_ARGTYPE(time, linux_nanosleep, conversion_error, 0, "int");
+LIN_SDT_PROBE_DEFINE(time, linux_nanosleep, nanosleep_error);
+LIN_SDT_PROBE_ARGTYPE(time, linux_nanosleep, nanosleep_error, 0, "int");
+LIN_SDT_PROBE_DEFINE(time, linux_nanosleep, copyout_error);
+LIN_SDT_PROBE_ARGTYPE(time, linux_nanosleep, copyout_error, 0, "int");
+LIN_SDT_PROBE_DEFINE(time, linux_nanosleep, copyin_error);
+LIN_SDT_PROBE_ARGTYPE(time, linux_nanosleep, copyin_error, 0, "int");
+LIN_SDT_PROBE_DEFINE(time, linux_nanosleep, return);
+LIN_SDT_PROBE_ARGTYPE(time, linux_nanosleep, return, 0, "int");
+LIN_SDT_PROBE_DEFINE(time, linux_clock_nanosleep, entry);
+LIN_SDT_PROBE_ARGTYPE(time, linux_clock_nanosleep, entry, 0,
+    "clockid_t");
+LIN_SDT_PROBE_ARGTYPE(time, linux_clock_nanosleep, entry, 1,
+    "int");
+LIN_SDT_PROBE_ARGTYPE(time, linux_clock_nanosleep, entry, 2,
+    "struct l_timespec *");
+LIN_SDT_PROBE_ARGTYPE(time, linux_clock_nanosleep, entry, 3,
+    "struct l_timespec *");
+LIN_SDT_PROBE_DEFINE(time, linux_clock_nanosleep, conversion_error);
+LIN_SDT_PROBE_ARGTYPE(time, linux_clock_nanosleep, conversion_error, 0, "int");
+LIN_SDT_PROBE_DEFINE(time, linux_clock_nanosleep, nanosleep_error);
+LIN_SDT_PROBE_ARGTYPE(time, linux_clock_nanosleep, nanosleep_error, 0, "int");
+LIN_SDT_PROBE_DEFINE(time, linux_clock_nanosleep, copyout_error);
+LIN_SDT_PROBE_ARGTYPE(time, linux_clock_nanosleep, copyout_error, 0, "int");
+LIN_SDT_PROBE_DEFINE(time, linux_clock_nanosleep, copyin_error);
+LIN_SDT_PROBE_ARGTYPE(time, linux_clock_nanosleep, copyin_error, 0, "int");
+LIN_SDT_PROBE_DEFINE(time, linux_clock_nanosleep, unsupported_flags);
+LIN_SDT_PROBE_ARGTYPE(time, linux_clock_nanosleep, unsupported_flags, 0, "int");
+LIN_SDT_PROBE_DEFINE(time, linux_clock_nanosleep, unsupported_clockid);
+LIN_SDT_PROBE_ARGTYPE(time, linux_clock_nanosleep, unsupported_clockid, 0,
+    "int");
+LIN_SDT_PROBE_DEFINE(time, linux_clock_nanosleep, return);
+LIN_SDT_PROBE_ARGTYPE(time, linux_clock_nanosleep, return, 0, "int");
 
 static void
 native_to_linux_timespec(struct l_timespec *ltp, struct timespec *ntp)
 {
+
+	LIN_SDT_PROBE(time, native_to_linux_timespec, entry, ltp, ntp,
+	    0, 0, 0);
+
 	ltp->tv_sec = ntp->tv_sec;
 	ltp->tv_nsec = ntp->tv_nsec;
+
+	LIN_SDT_PROBE(time, native_to_linux_timespec, return, 0, 0,
+	    0, 0, 0);
 }
 
 static int
 linux_to_native_timespec(struct timespec *ntp, struct l_timespec *ltp)
 {
-	if (ltp->tv_sec < 0 || ltp->tv_nsec > (l_long)999999999L)
+
+	LIN_SDT_PROBE(time, linux_to_native_timespec, entry, ntp, ltp,
+	    0, 0, 0);
+
+	if (ltp->tv_sec < 0 || ltp->tv_nsec > (l_long)999999999L) {
+		LIN_SDT_PROBE(time, linux_to_native_timespec, return, EINVAL,
+		    0, 0, 0, 0);
 		return (EINVAL);
+	}
 	ntp->tv_sec = ltp->tv_sec;
 	ntp->tv_nsec = ltp->tv_nsec;
 
+	LIN_SDT_PROBE(time, linux_to_native_timespec, return, 0, 0,
+	    0, 0, 0);
 	return (0);
 }
 
 static int
 linux_to_native_clockid(clockid_t *n, clockid_t l)
 {
+
+	LIN_SDT_PROBE(time, linux_to_native_clockid, entry, n, l,
+	    0, 0, 0);
+
 	switch (l) {
 	case LINUX_CLOCK_REALTIME:
 		*n = CLOCK_REALTIME;
@@ -101,11 +225,23 @@ linux_to_native_clockid(clockid_t *n, cl
 	case LINUX_CLOCK_THREAD_CPUTIME_ID:
 	case LINUX_CLOCK_REALTIME_HR:
 	case LINUX_CLOCK_MONOTONIC_HR:
+		LIN_SDT_PROBE(time, linux_to_native_clockid,
+		    unsupported_clockid, l, 0, 0, 0, 0);
+		LIN_SDT_PROBE(time, linux_to_native_clockid, return, EINVAL,
+		    0, 0, 0, 0);
+		return (EINVAL);
+		break;
 	default:
+		LIN_SDT_PROBE(time, linux_to_native_clockid,
+		    unknown_clockid, l, 0, 0, 0, 0);
+		LIN_SDT_PROBE(time, linux_to_native_clockid, return, EINVAL,
+		    0, 0, 0, 0);
 		return (EINVAL);
 		break;
 	}
 
+	LIN_SDT_PROBE(time, linux_to_native_clockid, return, 0, 0,
+	    0, 0, 0);
 	return (0);
 }
 
@@ -117,15 +253,34 @@ linux_clock_gettime(struct thread *td, s
 	clockid_t nwhich = 0;	/* XXX: GCC */
 	struct timespec tp;
 
+	LIN_SDT_PROBE(time, linux_clock_gettime, entry, args->which, args->tp,
+	    0, 0, 0);
+
 	error = linux_to_native_clockid(&nwhich, args->which);
-	if (error != 0)
+	if (error != 0) {
+		LIN_SDT_PROBE(time, linux_clock_gettime, conversion_error, error,
+		    0, 0, 0, 0);
+		LIN_SDT_PROBE(time, linux_clock_gettime, return, error, 0, 0, 0,
+		    0);
 		return (error);
+	}
 	error = kern_clock_gettime(td, nwhich, &tp);
-	if (error != 0)
+	if (error != 0) {
+		LIN_SDT_PROBE(time, linux_clock_gettime, gettime_error, error,
+		    0, 0, 0, 0);
+		LIN_SDT_PROBE(time, linux_clock_gettime, return, error, 0, 0, 0,
+		    0);
 		return (error);
+	}
 	native_to_linux_timespec(&lts, &tp);
 
-	return (copyout(&lts, args->tp, sizeof lts));
+	error = copyout(&lts, args->tp, sizeof lts);
+	if (error != 0)
+		LIN_SDT_PROBE(time, linux_clock_gettime, copyout_error, error,
+		    0, 0, 0, 0);
+	LIN_SDT_PROBE(time, linux_clock_gettime, return, error, 0, 0, 0,
+	    0);
+	return (error);
 }
 
 int
@@ -136,17 +291,41 @@ linux_clock_settime(struct thread *td, s
 	int error;
 	clockid_t nwhich = 0;	/* XXX: GCC */
 
+	LIN_SDT_PROBE(time, linux_clock_settime, entry, args->which, args->tp,
+	    0, 0, 0);
+
 	error = linux_to_native_clockid(&nwhich, args->which);
-	if (error != 0)
+	if (error != 0) {
+		LIN_SDT_PROBE(time, linux_clock_settime, conversion_error, error,
+		    0, 0, 0, 0);
+		LIN_SDT_PROBE(time, linux_clock_settime, return, error, 0, 0, 0,
+		    0);
 		return (error);
+	}
 	error = copyin(args->tp, &lts, sizeof lts);
-	if (error != 0)
+	if (error != 0) {
+		LIN_SDT_PROBE(time, linux_clock_settime, copyin_error, error,
+		    0, 0, 0, 0);
+		LIN_SDT_PROBE(time, linux_clock_settime, return, error, 0, 0, 0,
+		    0);
 		return (error);
+	}
 	error = linux_to_native_timespec(&ts, &lts);
-	if (error != 0)
+	if (error != 0) {
+		LIN_SDT_PROBE(time, linux_clock_settime, conversion_error, error,
+		    0, 0, 0, 0);
+		LIN_SDT_PROBE(time, linux_clock_settime, return, error, 0, 0, 0,
+		    0);
 		return (error);
+	}
 
-	return (kern_clock_settime(td, nwhich, &ts));
+	error = kern_clock_settime(td, nwhich, &ts);
+	if (error != 0)
+		LIN_SDT_PROBE(time, linux_clock_settime, settime_error, error,
+		    0, 0, 0, 0);
+	LIN_SDT_PROBE(time, linux_clock_settime, return, error, 0, 0, 0,
+	    0);
+	return (error);
 }
 
 int
@@ -157,18 +336,41 @@ linux_clock_getres(struct thread *td, st
 	int error;
 	clockid_t nwhich = 0;	/* XXX: GCC */
 
-	if (args->tp == NULL)
+	LIN_SDT_PROBE(time, linux_clock_getres, entry, args->which, args->tp,
+	    0, 0, 0);
+
+	if (args->tp == NULL) {
+		LIN_SDT_PROBE(time, linux_clock_getres, nullcall, 0, 0, 0, 0,
+		    0);
+		LIN_SDT_PROBE(time, linux_clock_getres, return, 0, 0, 0, 0, 0);
 	  	return (0);
+	}
 
 	error = linux_to_native_clockid(&nwhich, args->which);
-	if (error != 0)
+	if (error != 0) {
+		LIN_SDT_PROBE(time, linux_clock_getres, conversion_error, error,
+		    0, 0, 0, 0);
+		LIN_SDT_PROBE(time, linux_clock_getres, return, error, 0, 0, 0,
+		    0);
 		return (error);
+	}
 	error = kern_clock_getres(td, nwhich, &ts);
-	if (error != 0)
+	if (error != 0) {
+		LIN_SDT_PROBE(time, linux_clock_getres, getres_error, error,
+		    0, 0, 0, 0);
+		LIN_SDT_PROBE(time, linux_clock_getres, return, error, 0, 0, 0,
+		    0);
 		return (error);
+	}
 	native_to_linux_timespec(&lts, &ts);
 
-	return (copyout(&lts, args->tp, sizeof lts));
+	error = copyout(&lts, args->tp, sizeof lts);
+	if (error != 0)
+		LIN_SDT_PROBE(time, linux_clock_getres, copyout_error, error,
+		    0, 0, 0, 0);
+	LIN_SDT_PROBE(time, linux_clock_getres, return, error, 0, 0, 0,
+	    0);
+	return (error);
 }
 
 int
@@ -179,9 +381,17 @@ linux_nanosleep(struct thread *td, struc
 	struct timespec rqts, rmts;
 	int error;
 
+	LIN_SDT_PROBE(time, linux_nanosleep, entry, args->rqtp, args->rmtp,
+	    0, 0, 0);
+
 	error = copyin(args->rqtp, &lrqts, sizeof lrqts);
-	if (error != 0)
+	if (error != 0) {
+		LIN_SDT_PROBE(time, linux_nanosleep, copyin_error, error,
+		    0, 0, 0, 0);
+		LIN_SDT_PROBE(time, linux_nanosleep, return, error, 0, 0, 0,
+		    0);
 		return (error);
+	}
 
 	if (args->rmtp != NULL)
 	   	rmtp = &rmts;
@@ -189,19 +399,35 @@ linux_nanosleep(struct thread *td, struc
 	   	rmtp = NULL;
 
 	error = linux_to_native_timespec(&rqts, &lrqts);
-	if (error != 0)
+	if (error != 0) {
+		LIN_SDT_PROBE(time, linux_nanosleep, conversion_error, error,
+		    0, 0, 0, 0);
+		LIN_SDT_PROBE(time, linux_nanosleep, return, error, 0, 0, 0,
+		    0);
 		return (error);
+	}
 	error = kern_nanosleep(td, &rqts, rmtp);
-	if (error != 0)
+	if (error != 0) {
+		LIN_SDT_PROBE(time, linux_nanosleep, nanosleep_error, error,
+		    0, 0, 0, 0);
+		LIN_SDT_PROBE(time, linux_nanosleep, return, error, 0, 0, 0,
+		    0);
 		return (error);
+	}
 
 	if (args->rmtp != NULL) {
 	   	native_to_linux_timespec(&lrmts, rmtp);
 	   	error = copyout(&lrmts, args->rmtp, sizeof(lrmts));
-		if (error != 0)
+		if (error != 0) {
+			LIN_SDT_PROBE(time, linux_nanosleep, copyout_error,
+			    error, 0, 0, 0, 0);
+			LIN_SDT_PROBE(time, linux_nanosleep, return, error,
+			    0, 0, 0, 0);
 		   	return (error);
+		}
 	}
 
+	LIN_SDT_PROBE(time, linux_nanosleep, return, 0, 0, 0, 0, 0);
 	return (0);
 }
 
@@ -213,15 +439,33 @@ linux_clock_nanosleep(struct thread *td,
 	struct timespec rqts, rmts;
 	int error;
 
-	if (args->flags != 0)
+	LIN_SDT_PROBE(time, linux_clock_nanosleep, entry, args->which,
+	    args->flags, args->rqtp, args->rmtp, 0);
+
+	if (args->flags != 0) {
+		LIN_SDT_PROBE(time, linux_clock_nanosleep, unsupported_flags,
+		    args->flags, 0, 0, 0, 0);
+		LIN_SDT_PROBE(time, linux_clock_nanosleep, return, EINVAL, 0,
+		    0, 0, 0);
 		return (EINVAL);	/* XXX deal with TIMER_ABSTIME */
+	}
 
-	if (args->which != LINUX_CLOCK_REALTIME)
+	if (args->which != LINUX_CLOCK_REALTIME) {
+		LIN_SDT_PROBE(time, linux_clock_nanosleep, unsupported_clockid,
+		    args->which, 0, 0, 0, 0);
+		LIN_SDT_PROBE(time, linux_clock_nanosleep, return, EINVAL, 0,
+		    0, 0, 0);
 		return (EINVAL);
+	}
 
 	error = copyin(args->rqtp, &lrqts, sizeof lrqts);
-	if (error != 0)
+	if (error != 0) {
+		LIN_SDT_PROBE(time, linux_clock_nanosleep, copyin_error,
+		    error, 0, 0, 0, 0);
+		LIN_SDT_PROBE(time, linux_clock_nanosleep, return, error, 0,
+		    0, 0, 0);
 		return (error);
+	}
 
 	if (args->rmtp != NULL)
 	   	rmtp = &rmts;
@@ -229,18 +473,34 @@ linux_clock_nanosleep(struct thread *td,
 	   	rmtp = NULL;
 
 	error = linux_to_native_timespec(&rqts, &lrqts);
-	if (error != 0)
+	if (error != 0) {
+		LIN_SDT_PROBE(time, linux_clock_nanosleep, conversion_error,
+		    error, 0, 0, 0, 0);
+		LIN_SDT_PROBE(time, linux_clock_nanosleep, return, error, 0,
+		    0, 0, 0);
 		return (error);
+	}
 	error = kern_nanosleep(td, &rqts, rmtp);
-	if (error != 0)
+	if (error != 0) {
+		LIN_SDT_PROBE(time, linux_clock_nanosleep, nanosleep_error,
+		    error, 0, 0, 0, 0);
+		LIN_SDT_PROBE(time, linux_clock_nanosleep, return, error, 0,
+		    0, 0, 0);
 		return (error);
+	}
 
 	if (args->rmtp != NULL) {
 	   	native_to_linux_timespec(&lrmts, rmtp);
 	   	error = copyout(&lrmts, args->rmtp, sizeof lrmts );
-		if (error != 0)
+		if (error != 0) {
+			LIN_SDT_PROBE(time, linux_clock_nanosleep,
+			    copyout_error, error, 0, 0, 0, 0);
+			LIN_SDT_PROBE(time, linux_nanosleep, return, error,
+			    0, 0, 0, 0);
 		   	return (error);
+		}
 	}
 
+	LIN_SDT_PROBE(time, linux_clock_nanosleep, return, 0, 0, 0, 0, 0);
 	return (0);
 }

Modified: user/netchild/linuxulator-dtrace/src/sys/compat/linux/linux_uid16.c
==============================================================================
--- user/netchild/linuxulator-dtrace/src/sys/compat/linux/linux_uid16.c	Fri Jan  2 13:48:02 2009	(r186701)
+++ user/netchild/linuxulator-dtrace/src/sys/compat/linux/linux_uid16.c	Fri Jan  2 13:56:45 2009	(r186702)
@@ -28,14 +28,17 @@
 __FBSDID("$FreeBSD$");
 
 #include "opt_compat.h"
+#include "opt_kdtrace.h"
 
 #include <sys/fcntl.h>
 #include <sys/param.h>
+#include <sys/kernel.h>
 #include <sys/lock.h>
 #include <sys/malloc.h>
 #include <sys/mutex.h>
 #include <sys/priv.h>
 #include <sys/proc.h>
+#include <sys/sdt.h>
 #include <sys/syscallsubr.h>
 #include <sys/sysproto.h>
 #include <sys/systm.h>
@@ -49,6 +52,7 @@ __FBSDID("$FreeBSD$");
 #endif
 
 #include <compat/linux/linux_util.h>
+#include <compat/linux/linux_dtrace.h>
 
 DUMMY(setfsuid16);
 DUMMY(setfsgid16);
@@ -57,21 +61,101 @@ DUMMY(getresgid16);
 
 #define	CAST_NOCHG(x)	((x == 0xFFFF) ? -1 : x)
 
+LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE);
+LIN_SDT_PROBE_DEFINE(uid16, linux_chown16, entry);
+LIN_SDT_PROBE_ARGTYPE(uid16, linux_chown16, entry, 0, "char *");
+LIN_SDT_PROBE_ARGTYPE(uid16, linux_chown16, entry, 1, "l_uid16_t");
+LIN_SDT_PROBE_ARGTYPE(uid16, linux_chown16, entry, 2, "l_gid16_t");
+LIN_SDT_PROBE_DEFINE(uid16, linux_chown16, conv_path);
+LIN_SDT_PROBE_ARGTYPE(uid16, linux_chown16, conv_path, 0, "char *");
+LIN_SDT_PROBE_DEFINE(uid16, linux_chown16, return);
+LIN_SDT_PROBE_ARGTYPE(uid16, linux_chown16, return, 0, "int");
+LIN_SDT_PROBE_DEFINE(uid16, linux_lchown16, entry);
+LIN_SDT_PROBE_ARGTYPE(uid16, linux_lchown16, entry, 0, "char *");
+LIN_SDT_PROBE_ARGTYPE(uid16, linux_lchown16, entry, 1, "l_uid16_t");
+LIN_SDT_PROBE_ARGTYPE(uid16, linux_lchown16, entry, 2, "l_gid16_t");
+LIN_SDT_PROBE_DEFINE(uid16, linux_lchown16, conv_path);
+LIN_SDT_PROBE_ARGTYPE(uid16, linux_lchown16, conv_path, 0, "char *");
+LIN_SDT_PROBE_DEFINE(uid16, linux_lchown16, return);
+LIN_SDT_PROBE_ARGTYPE(uid16, linux_lchown16, return, 0, "int");
+LIN_SDT_PROBE_DEFINE(uid16, linux_setgroups16, entry);
+LIN_SDT_PROBE_ARGTYPE(uid16, linux_setgroups16, entry, 0, "l_uint");
+LIN_SDT_PROBE_ARGTYPE(uid16, linux_setgroups16, entry, 1, "l_gid16_t *");
+LIN_SDT_PROBE_DEFINE(uid16, linux_setgroups16, copyin_error);
+LIN_SDT_PROBE_ARGTYPE(uid16, linux_setgroups16, copyin_error, 0, "int");
+LIN_SDT_PROBE_DEFINE(uid16, linux_setgroups16, priv_check_cred_error);
+LIN_SDT_PROBE_ARGTYPE(uid16, linux_setgroups16, priv_check_cred_error, 0,
+    "int");
+LIN_SDT_PROBE_DEFINE(uid16, linux_setgroups16, return);
+LIN_SDT_PROBE_ARGTYPE(uid16, linux_setgroups16, return, 0, "int");
+LIN_SDT_PROBE_DEFINE(uid16, linux_getgroups16, entry);
+LIN_SDT_PROBE_ARGTYPE(uid16, linux_getgroups16, entry, 0, "l_uint");
+LIN_SDT_PROBE_ARGTYPE(uid16, linux_getgroups16, entry, 1, "l_gid16_t *");
+LIN_SDT_PROBE_DEFINE(uid16, linux_getgroups16, copyout_error);
+LIN_SDT_PROBE_ARGTYPE(uid16, linux_getgroups16, copyout_error, 0, "int");
+LIN_SDT_PROBE_DEFINE(uid16, linux_getgroups16, return);
+LIN_SDT_PROBE_ARGTYPE(uid16, linux_getgroups16, return, 0, "int");
+LIN_SDT_PROBE_DEFINE(uid16, linux_getgid16, entry);
+LIN_SDT_PROBE_DEFINE(uid16, linux_getgid16, return);
+LIN_SDT_PROBE_ARGTYPE(uid16, linux_getgid16, return, 0, "int");
+LIN_SDT_PROBE_DEFINE(uid16, linux_getuid16, entry);
+LIN_SDT_PROBE_DEFINE(uid16, linux_getuid16, return);
+LIN_SDT_PROBE_ARGTYPE(uid16, linux_getuid16, return, 0, "int");
+LIN_SDT_PROBE_DEFINE(uid16, linux_getegid16, entry);
+LIN_SDT_PROBE_DEFINE(uid16, linux_getegid16, return);
+LIN_SDT_PROBE_ARGTYPE(uid16, linux_getegid16, return, 0, "int");
+LIN_SDT_PROBE_DEFINE(uid16, linux_geteuid16, entry);
+LIN_SDT_PROBE_DEFINE(uid16, linux_geteuid16, return);
+LIN_SDT_PROBE_ARGTYPE(uid16, linux_geteuid16, return, 0, "int");
+LIN_SDT_PROBE_DEFINE(uid16, linux_setgid16, entry);
+LIN_SDT_PROBE_ARGTYPE(uid16, linux_setgid16, entry, 0, "l_gid16_t");
+LIN_SDT_PROBE_DEFINE(uid16, linux_setgid16, return);
+LIN_SDT_PROBE_ARGTYPE(uid16, linux_setgid16, return, 0, "int");
+LIN_SDT_PROBE_DEFINE(uid16, linux_setuid16, entry);
+LIN_SDT_PROBE_ARGTYPE(uid16, linux_setuid16, entry, 0, "l_uid16_t");
+LIN_SDT_PROBE_DEFINE(uid16, linux_setuid16, return);
+LIN_SDT_PROBE_ARGTYPE(uid16, linux_setuid16, return, 0, "int");
+LIN_SDT_PROBE_DEFINE(uid16, linux_setregid16, entry);
+LIN_SDT_PROBE_ARGTYPE(uid16, linux_setregid16, entry, 0, "l_git16_t");
+LIN_SDT_PROBE_ARGTYPE(uid16, linux_setregid16, entry, 1, "l_git16_t");
+LIN_SDT_PROBE_DEFINE(uid16, linux_setregid16, return);
+LIN_SDT_PROBE_ARGTYPE(uid16, linux_setregid16, return, 0, "int");
+LIN_SDT_PROBE_DEFINE(uid16, linux_setreuid16, entry);
+LIN_SDT_PROBE_ARGTYPE(uid16, linux_setreuid16, entry, 0, "l_uid16_t");
+LIN_SDT_PROBE_ARGTYPE(uid16, linux_setreuid16, entry, 1, "l_uid16_t");
+LIN_SDT_PROBE_DEFINE(uid16, linux_setreuid16, return);
+LIN_SDT_PROBE_ARGTYPE(uid16, linux_setreuid16, return, 0, "int");
+LIN_SDT_PROBE_DEFINE(uid16, linux_setresgid16, entry);
+LIN_SDT_PROBE_ARGTYPE(uid16, linux_setresgid16, entry, 0, "l_gid16_t");
+LIN_SDT_PROBE_ARGTYPE(uid16, linux_setresgid16, entry, 1, "l_gid16_t");
+LIN_SDT_PROBE_ARGTYPE(uid16, linux_setresgid16, entry, 2, "l_gid16_t");
+LIN_SDT_PROBE_DEFINE(uid16, linux_setresgid16, return);
+LIN_SDT_PROBE_ARGTYPE(uid16, linux_setresgid16, return, 0, "int");
+LIN_SDT_PROBE_DEFINE(uid16, linux_setresuid16, entry);
+LIN_SDT_PROBE_ARGTYPE(uid16, linux_setresuid16, entry, 0, "l_uid16_t");
+LIN_SDT_PROBE_ARGTYPE(uid16, linux_setresuid16, entry, 1, "l_uid16_t");
+LIN_SDT_PROBE_ARGTYPE(uid16, linux_setresuid16, entry, 2, "l_uid16_t");
+LIN_SDT_PROBE_DEFINE(uid16, linux_setresuid16, return);
+LIN_SDT_PROBE_ARGTYPE(uid16, linux_setresuid16, return, 0, "int");
+
 int
 linux_chown16(struct thread *td, struct linux_chown16_args *args)
 {
 	char *path;
 	int error;
 
+	LIN_SDT_PROBE(uid16, linux_chown16, entry, args->path, args->uid,
+	    args->gid, 0, 0);
+
 	LCONVPATHEXIST(td, args->path, &path);
 
-#ifdef DEBUG
-	if (ldebug(chown16))
-		printf(ARGS(chown16, "%s, %d, %d"), path, args->uid, args->gid);
-#endif
+	LIN_SDT_PROBE(uid16, linux_chown16, conv_path, path, 0, 0, 0, 0);
+
 	error = kern_chown(td, path, UIO_SYSSPACE, CAST_NOCHG(args->uid),
 	    CAST_NOCHG(args->gid));
 	LFREEPATH(path);
+
+	LIN_SDT_PROBE(uid16, linux_chown16, return, error, 0, 0, 0, 0);
 	return (error);
 }
 
@@ -81,16 +165,18 @@ linux_lchown16(struct thread *td, struct
 	char *path;
 	int error;
 
+	LIN_SDT_PROBE(uid16, linux_lchown16, entry, args->path, args->uid,
+	    args->gid, 0, 0);
+
 	LCONVPATHEXIST(td, args->path, &path);
 
-#ifdef DEBUG
-	if (ldebug(lchown16))
-		printf(ARGS(lchown16, "%s, %d, %d"), path, args->uid,
-		    args->gid);
-#endif
+	LIN_SDT_PROBE(uid16, linux_lchown16, conv_path, path, 0, 0, 0, 0);
+
 	error = kern_lchown(td, path, UIO_SYSSPACE, CAST_NOCHG(args->uid),
 	    CAST_NOCHG(args->gid));
 	LFREEPATH(path);
+
+	LIN_SDT_PROBE(uid16, linux_lchown16, return, error, 0, 0, 0, 0);
 	return (error);
 }
 
@@ -103,17 +189,25 @@ linux_setgroups16(struct thread *td, str
 	int ngrp, error;
 	struct proc *p;
 
-#ifdef DEBUG
-	if (ldebug(setgroups16))
-		printf(ARGS(setgroups16, "%d, *"), args->gidsetsize);
-#endif
+	LIN_SDT_PROBE(uid16, linux_setgroups16, entry, args->gidsetsize,
+	    args->gidset, 0, 0, 0);
 
 	ngrp = args->gidsetsize;
-	if (ngrp < 0 || ngrp >= NGROUPS)
+	if (ngrp < 0 || ngrp >= NGROUPS) {
+		LIN_SDT_PROBE(uid16, linux_setgroups16, return, EINVAL, 0, 0,
+		    0, 0);
 		return (EINVAL);
+	}
+
 	error = copyin(args->gidset, linux_gidset, ngrp * sizeof(l_gid16_t));
-	if (error)
+	if (error) {
+		LIN_SDT_PROBE(uid16, linux_setgroups16, copyin_error, error,
+		    0, 0, 0, 0);
+		LIN_SDT_PROBE(uid16, linux_setgroups16, return, error, 0, 0,
+		    0, 0);
 		return (error);
+	}
+
 	newcred = crget();
 	p = td->td_proc;
 	PROC_LOCK(p);
@@ -128,6 +222,11 @@ linux_setgroups16(struct thread *td, str
 	if ((error = priv_check_cred(oldcred, PRIV_CRED_SETGROUPS, 0)) != 0) {
 		PROC_UNLOCK(p);
 		crfree(newcred);
+
+		LIN_SDT_PROBE(uid16, linux_setgroups16, priv_check_cred_error,
+		     error, 0, 0, 0, 0);
+		LIN_SDT_PROBE(uid16, linux_setgroups16, return, error, 0, 0,
+		    0, 0);
 		return (error);
 	}
 
@@ -149,6 +248,8 @@ linux_setgroups16(struct thread *td, str
 	p->p_ucred = newcred;
 	PROC_UNLOCK(p);
 	crfree(oldcred);
+
+	LIN_SDT_PROBE(uid16, linux_setgroups16, return, error, 0, 0, 0, 0);
 	return (0);
 }
 
@@ -160,10 +261,8 @@ linux_getgroups16(struct thread *td, str
 	gid_t *bsd_gidset;
 	int bsd_gidsetsz, ngrp, error;
 
-#ifdef DEBUG
-	if (ldebug(getgroups16))
-		printf(ARGS(getgroups16, "%d, *"), args->gidsetsize);
-#endif
+	LIN_SDT_PROBE(uid16, linux_getgroups16, entry, args->gidsetsize,
+	    args->gidset, 0, 0, 0);
 
 	cred = td->td_ucred;
 	bsd_gidset = cred->cr_groups;
@@ -177,11 +276,16 @@ linux_getgroups16(struct thread *td, str
 
 	if ((ngrp = args->gidsetsize) == 0) {
 		td->td_retval[0] = bsd_gidsetsz;
+
+		LIN_SDT_PROBE(uid16, linux_getgroups16, return, 0, 0, 0, 0, 0);
 		return (0);
 	}
 
-	if (ngrp < bsd_gidsetsz)
+	if (ngrp < bsd_gidsetsz) {
+		LIN_SDT_PROBE(uid16, linux_getgroups16, return, EINVAL, 0, 0,
+		    0, 0);
 		return (EINVAL);
+	}
 

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-src-user mailing list