From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id EBAD33858407; Thu, 4 Aug 2022 18:33:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EBAD33858407 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Corinna Vinschen To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: syscalls.cc: drop masking macros for standard IO functions X-Act-Checkin: newlib-cygwin X-Git-Author: Corinna Vinschen X-Git-Refname: refs/heads/master X-Git-Oldrev: 9f6057d203d1a8da57f332c63db778680d9b4315 X-Git-Newrev: 7718cb70d48eec468a0b0cb815ed4f8461355eda Message-Id: <20220804183340.EBAD33858407@sourceware.org> Date: Thu, 4 Aug 2022 18:33:40 +0000 (GMT) X-BeenThere: cygwin-cvs@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin core component git logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Aug 2022 18:33:41 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3D7718cb70d48= eec468a0b0cb815ed4f8461355eda commit 7718cb70d48eec468a0b0cb815ed4f8461355eda Author: Corinna Vinschen Date: Thu Aug 4 20:32:36 2022 +0200 Cygwin: syscalls.cc: drop masking macros for standard IO functions =20 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. =20 They are not needed anymore, so just drop them. =20 This uncovered that the buffer pointer to pwrite is erronously non-const. Fix this on the way out. =20 Signed-off-by: Corinna Vinschen 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 ter= ms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ =20 -#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 @@ -37,12 +26,6 @@ details. */ #include #include "ntdll.h" =20 -#undef fstat -#undef lstat -//#undef stat -#undef pread -#undef pwrite - #include #include "cygerrno.h" #include "perprocess.h" @@ -62,12 +45,6 @@ details. */ #include /* needed for RENAME_NOREPLACE */ #include /* needed for _fwalk_sglue() declaration */ =20 -#undef _close -#undef _lseek -#undef _open -#undef _read -#undef _write - static int mknod_worker (path_conv &, mode_t, _major_t, _minor_t); =20 /* Close all files and process any queued deletions. @@ -1412,7 +1389,7 @@ writev (const int fd, const struct iovec *const iov, = const int iovcnt) } =20 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 (); =20 @@ -1426,7 +1403,7 @@ pwrite (int fd, void *ptr, size_t len, off_t off) res =3D -1; } else - res =3D cfd->pwrite (ptr, len, off); + res =3D cfd->pwrite (const_cast (ptr), len, off); =20 syscall_printf ("%lR =3D pwrite(%d, %p, %d, %d)", res, fd, ptr, len, off= ); return res;