lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 29 Apr 2014 14:11:03 +0200
From:	Peter Zijlstra <peterz@...radead.org>
To:	Namhyung Kim <namhyung@...nel.org>
Cc:	Arnaldo Carvalho de Melo <acme@...nel.org>,
	Jiri Olsa <jolsa@...hat.com>, Ingo Molnar <mingo@...nel.org>,
	Stephane Eranian <eranian@...gle.com>,
	LKML <linux-kernel@...r.kernel.org>,
	Namhyung Kim <namhyung.kim@....com>
Subject: Re: [PATCH v3 2/3] perf record: Propagate exit status of a command
 line workload

On Thu, Apr 24, 2014 at 10:27:33PM +0900, Namhyung Kim wrote:
>  static void record__sig_exit(int exit_status __maybe_unused, void *arg)
>  {
> -	struct record *rec = arg;
> -	int status;
> -
> -	if (rec->evlist->workload.pid > 0) {
> -		if (!child_finished)
> -			kill(rec->evlist->workload.pid, SIGTERM);
> -
> -		wait(&status);
> -		if (WIFSIGNALED(status))
> -			psignal(WTERMSIG(status), rec->progname);
> -	}
> -
> -	if (signr == -1 || signr == SIGUSR1)
> +	if (signr == -1)
>  		return;
>  
>  	signal(signr, SIG_DFL);
>  }


> +out_child:
> +	if (forks) {
> +		int exit_status;
>  
> -	return 0;
> +		if (!child_finished)
> +			kill(rec->evlist->workload.pid, SIGTERM);
> +
> +		wait(&exit_status);
> +
> +		if (err < 0)
> +			status = err;
> +		else if (WIFEXITED(exit_status))
> +			status = WEXITSTATUS(exit_status);
> +		else if (WIFSIGNALED(status))
		{
		signr = WTERMSIG(status);
> +			psignal(WTERMSIG(status), rec->progname);
		}
> +	} else
> +		status = err;
> +
> +	if (!err && !file->is_pipe) {
> +		rec->session->header.data_size += rec->bytes_written;
> +
> +		if (!rec->no_buildid)
> +			process_buildids(rec);
> +		perf_session__write_header(rec->session, rec->evlist,
> +					   file->fd, true);
> +	}

Should do I suppose; not sure why the psignal() muck is in there, but it
don't hurt I suppose.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ