Author: jra Date: 2004-08-06 17:49:06 +0000 (Fri, 06 Aug 2004) New Revision: 1666 WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/trunk/source&rev=1666&nolog=1 Log: Patch from James Peach @ SGI to stop using sendfile if it isn't supported by the underlying OS. Jeremy.
Modified: trunk/source/param/loadparm.c trunk/source/smbd/reply.c Changeset: Modified: trunk/source/param/loadparm.c =================================================================== --- trunk/source/param/loadparm.c 2004-08-06 17:49:00 UTC (rev 1665) +++ trunk/source/param/loadparm.c 2004-08-06 17:49:06 UTC (rev 1666) @@ -4336,6 +4336,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: trunk/source/smbd/reply.c =================================================================== --- trunk/source/smbd/reply.c 2004-08-06 17:49:00 UTC (rev 1665) +++ trunk/source/smbd/reply.c 2004-08-06 17:49:06 UTC (rev 1666) @@ -1746,8 +1746,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) )); @@ -2109,8 +2111,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) ));