From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id 10FAD38582A7; Wed, 3 Aug 2022 14:05:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 10FAD38582A7 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: drop macro and code for CYGWIN_VERSION_CHECK_FOR_OLD_O_NONBLOCK X-Act-Checkin: newlib-cygwin X-Git-Author: Corinna Vinschen X-Git-Refname: refs/heads/master X-Git-Oldrev: 7de1be0472a001573f80f94c1da89531175c830c X-Git-Newrev: c2743614bf2421b0594da33fb41845792d0e703b Message-Id: <20220803140550.10FAD38582A7@sourceware.org> Date: Wed, 3 Aug 2022 14:05:50 +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: Wed, 03 Aug 2022 14:05:50 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3Dc2743614bf2= 421b0594da33fb41845792d0e703b commit c2743614bf2421b0594da33fb41845792d0e703b Author: Corinna Vinschen Date: Wed Aug 3 15:48:56 2022 +0200 Cygwin: drop macro and code for CYGWIN_VERSION_CHECK_FOR_OLD_O_NONBLOCK =20 Signed-off-by: Corinna Vinschen Diff: --- winsup/cygwin/fhandler.cc | 15 +++++---------- winsup/cygwin/fhandler.h | 9 --------- winsup/cygwin/fhandler_socket.cc | 11 +++-------- winsup/cygwin/fhandler_socket_unix.cc | 4 +--- winsup/cygwin/include/cygwin/version.h | 3 --- 5 files changed, 9 insertions(+), 33 deletions(-) diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc index 9d6d01858..72d35391f 100644 --- a/winsup/cygwin/fhandler.cc +++ b/winsup/cygwin/fhandler.cc @@ -1360,17 +1360,12 @@ int fhandler_base::fcntl (int cmd, intptr_t arg) break; case F_SETFL: { - /* Only O_APPEND, O_ASYNC and O_NONBLOCK/O_NDELAY are allowed. + /* Only O_APPEND, O_ASYNC and O_NONBLOCK are allowed. Each other flag will be ignored. Since O_ASYNC isn't defined in fcntl.h it's currently ignored as well. */ - const int allowed_flags =3D O_APPEND | O_NONBLOCK_MASK; + const int allowed_flags =3D O_APPEND | O_NONBLOCK; int new_flags =3D arg & allowed_flags; - /* Carefully test for the O_NONBLOCK or deprecated OLD_O_NDELAY flag. - Set only the flag that has been passed in. If both are set, just - record O_NONBLOCK. */ - if ((new_flags & OLD_O_NDELAY) && (new_flags & O_NONBLOCK)) - new_flags &=3D ~OLD_O_NDELAY; set_flags ((get_flags () & ~allowed_flags) | new_flags); } res =3D 0; @@ -1573,15 +1568,15 @@ fhandler_base::fixup_after_exec () bool fhandler_base::is_nonblocking () { - return (openflags & O_NONBLOCK_MASK) !=3D 0; + return (openflags & O_NONBLOCK) !=3D 0; } =20 void fhandler_base::set_nonblocking (int yes) { - int current =3D openflags & O_NONBLOCK_MASK; + int current =3D openflags & O_NONBLOCK; int new_flags =3D yes ? (!current ? O_NONBLOCK : current) : 0; - openflags =3D (openflags & ~O_NONBLOCK_MASK) | new_flags; + openflags =3D (openflags & ~O_NONBLOCK) | new_flags; } =20 int diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index e4f1a2d94..aad7f4c37 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -15,15 +15,6 @@ details. */ #include #include =20 -/* newlib used to define O_NDELAY differently from O_NONBLOCK. Now it - properly defines both to be the same. Unfortunately, we have to - behave properly the old version, too, to accommodate older executables.= */ -#define OLD_O_NDELAY (CYGWIN_VERSION_CHECK_FOR_OLD_O_NONBLOCK ? 4 : 0) - -/* Care for the old O_NDELAY flag. If one of the flags is set, - both flags are set. */ -#define O_NONBLOCK_MASK (O_NONBLOCK | OLD_O_NDELAY) - /* It appears that 64K is the block size used for buffered I/O on NT. Using this blocksize in read/write calls in the application results in a much better performance than using smaller values. */ diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_sock= et.cc index 57a75df34..49ad5b3e0 100644 --- a/winsup/cygwin/fhandler_socket.cc +++ b/winsup/cygwin/fhandler_socket.cc @@ -246,17 +246,12 @@ fhandler_socket::fcntl (int cmd, intptr_t arg) { case F_SETFL: { - /* Carefully test for the O_NONBLOCK or deprecated OLD_O_NDELAY flag. - Set only the flag that has been passed in. If both are set, just - record O_NONBLOCK. */ - int new_flags =3D arg & O_NONBLOCK_MASK; - if ((new_flags & OLD_O_NDELAY) && (new_flags & O_NONBLOCK)) - new_flags =3D O_NONBLOCK; - current =3D get_flags () & O_NONBLOCK_MASK; + int new_flags =3D arg & O_NONBLOCK; + current =3D get_flags () & O_NONBLOCK; request =3D new_flags ? 1 : 0; if (!!current !=3D !!new_flags && (res =3D ioctl (FIONBIO, &request))) break; - set_flags ((get_flags () & ~O_NONBLOCK_MASK) | new_flags); + set_flags ((get_flags () & ~O_NONBLOCK) | new_flags); break; } default: diff --git a/winsup/cygwin/fhandler_socket_unix.cc b/winsup/cygwin/fhandler= _socket_unix.cc index b63f50c64..524f18d81 100644 --- a/winsup/cygwin/fhandler_socket_unix.cc +++ b/winsup/cygwin/fhandler_socket_unix.cc @@ -2289,10 +2289,8 @@ fhandler_socket_unix::fcntl (int cmd, intptr_t arg) case F_SETFL: { const bool was_nonblocking =3D is_nonblocking (); - const int allowed_flags =3D O_APPEND | O_NONBLOCK_MASK; + const int allowed_flags =3D O_APPEND | O_NONBLOCK; int new_flags =3D arg & allowed_flags; - if ((new_flags & OLD_O_NDELAY) && (new_flags & O_NONBLOCK)) - new_flags &=3D ~OLD_O_NDELAY; set_flags ((get_flags () & ~allowed_flags) | new_flags); const bool now_nonblocking =3D is_nonblocking (); if (was_nonblocking !=3D now_nonblocking) diff --git a/winsup/cygwin/include/cygwin/version.h b/winsup/cygwin/include= /cygwin/version.h index 8b9cbd7f3..0d55d8292 100644 --- a/winsup/cygwin/include/cygwin/version.h +++ b/winsup/cygwin/include/cygwin/version.h @@ -34,9 +34,6 @@ details. */ #define CYGWIN_VERSION_USER_API_VERSION_COMBINED \ CYGWIN_VERSION_PER_PROCESS_API_VERSION_COMBINED (user_data) =20 -#define CYGWIN_VERSION_CHECK_FOR_OLD_O_NONBLOCK \ - (CYGWIN_VERSION_USER_API_VERSION_COMBINED <=3D 28) - #define CYGWIN_VERSION_CHECK_FOR_USING_BIG_TYPES \ (CYGWIN_VERSION_USER_API_VERSION_COMBINED >=3D 79)