All of lore.kernel.org
 help / color / mirror / Atom feed
From: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
To: LTP <ltp-list@lists.sourceforge.net>
Subject: Re: [LTP] [PATCH 1/2] lib: Add SAFE_KILL()
Date: Fri, 16 May 2014 12:55:58 +0800	[thread overview]
Message-ID: <53759A5E.4020104@cn.fujitsu.com> (raw)
In-Reply-To: <1400215973-2049-1-git-send-email-wangxg.fnst@cn.fujitsu.com>

Hi,

    I forgot to send this patch first, please review this patch first, thanks.

Regards,
Xiaoguang Wang

On 05/16/2014 12:52 PM, Xiaoguang Wang wrote:
> Signed-off-by: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
> ---
>  include/safe_macros.h |  5 +++++
>  lib/safe_macros.c     | 16 ++++++++++++++++
>  2 files changed, 21 insertions(+)
>
> diff --git a/include/safe_macros.h b/include/safe_macros.h
> index 9e3ba98..c79dadf 100644
> --- a/include/safe_macros.h
> +++ b/include/safe_macros.h
> @@ -231,5 +231,10 @@ pid_t safe_waitpid(const char *file, const int lineno, void (cleanup_fn)(void),
>  #define SAFE_WAITPID(cleanup_fn, pid, status, opts) \
>          safe_waitpid(__FILE__, __LINE__, (cleanup_fn), (pid), (status), (opts))
>  
> +int safe_kill(const char *file, const int lineno, void (cleanup_fn)(void),
> +		  pid_t pid, int sig);
> +#define SAFE_KILL(cleanup_fn, pid, sig) \
> +	safe_kill(__FILE__, __LINE__, (cleanup_fn), (pid), (sig))
> +
>  #endif /* __SAFE_MACROS_H__ */
>  #endif /* __TEST_H__ */
> diff --git a/lib/safe_macros.c b/lib/safe_macros.c
> index 48a837c..81c66b5 100644
> --- a/lib/safe_macros.c
> +++ b/lib/safe_macros.c
> @@ -659,3 +659,19 @@ pid_t safe_waitpid(const char *file, const int lineno, void (cleanup_fn)(void),
>  
>  	return rval;
>  }
> +
> +int safe_kill(const char *file, const int lineno, void (cleanup_fn)(void),
> +	      pid_t pid, int sig)
> +{
> +	int rval;
> +
> +	rval = kill(pid, sig);
> +
> +	if (rval == -1) {
> +		tst_brkm(TBROK | TERRNO, cleanup_fn,
> +			 "%s:%d: kill(%d,%s) failed",
> +			 file, lineno, pid, tst_strsig(sig));
> +	}
> +
> +	return rval;
> +}


------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

  reply	other threads:[~2014-05-16  4:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-15 10:32 [LTP] [PATCH] sendfile/sendfile06.c: cleanup and fix some bugs Xiaoguang Wang
2014-05-16  4:52 ` [LTP] [PATCH 1/2] lib: Add SAFE_KILL() Xiaoguang Wang
2014-05-16  4:55   ` Xiaoguang Wang [this message]
2014-06-03 16:12 ` [LTP] [PATCH] sendfile/sendfile06.c: cleanup and fix some bugs chrubis

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=53759A5E.4020104@cn.fujitsu.com \
    --to=wangxg.fnst@cn.fujitsu.com \
    --cc=ltp-list@lists.sourceforge.net \
    /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.