Skip to content

Commit

Permalink
Drop posix.fallocate() under WASI.
Browse files Browse the repository at this point in the history
The underlying POSIX function, posix_fallocate(), was found to vary too
much between implementations to remain in WASI. As such, while it was
available in WASI preview1, it's been dropped in preview2.
  • Loading branch information
brettcannon committed Nov 8, 2023
1 parent 31c90d5 commit 077baab
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Remove posix.fallocate() under WASI as the underlying posix_fallocate() is
not available in WASI preview2.
6 changes: 3 additions & 3 deletions Modules/clinic/posixmodule.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions Modules/posixmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -12165,7 +12165,10 @@ os_truncate_impl(PyObject *module, path_t *path, Py_off_t length)
#endif


#if defined(HAVE_POSIX_FALLOCATE) && !defined(POSIX_FADVISE_AIX_BUG)
/* GH-111804: Due to posix_fallocate() not having consistent semantics across
OSs, support was dropped in WASI preview2. */
#if defined(HAVE_POSIX_FALLOCATE) && !defined(POSIX_FADVISE_AIX_BUG) && \
!defined(__wasi__)
/*[clinic input]
os.posix_fallocate
Expand Down Expand Up @@ -12203,7 +12206,7 @@ os_posix_fallocate_impl(PyObject *module, int fd, Py_off_t offset,
errno = result;
return posix_error();
}
#endif /* HAVE_POSIX_FALLOCATE) && !POSIX_FADVISE_AIX_BUG */
#endif /* HAVE_POSIX_FALLOCATE) && !POSIX_FADVISE_AIX_BUG && !defined(__wasi__) */


#if defined(HAVE_POSIX_FADVISE) && !defined(POSIX_FADVISE_AIX_BUG)
Expand Down

0 comments on commit 077baab

Please sign in to comment.