mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-11 10:08:41 +00:00
Changes to ssl_EmulateSendFile suggested by Wan-Teh.
See http://bugzilla.mozilla.org/show_bug.cgi?id=39011
This commit is contained in:
parent
1e2dbd5a1d
commit
db1c7e8b35
@ -34,7 +34,7 @@
|
||||
* may use your version of this file under either the MPL or the
|
||||
* GPL.
|
||||
*
|
||||
* $Id: emulate.c,v 1.1 2000/03/31 19:31:31 relyea%netscape.com Exp $
|
||||
* $Id: emulate.c,v 1.2 2000/05/18 01:32:53 nelsonb%netscape.com Exp $
|
||||
*/
|
||||
|
||||
#include "nspr.h"
|
||||
@ -42,6 +42,10 @@
|
||||
#if defined( XP_UNIX )
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
#if defined(WIN32)
|
||||
#include <windef.h>
|
||||
#include <winbase.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
|
||||
#define AMASK 7 /* mask for alignment of PRNetAddr */
|
||||
@ -490,7 +494,15 @@ ssl_EmulateSendFile(PRFileDesc *sd, PRSendFileData *sfd,
|
||||
else
|
||||
file_bytes = info.size - sfd->file_offset;
|
||||
|
||||
#if defined(WIN32)
|
||||
{
|
||||
SYSTEM_INFO sysinfo;
|
||||
GetSystemInfo(&sysinfo);
|
||||
pagesize = sysinfo.dwAllocationGranularity;
|
||||
}
|
||||
#else
|
||||
pagesize = PR_GetPageSize();
|
||||
#endif
|
||||
/*
|
||||
* If the file is large, mmap and send the file in chunks so as
|
||||
* to not consume too much virtual address space
|
||||
@ -520,7 +532,7 @@ ssl_EmulateSendFile(PRFileDesc *sd, PRSendFileData *sfd,
|
||||
* Map in (part of) file. Take care of zero-length files.
|
||||
*/
|
||||
if (len > 0) {
|
||||
mapHandle = PR_CreateFileMap(sfd->fd, mmap_len, PR_PROT_READONLY);
|
||||
mapHandle = PR_CreateFileMap(sfd->fd, info.size, PR_PROT_READONLY);
|
||||
if (!mapHandle) {
|
||||
count = -1;
|
||||
goto done;
|
||||
|
Loading…
x
Reference in New Issue
Block a user