summaryrefslogtreecommitdiffstats
path: root/Include/fileutils.h
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2015-03-19 21:53:20 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2015-03-19 21:53:20 (GMT)
commit66aab0c4b5b6b328aebc115f96275e7dcd114f8b (patch)
treec607e0019befcb199fb8f916038d01a0b3b9a5f3 /Include/fileutils.h
parent9eb57c5fa50ed2f57d9320bb575371868316b5f2 (diff)
downloadcpython-66aab0c4b5b6b328aebc115f96275e7dcd114f8b.zip
cpython-66aab0c4b5b6b328aebc115f96275e7dcd114f8b.tar.gz
cpython-66aab0c4b5b6b328aebc115f96275e7dcd114f8b.tar.bz2
Issue #23708: Add _Py_read() and _Py_write() functions to factorize code handle
EINTR error and special cases for Windows. These functions now truncate the length to PY_SSIZE_T_MAX to have a portable and reliable behaviour. For example, read() result is undefined if counter is greater than PY_SSIZE_T_MAX on Linux.
Diffstat (limited to 'Include/fileutils.h')
-rw-r--r--Include/fileutils.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/Include/fileutils.h b/Include/fileutils.h
index f5fd668..cfcc403 100644
--- a/Include/fileutils.h
+++ b/Include/fileutils.h
@@ -80,6 +80,16 @@ PyAPI_FUNC(FILE*) _Py_fopen_obj(
PyObject *path,
const char *mode);
+PyAPI_FUNC(Py_ssize_t) _Py_read(
+ int fd,
+ void *buf,
+ size_t count);
+
+PyAPI_FUNC(Py_ssize_t) _Py_write(
+ int fd,
+ const void *buf,
+ size_t count);
+
#ifdef HAVE_READLINK
PyAPI_FUNC(int) _Py_wreadlink(
const wchar_t *path,