Author: Joannah Nanjekye <[email protected]>
Branch: jumbo
Changeset: r90652:41b02003b58e
Date: 2017-03-02 18:26 +0300
http://bitbucket.org/pypy/pypy/changeset/41b02003b58e/

Log:    pwrite

diff --git a/rpython/rlib/rposix.py b/rpython/rlib/rposix.py
--- a/rpython/rlib/rposix.py
+++ b/rpython/rlib/rposix.py
@@ -480,6 +480,15 @@
     with rffi.scoped_alloc_buffer(count) as buf:
         void_buf = rffi.cast(rffi.VOIDP, buf.raw)
         return buf.str(handle_posix_error('pread', c_pread(fd, void_buf, 
count, offset)))
+        
+@replace_os_function('pwrite')
+@enforceargs(int, None, None)
+def pwrite(fd, data, offset):
+    count = len(data)
+    validate_fd(fd)
+    with rffi.scoped_nonmovingbuffer(data) as buf:
+        return handle_posix_error('pwrite', c_pwrite(fd, buf, count, offset))
+
 
 c_ftruncate = external('ftruncate', [rffi.INT, rffi.LONGLONG], rffi.INT,
                        macro=_MACRO_ON_POSIX, save_err=rffi.RFFI_SAVE_ERRNO)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to