ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libeio/eio.c
(Generate patch)

Comparing libeio/eio.c (file contents):
Revision 1.51 by root, Thu Jan 7 18:08:21 2010 UTC vs.
Revision 1.52 by root, Fri Jan 8 09:29:56 2010 UTC

919 */ 919 */
920 { 920 {
921 off_t sbytes; 921 off_t sbytes;
922 res = sendfile (ifd, ofd, offset, count, 0, &sbytes, 0); 922 res = sendfile (ifd, ofd, offset, count, 0, &sbytes, 0);
923 923
924 /* freebsd' sendfile will return 0 when success */ 924 /* freebsd' sendfile will return 0 on success */
925 if (res == 0 && sbytes) 925 /* freebsd 8 documents it as only setting *sbytes on EINTR and EAGAIN, but */
926 /* maybe only on EAGAIN: as usual, the manpage leaves you guessing */ 926 /* not on e.g. EIO or EPIPE - sounds broken */
927 if ((res < 0 && (errno == EAGAIN || errno == EINTR) && sbytes) || res == 0)
927 res = sbytes; 928 res = sbytes;
928 } 929 }
929 930
930# elif defined (__APPLE__) 931# elif defined (__APPLE__)
931 932
932 { 933 {
933 off_t sbytes = count; 934 off_t sbytes = count;
934 res = sendfile (ifd, ofd, offset, &sbytes, 0, 0); 935 res = sendfile (ifd, ofd, offset, &sbytes, 0, 0);
935 936
936 if (res == 0 && errno == EAGAIN && sbytes) 937 /* according to the manpage, sbytes is always valid */
938 if (sbytes)
937 res = sbytes; 939 res = sbytes;
938 } 940 }
939 941
940# elif __hpux 942# elif __hpux
941 res = sendfile (ofd, ifd, offset, count, 0, 0); 943 res = sendfile (ofd, ifd, offset, count, 0, 0);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines