]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Fix a number of subtle and evil bugs in the libc_r wrapping of sendfile(2).
authoralfred <alfred@FreeBSD.org>
Wed, 12 Dec 2001 08:02:24 +0000 (08:02 +0000)
committeralfred <alfred@FreeBSD.org>
Wed, 12 Dec 2001 08:02:24 +0000 (08:02 +0000)
commit13d622545cac749139a5a9f7c3febc2735379d9d
treea62c5be08d2944707571a326148fd2128b4911ac
parent84bcda9834c9bc93e56049f35b5a8085f0169335
Fix a number of subtle and evil bugs in the libc_r wrapping of sendfile(2).

o) Since we unwrap the sendfile syscall, check the return value of
   writev(2) to see if it didn't complete all the data.
   Previously if only a partial writev() succeeded, it would proceed
   to sendfile(2) even though the headers weren't completely sent.

o) Properly adjust the "bytes to send" to take into account sendfile(2)'s
   behaviour of counting the headers against the bytes to be transfered
   from the file.

o) Correct the problem where EAGAIN was being returned from _sys_sendfile(2)
   however the wrapper didn't update the 'sent bytes' parameter to take into
   account for it.  This is because sendfile can return EAGAIN even though
   it has actually transfered data.

Special thanks to Justin Erenkrantz <jerenkrantz@apache.org> for bringing
this to my attention and giving an excellent way to reproduce the problem.

PR: kern/32684
MFC After: 1 week
lib/libc_r/uthread/uthread_sendfile.c