Author: jra Date: 2004-08-06 17:49:00 +0000 (Fri, 06 Aug 2004) New Revision: 1665 WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/branches/SAMBA_3_0/source&rev=1665&nolog=1 Log: Patch from James Peach @ SGI to stop using sendfile if it isn't supported by the underlying OS. Jeremy.
Modified: branches/SAMBA_3_0/source/param/loadparm.c branches/SAMBA_3_0/source/smbd/reply.c Changeset: Modified: branches/SAMBA_3_0/source/param/loadparm.c =================================================================== --- branches/SAMBA_3_0/source/param/loadparm.c 2004-08-06 05:44:26 UTC (rev 1664) +++ branches/SAMBA_3_0/source/param/loadparm.c 2004-08-06 17:49:00 UTC (rev 1665) @@ -4324,6 +4324,18 @@ } /******************************************************************* + Turn off sendfile if we find the underlying OS doesn't support it. +********************************************************************/ + +void set_use_sendfile(int snum, BOOL val) +{ + if (LP_SNUM_OK(snum)) + ServicePtrs[snum]->bUseSendfile = val; + else + sDefault.bUseSendfile = val; +} + +/******************************************************************* Turn off storing DOS attributes if this share doesn't support it. ********************************************************************/ Modified: branches/SAMBA_3_0/source/smbd/reply.c =================================================================== --- branches/SAMBA_3_0/source/smbd/reply.c 2004-08-06 05:44:26 UTC (rev 1664) +++ branches/SAMBA_3_0/source/smbd/reply.c 2004-08-06 17:49:00 UTC (rev 1665) @@ -1748,8 +1748,10 @@ * Special hack for broken Linux with no 64 bit clean sendfile. If we * return ENOSYS then pretend we just got a normal read. */ - if (errno == ENOSYS) + if (errno == ENOSYS) { + set_use_sendfile(SNUM(conn), False); goto normal_read; + } DEBUG(0,("send_file_readbraw: sendfile failed for file %s (%s). Terminating\n", fsp->fsp_name, strerror(errno) )); @@ -2111,8 +2113,10 @@ * Special hack for broken Linux with no 64 bit clean sendfile. If we * return ENOSYS then pretend we just got a normal read. */ - if (errno == ENOSYS) + if (errno == ENOSYS) { + set_use_sendfile(SNUM(conn), False); goto normal_read; + } DEBUG(0,("send_file_readX: sendfile failed for file %s (%s). Terminating\n", fsp->fsp_name, strerror(errno) ));