lkml.org 
[lkml]   [2009]   [Mar]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 5/5] tracing: add binary buffer files for use with splice

On Tue, 3 Mar 2009, Theodore Tso wrote:

> On Tue, Mar 03, 2009 at 10:43:16PM -0500, Steven Rostedt wrote:
> > > Conventionally a read() system call will return the number of bytes
> > > copied, and will only return -EFOO if the number of bytes copied was
> > > zero.
> > >
> > > Lots of parts of the kernel break this, but it's usually device drivers
> > > and scruffy pseudo files, in which case a partial file read doesn't
> > > make much sense. This doesn't make the broken behaviour right, but at
> > > least we have a bit of a weaselly excuse in that case.
> > >
> >
> > I just went by the read man page:
> >
> > EFAULT buf is outside your accessible address space.
> >
>
> What is normally done in this case if buf is within the addressable
> space, but buf+x is not, where x < len, then read(fd, buf, len) will
> fill copy as many characters it can into buf until it runs out of
> valid addres space, and then return that count as a partial read.

I guess I need to change that code to be:

if (ret) {
if (ret == size)
return -EFAULT;
size -= ret;
}

??

-- Steve



\
 
 \ /
  Last update: 2009-03-04 05:51    [W:0.051 / U:3.744 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site