mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
(Merge 3.1) Issue #11277: mmap.mmap() calls fcntl(fd, F_FULLFSYNC) on Mac OS X
to get around a mmap bug with sparse files. Patch written by Steffen Daode Nurpmeso.
This commit is contained in:
commit
8108e96bc8
4 changed files with 17 additions and 1 deletions
|
@ -23,6 +23,9 @@
|
|||
|
||||
#ifndef MS_WINDOWS
|
||||
#define UNIX
|
||||
# ifdef __APPLE__
|
||||
# include <fcntl.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef MS_WINDOWS
|
||||
|
@ -1122,6 +1125,12 @@ new_mmap_object(PyTypeObject *type, PyObject *args, PyObject *kwdict)
|
|||
"mmap invalid access parameter.");
|
||||
}
|
||||
|
||||
#ifdef __APPLE__
|
||||
/* Issue #11277: fsync(2) is not enough on OS X - a special, OS X specific
|
||||
fcntl(2) is necessary to force DISKSYNC and get around mmap(2) bug */
|
||||
if (fd != -1)
|
||||
(void)fcntl(fd, F_FULLFSYNC);
|
||||
#endif
|
||||
#ifdef HAVE_FSTAT
|
||||
# ifdef __VMS
|
||||
/* on OpenVMS we must ensure that all bytes are written to the file */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue