This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix error checking in utrace_attach_task()


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)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]