All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@domain.hid>
To: Philippe Gerum <rpm@xenomai.org>
Cc: adeos-main@gna.org, xenomai-core <xenomai@xenomai.org>
Subject: [Xenomai-core] [PATCH] trigger I-pipe trace freezing via proc
Date: Sun, 09 Apr 2006 14:08:49 +0200	[thread overview]
Message-ID: <4438F951.5010507@domain.hid> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 273 bytes --]

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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: ipipe-trace-trigger.patch --]
[-- Type: text/x-patch; name="ipipe-trace-trigger.patch", Size: 1333 bytes --]

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 #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

             reply	other threads:[~2006-04-09 12:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-09 12:08 Jan Kiszka [this message]
2006-04-09 12:50 ` [Xenomai-core] Re: [PATCH] trigger I-pipe trace freezing via proc Philippe Gerum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4438F951.5010507@domain.hid \
    --to=jan.kiszka@domain.hid \
    --cc=adeos-main@gna.org \
    --cc=rpm@xenomai.org \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.