[lkml]   [2008]   [Jul]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] x86_64: fix delayed signals

On Fri, 11 Jul 2008, Roland McGrath wrote:
> > + /* Only check signals if we have filled at least one entry! */
> > + if (signal_pending(current))
> > + return -EINTR;
> Shouldn't it return the short count?
> (And if not, then probably should be -ERESTARTSYS.)

readdir (getdents) is a complex system call, and the path is

sys_getdents64() ->
vfs_readdir (with 'filldir64' as a callback) ->
low-level filesystem 'readdir' function ->
filldir64 callback

and what happens is that when that 'filldir64()' callback returns an
error, the low-level filesystem just stops and returns with a success
(because everything worked for _it_ - it was the callback that errored

The 'sys_getdents64()' then does:

lastdirent = buf.previous;
if (lastdirent) {
typeof(lastdirent->d_off) d_off = file->f_pos;
error = -EFAULT;
if (__put_user(d_off, &lastdirent->d_off))
goto out_putf;
error = count - buf.count;

ie we'll do that "return partial buffer size" at that level, not deep in
the callback.

So making the callback just return an error is the right thing to do -
because the callers will then fix up the file offset in the last directory
entry and the final return value.


 \ /
  Last update: 2008-07-11 20:21    [W:0.071 / U:1.916 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site