Hi Philippe,

here is a tiny patch to re-trigger trace freezing by writing a positive
number to /proc/ipipe/trace/frozen. Writing 0 provides the old
behaviour, i.e. resets the frozen trace so that ipipe_trace_freeze() can
capture a new trace.

Please apply.

Jan
Index: linux-2.6.15.3-kgdb/kernel/ipipe/tracer.c
===================================================================
--- linux-2.6.15.3-kgdb.orig/kernel/ipipe/tracer.c
+++ linux-2.6.15.3-kgdb/kernel/ipipe/tracer.c
@@ -1005,11 +1005,28 @@ static int __ipipe_frozen_prtrace_open(s
 }
 
 static ssize_t
-__ipipe_frozen_reset(struct file *file, const char __user *pbuffer,
-                     size_t count, loff_t *data)
+__ipipe_frozen_ctrl(struct file *file, const char __user *pbuffer,
+                    size_t count, loff_t *data)
 {
+	char *end, buf[16];
+	int val;
+	int n;
+
+	n = (count > sizeof(buf) - 1) ? sizeof(buf) - 1 : count;
+
+	if (copy_from_user(buf, pbuffer, n))
+		return -EFAULT;
+
+	buf[n] = '\0';
+	val = simple_strtol(buf, &end, 0);
+
+	if (((*end != '\0') && !isspace(*end)) || (val < 0))
+		return -EINVAL;
+
 	down(&out_mutex);
 	ipipe_trace_frozen_reset();
+	if (val > 0)
+		ipipe_trace_freeze(-1);
 	up(&out_mutex);
 
 	return count;
@@ -1018,7 +1035,7 @@ __ipipe_frozen_reset(struct file *file, 
 struct file_operations __ipipe_frozen_prtrace_fops = {
 	.open       = __ipipe_frozen_prtrace_open,
 	.read       = seq_read,
-	.write      = __ipipe_frozen_reset,
+	.write      = __ipipe_frozen_ctrl,
 	.llseek     = seq_lseek,
 	.release    = seq_release,
 };

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core

Reply via email to