Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 35.2k
gh-63016: Add flags parameter on mmap.flush#139553
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
eb249ef18243447ab6d307215d1405794b7d32ed525d48d651706484d790793a471614586fe8aFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Add a ``flags`` parameter to :meth:`mmap.mmap.flush` to control synchronization behavior. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1034,12 +1034,15 @@ mmap.mmap.flush | ||
| offset: Py_ssize_t = 0 | ||
| size: Py_ssize_t = -1 | ||
| / | ||
| * | ||
| flags: int = 0 | ||
aisk marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| [clinic start generated code]*/ | ||
| static PyObject * | ||
| mmap_mmap_flush_impl(mmap_object *self, Py_ssize_t offset, Py_ssize_t size) | ||
| /*[clinic end generated code: output=956ced67466149cf input=c50b893bc69520ec]*/ | ||
| mmap_mmap_flush_impl(mmap_object *self, Py_ssize_t offset, Py_ssize_t size, | ||
| int flags) | ||
| /*[clinic end generated code: output=4225f4174dc75a53 input=42ba5fb716b6c294]*/ | ||
| { | ||
| CHECK_VALID(NULL); | ||
| if (size == -1) { | ||
| @@ -1060,8 +1063,10 @@ mmap_mmap_flush_impl(mmap_object *self, Py_ssize_t offset, Py_ssize_t size) | ||
| } | ||
| Py_RETURN_NONE; | ||
| #elif defined(UNIX) | ||
| /* XXX flags for msync? */ | ||
| if (-1 == msync(self->data + offset, size, MS_SYNC)) { | ||
| if (flags == 0) { | ||
| flags = MS_SYNC; | ||
| } | ||
| if (-1 == msync(self->data + offset, size, flags)) { | ||
| PyErr_SetFromErrno(PyExc_OSError); | ||
| return NULL; | ||
| } | ||
| @@ -2331,6 +2336,16 @@ mmap_exec(PyObject *module) | ||
| ADD_INT_MACRO(module, ACCESS_WRITE); | ||
| ADD_INT_MACRO(module, ACCESS_COPY); | ||
| #ifdef MS_INVALIDATE | ||
| ADD_INT_MACRO(module, MS_INVALIDATE); | ||
| #endif | ||
| #ifdef MS_ASYNC | ||
| ADD_INT_MACRO(module, MS_ASYNC); | ||
| #endif | ||
| #ifdef MS_SYNC | ||
| ADD_INT_MACRO(module, MS_SYNC); | ||
| #endif | ||
| #ifdef HAVE_MADVISE | ||
| // Conventional advice values | ||
| #ifdef MADV_NORMAL | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.