public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix error checking in utrace_attach_task()
@ 2011-06-02  0:43 Atsushi Tsuji
  2011-06-02 11:24 ` Frank Ch. Eigler
  2011-06-02 16:28 ` David Smith
  0 siblings, 2 replies; 3+ messages in thread
From: Atsushi Tsuji @ 2011-06-02  0:43 UTC (permalink / raw)
  To: systemtap ML

utrace_attach_task() returns not ENOENT but ESRCH in case of
UTRACE_ATTACH_CREATE if an error occurs. So this patch fixes
error checking to correctly ignore processes in "mortally
wounded" state.

Signed-off-by: Atsushi Tsuji <a-tsuji@bk.jp.nec.com>
---
 runtime/task_finder.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/runtime/task_finder.c b/runtime/task_finder.c
index 2c52175..552972b 100644
--- a/runtime/task_finder.c
+++ b/runtime/task_finder.c
@@ -506,7 +506,7 @@ __stp_utrace_attach(struct task_struct *tsk,
 	engine = utrace_attach_task(tsk, UTRACE_ATTACH_CREATE, ops, data);
 	if (IS_ERR(engine)) {
 		int error = -PTR_ERR(engine);
-		if (error != ENOENT) {
+		if (error != ESRCH) {
 			_stp_error("utrace_attach returned error %d on pid %d",
 				   error, (int)tsk->pid);
 			rc = error;
-- 1.7.2.1 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix error checking in utrace_attach_task()
  2011-06-02  0:43 [PATCH] Fix error checking in utrace_attach_task() Atsushi Tsuji
@ 2011-06-02 11:24 ` Frank Ch. Eigler
  2011-06-02 16:28 ` David Smith
  1 sibling, 0 replies; 3+ messages in thread
From: Frank Ch. Eigler @ 2011-06-02 11:24 UTC (permalink / raw)
  To: Atsushi Tsuji; +Cc: systemtap ML

Atsushi Tsuji <a-tsuji@bk.jp.nec.com> writes:

> utrace_attach_task() returns not ENOENT but ESRCH in case of
> UTRACE_ATTACH_CREATE if an error occurs. So this patch fixes
> error checking to correctly ignore processes in "mortally
> wounded" state.
> [...]

If I understand correctly, the difference is that we don't print the
"utrace_attach returned error ..." error message, and thus don't end
up calling _stp_exit() to shut the script down.  (Perhaps task_finder
is too trigger-happy to call _stp_error, when _stp_softerror could be
better.)

- FChE

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix error checking in utrace_attach_task()
  2011-06-02  0:43 [PATCH] Fix error checking in utrace_attach_task() Atsushi Tsuji
  2011-06-02 11:24 ` Frank Ch. Eigler
@ 2011-06-02 16:28 ` David Smith
  1 sibling, 0 replies; 3+ messages in thread
From: David Smith @ 2011-06-02 16:28 UTC (permalink / raw)
  To: Atsushi Tsuji; +Cc: systemtap ML

On 06/01/2011 07:38 PM, Atsushi Tsuji wrote:
> utrace_attach_task() returns not ENOENT but ESRCH in case of
> UTRACE_ATTACH_CREATE if an error occurs. So this patch fixes
> error checking to correctly ignore processes in "mortally
> wounded" state.
> 
> Signed-off-by: Atsushi Tsuji <a-tsuji@bk.jp.nec.com>
> ---
>  runtime/task_finder.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/runtime/task_finder.c b/runtime/task_finder.c
> index 2c52175..552972b 100644
> --- a/runtime/task_finder.c
> +++ b/runtime/task_finder.c
> @@ -506,7 +506,7 @@ __stp_utrace_attach(struct task_struct *tsk,
>  	engine = utrace_attach_task(tsk, UTRACE_ATTACH_CREATE, ops, data);
>  	if (IS_ERR(engine)) {
>  		int error = -PTR_ERR(engine);
> -		if (error != ENOENT) {
> +		if (error != ESRCH) {
>  			_stp_error("utrace_attach returned error %d on pid %d",
>  				   error, (int)tsk->pid);
>  			rc = error;
> -- 1.7.2.1 

Thanks a bunch for the patch, I've checked this in (commit ede8ec6).  I
tweaked your patch a small bit to check for ENOENT and ESRCH, since
ENOENT seems to be returned by the old utrace in this case.

Thanks again!

-- 
David Smith
dsmith@redhat.com
Red Hat
http://www.redhat.com
256.217.0141 (direct)
256.837.0057 (fax)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-06-02 16:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-02  0:43 [PATCH] Fix error checking in utrace_attach_task() Atsushi Tsuji
2011-06-02 11:24 ` Frank Ch. Eigler
2011-06-02 16:28 ` David Smith

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).