1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00

r1665: Patch from James Peach @ SGI to stop using sendfile if it isn't

supported by the underlying OS.
Jeremy.
(This used to be commit 1b0c70cf97)
This commit is contained in:
Jeremy Allison 2004-08-06 17:49:00 +00:00 committed by Gerald (Jerry) Carter
parent 161d3eeb4b
commit e0475afa83
2 changed files with 18 additions and 2 deletions

View File

@ -4323,6 +4323,18 @@ BOOL lp_use_sendfile(int snum)
return (_lp_use_sendfile(snum) && (get_remote_arch() != RA_WIN95) && !srv_is_signing_active());
}
/*******************************************************************
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.
********************************************************************/

View File

@ -1748,8 +1748,10 @@ void send_file_readbraw(connection_struct *conn, files_struct *fsp, SMB_OFF_T st
* 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 @@ int send_file_readX(connection_struct *conn, char *inbuf,char *outbuf,int length
* 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) ));