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


Groups > linux.kernel > #1671663 > unrolled thread

Re: [PATCH v3 4/6] Fix read / write data offsets in read / write loops

Started bySteven Rostedt <rostedt@goodmis.org>
First post2017-06-21 15:30 +0200
Last post2017-06-21 19:40 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH v3 4/6] Fix read / write data offsets in read / write  loops Steven Rostedt <rostedt@goodmis.org> - 2017-06-21 15:30 +0200
    Re: [PATCH v3 4/6] Fix read / write data offsets in read / write  loops Michael Sartain <mikesart@fastmail.com> - 2017-06-21 19:40 +0200

#1671663 — Re: [PATCH v3 4/6] Fix read / write data offsets in read / write loops

FromSteven Rostedt <rostedt@goodmis.org>
Date2017-06-21 15:30 +0200
SubjectRe: [PATCH v3 4/6] Fix read / write data offsets in read / write loops
Message-ID<tUNRM-6Ci-17@gated-at.bofh.it>
On Wed, 14 Jun 2017 18:27:59 -0600
Michael Sartain <mikesart@fastmail.com> wrote:

> The tot variable in __do_write and do_read is incremented with the amount read
> / written, but subsequent times through the loop the calls continue to use the
> original data pointer.
> 
> Signed-off-by: Michael Sartain <mikesart@fastmail.com>
> ---
>  trace-cmd-local.h | 2 +-
>  trace-input.c     | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/trace-cmd-local.h b/trace-cmd-local.h
> index 8595a8a..b8ab35b 100644
> --- a/trace-cmd-local.h
> +++ b/trace-cmd-local.h
> @@ -31,7 +31,7 @@ static ssize_t __do_write(int fd, const void *data, size_t size)
>  	ssize_t w;
>  
>  	do {
> -		w = TEMP_FAILURE_RETRY(write(fd, data, size - tot));
> +		w = TEMP_FAILURE_RETRY(write(fd, data + tot, size - tot));

Good catch. I'm going to modify this to remove the TEMP_FAILURE_RETRY()
though. I'll hopefully get this pushed out later today, and we could
add the write_intr() and friends later.

-- Steve

>  		tot += w;
>  
>  		if (!w)
> diff --git a/trace-input.c b/trace-input.c
> index 251d32b..8395917 100644
> --- a/trace-input.c
> +++ b/trace-input.c
> @@ -202,7 +202,7 @@ static ssize_t do_read(struct tracecmd_input *handle, void *data, size_t size)
>  	ssize_t r;
>  
>  	do {
> -		r = TEMP_FAILURE_RETRY(read(handle->fd, data, size - tot));
> +		r = TEMP_FAILURE_RETRY(read(handle->fd, data + tot, size - tot));
>  		tot += r;
>  
>  		if (!r)

[toc] | [next] | [standalone]


#1671841

FromMichael Sartain <mikesart@fastmail.com>
Date2017-06-21 19:40 +0200
Message-ID<tURLI-Mh-21@gated-at.bofh.it>
In reply to#1671663
On Wed, Jun 21, 2017 at 09:29:14AM -0400, Steven Rostedt wrote:
> On Wed, 14 Jun 2017 18:27:59 -0600
> Michael Sartain <mikesart@fastmail.com> wrote:
> 
> > The tot variable in __do_write and do_read is incremented with the amount read
> > / written, but subsequent times through the loop the calls continue to use the
> > original data pointer.
> > 
> > Signed-off-by: Michael Sartain <mikesart@fastmail.com>
> > ---
> >  trace-cmd-local.h | 2 +-
> >  trace-input.c     | 2 +-
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/trace-cmd-local.h b/trace-cmd-local.h
> > index 8595a8a..b8ab35b 100644
> > --- a/trace-cmd-local.h
> > +++ b/trace-cmd-local.h
> > @@ -31,7 +31,7 @@ static ssize_t __do_write(int fd, const void *data, size_t size)
> >  	ssize_t w;
> >  
> >  	do {
> > -		w = TEMP_FAILURE_RETRY(write(fd, data, size - tot));
> > +		w = TEMP_FAILURE_RETRY(write(fd, data + tot, size - tot));
> 
> Good catch. I'm going to modify this to remove the TEMP_FAILURE_RETRY()
> though. I'll hopefully get this pushed out later today, and we could
> add the write_intr() and friends later.

I've got a couple other patches ready to submit. I'll wait for your push,
rebase those, and add a TEMP_FAILURE_RETRY -> *_intr() patch with those.

Thanks much Steve.
 -Mike

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web