https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=7718cb70d48eec468a0b0cb815ed4f8461355eda commit 7718cb70d48eec468a0b0cb815ed4f8461355eda Author: Corinna Vinschen <corinna@vinschen.de> Date: Thu Aug 4 20:32:36 2022 +0200 Cygwin: syscalls.cc: drop masking macros for standard IO functions The actual reason for these wrappers are lost in time, there's no hint even in the pre-2000 ChangeLog files. Apparently they were masking the prototypes or, alternatively, macros from newlib to clash with the definitions in syscalls.cc. They are not needed anymore, so just drop them. This uncovered that the buffer pointer to pwrite is erronously non-const. Fix this on the way out. Signed-off-by: Corinna Vinschen <corinna@vinschen.de> Diff: --- winsup/cygwin/syscalls.cc | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 2c2bc4142..2a481b8e5 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -6,17 +6,6 @@ This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ -#define fstat __FOOfstat__ -#define lstat __FOOlstat__ -//#define stat __FOOstat__ -#define _close __FOO_close__ -#define _lseek __FOO_lseek__ -#define _open __FOO_open__ -#define _read __FOO_read__ -#define _write __FOO_write__ -#define pread __FOO_pread -#define pwrite __FOO_pwrite - #include "winsup.h" #include "miscfuncs.h" #include <sys/stat.h> @@ -37,12 +26,6 @@ details. */ #include <iptypes.h> #include "ntdll.h" -#undef fstat -#undef lstat -//#undef stat -#undef pread -#undef pwrite - #include <cygwin/version.h> #include "cygerrno.h" #include "perprocess.h" @@ -62,12 +45,6 @@ details. */ #include <cygwin/fs.h> /* needed for RENAME_NOREPLACE */ #include <sys/reent.h> /* needed for _fwalk_sglue() declaration */ -#undef _close -#undef _lseek -#undef _open -#undef _read -#undef _write - static int mknod_worker (path_conv &, mode_t, _major_t, _minor_t); /* Close all files and process any queued deletions. @@ -1412,7 +1389,7 @@ writev (const int fd, const struct iovec *const iov, const int iovcnt) } extern "C" ssize_t -pwrite (int fd, void *ptr, size_t len, off_t off) +pwrite (int fd, const void *ptr, size_t len, off_t off) { pthread_testcancel (); @@ -1426,7 +1403,7 @@ pwrite (int fd, void *ptr, size_t len, off_t off) res = -1; } else - res = cfd->pwrite (ptr, len, off); + res = cfd->pwrite (const_cast<void *> (ptr), len, off); syscall_printf ("%lR = pwrite(%d, %p, %d, %d)", res, fd, ptr, len, off); return res;