Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1362747

Re: [PATCH trace-cmd 2/2] trace-recorder: better error handling during copy

From Steven Rostedt <rostedt@goodmis.org>
Newsgroups linux.kernel
Subject Re: [PATCH trace-cmd 2/2] trace-recorder: better error handling during copy
Date 2016-03-22 14:30 +0100
Message-ID <rfuxJ-4WW-33@gated-at.bofh.it> (permalink)
References <rfpeF-1f1-1@gated-at.bofh.it> <rfpeG-1f1-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, 22 Mar 2016 09:14:33 -0400
Peter Xu <peterx@redhat.com> wrote:

> Currently we have two ways to copy data, one is splice, one is read +
> write. For both, dump more information when we got errors during the
> copy. Also, when we update_fd(), we should make sure all bytes written,
> and update written bytes only.
> 
> These information might be important to better diagnose when the copy
> got wrong, like no space error, or connection error when copying data to
> remote sockets. In the past, we just got silence errors without notice.
> 
> Signed-off-by: Peter Xu <peterx@redhat.com>
> ---
>  trace-recorder.c | 34 ++++++++++++++++++++++++----------
>  1 file changed, 24 insertions(+), 10 deletions(-)
> 
> diff --git a/trace-recorder.c b/trace-recorder.c
> index 49b04ea..7d6feb0 100644
> --- a/trace-recorder.c
> +++ b/trace-recorder.c
> @@ -334,13 +334,14 @@ static inline void update_fd(struct tracecmd_recorder *recorder, int size)
>   */
>  static long splice_data(struct tracecmd_recorder *recorder)
>  {
> -	long ret;
> +	long ret, written;
>  
>  	ret = splice(recorder->trace_fd, NULL, recorder->brass[1], NULL,
>  		     recorder->page_size, 1 /* SPLICE_F_MOVE */);
>  	if (ret < 0) {
>  		if (errno != EAGAIN && errno != EINTR) {
> -			warning("recorder error in splice input");
> +			warning("recorder error in splice input: %s",
> +				strerror(errno));

I'm wondering if we should add a "pwarning()" helper function that will
do the stderror(error) for us.

-- Steve

>  			return -1;
>  		}

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH trace-cmd 0/2] better error handling during copy Peter Xu <peterx@redhat.com> - 2016-03-22 08:50 +0100
  [PATCH trace-cmd 1/2] trace-cmd-listen: remove useless printf Peter Xu <peterx@redhat.com> - 2016-03-22 08:50 +0100
    Re: [PATCH trace-cmd 1/2] trace-cmd-listen: remove useless printf Steven Rostedt <rostedt@goodmis.org> - 2016-03-22 14:20 +0100
      Re: [PATCH trace-cmd 1/2] trace-cmd-listen: remove useless printf Peter Xu <peterx@redhat.com> - 2016-03-23 07:50 +0100
  [PATCH trace-cmd 2/2] trace-recorder: better error handling during copy Peter Xu <peterx@redhat.com> - 2016-03-22 08:50 +0100
    Re: [PATCH trace-cmd 2/2] trace-recorder: better error handling  during copy Steven Rostedt <rostedt@goodmis.org> - 2016-03-22 14:30 +0100
      Re: [PATCH trace-cmd 2/2] trace-recorder: better error handling  during copy Peter Xu <peterx@redhat.com> - 2016-03-23 08:10 +0100
      [PATCH trace-cmd v2] trace-recorder: better error handling during copy Peter Xu <peterx@redhat.com> - 2016-03-23 08:10 +0100

csiph-web