From 7d7d09aee8fa09aab03d14b0b672a34805ce50b9 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Fri, 29 Jul 2005 17:04:46 +0000 Subject: * fhandler.h (fhandler_base::pread): Declare new function. (fhandler_base::pwrite): Ditto. (fhandler_disk_file::pread): Ditto. (fhandler_disk_file::pwrite): Ditto. * fhandler.cc (fhandler_base::pread): Define new function. (fhandler_base::pwrite): Ditto. * fhandler_disk_file.cc (fhandler_base::pread): Ditto. (fhandler_base::pwrite): Ditto. * syscalls.cc (pread): Define new function. (pwrite): Ditto. * cygwin.din: Export pread, pwrite. * include/sys/ioctl.h: Guard some _IO* declarations to avoid conflict with socket.h. --- winsup/cygwin/fhandler_disk_file.cc | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'winsup/cygwin/fhandler_disk_file.cc') diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc index 368df374d..76fe9b393 100644 --- a/winsup/cygwin/fhandler_disk_file.cc +++ b/winsup/cygwin/fhandler_disk_file.cc @@ -984,6 +984,30 @@ fhandler_base::close_fs () return res; } +ssize_t __stdcall +fhandler_disk_file::pread (void *buf, size_t count, _off64_t offset) +{ + ssize_t res = lseek (offset, SEEK_SET); + if (res >= 0) + { + size_t tmp_count = count; + read (buf, tmp_count); + res = (ssize_t) tmp_count; + } + debug_printf ("%d = pread (%p, %d, %d)\n", res, buf, count, offset); + return res; +} + +ssize_t __stdcall +fhandler_disk_file::pwrite (void *buf, size_t count, _off64_t offset) +{ + ssize_t res = lseek (offset, SEEK_SET); + if (res >= 0) + res = write (buf, count); + debug_printf ("%d = pwrite (%p, %d, %d)\n", res, buf, count, offset); + return res; +} + /* FIXME: The correct way to do this to get POSIX locking semantics is to keep a linked list of posix lock requests and map them into Win32 locks. he problem is that Win32 does not deal correctly with overlapping lock -- cgit v1.2.3