From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) by sourceware.org (Postfix) with ESMTPS id C3CCE3959E4C for ; Wed, 2 Sep 2020 18:00:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C3CCE3959E4C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gmx.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=n54@gmx.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1599069609; bh=ESyUQwa9Xnm17sNHAFmFcvvtscBPiwUnu8jPnGJbC5g=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=PNPrE9SJi190xqgc/C4DVSXbgdfxRnAMKRqIUddOvrwYH6aLfT2MqXk41OZhP2JI4 VQL9aY/d4NehLRsdwCZlQpkVrf5PZ8BT4DOeAQ2vZdyWNi06KLtxhlxJ8GYDdphnlX 0MYi9p6r8pRx3h3rTD8nBIxRI88AsBgnGcFTug5s= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.localdomain ([89.79.191.25]) by mail.gmx.com (mrgmx104 [212.227.17.174]) with ESMTPSA (Nemesis) id 1MN5if-1juU6H3SOT-00IzEc; Wed, 02 Sep 2020 20:00:09 +0200 From: Kamil Rytarowski To: gdb-patches@sourceware.org Subject: [PATCH 01/10] Add handle_eintr to wrap EINTR handling in syscalls Date: Wed, 2 Sep 2020 19:59:17 +0200 Message-Id: <20200902175926.13182-2-n54@gmx.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200902175926.13182-1-n54@gmx.com> References: <20200902175926.13182-1-n54@gmx.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:vc+ugI+LWwyAxOtMtl5X5xXLqMdF7LQXT+Vbb4uJoxwFDww6xTa pywFRo2/bsR6MAddJ8nldxrCrN9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gpOal8JUS1F RUpAlL06nBRnD1DsCgdvIyxCUIxBRveAbBPx71OJM6lBYYvwQudk1Gmmj5opE4Xy0Bs/EZDrV /NN69+34PIV2/o5uzzs4ppNFGx1gaYAYppGvy7d1kbz7IiRl6R7HRexqnePb4Bpk9FCc5eiVB RQT6nsYXuPbSu9EW0s3iV1uY0cUJsmloxcw9ne88Tvb/0R/j1tOJaFiMBiZCZl1kNzec7TATl L7qKwxjl4HOEPTkAOmQFPgGYUX+OYLtEQtGFvQmy9iUGMEFcJtAJxEGLBbQxawxPiJ2GEDzk/ CusgF7FsPh/g8A/xvwZfMgS5eZNQpMAk8l2eEr9Q3q+t+K4tIEPRbqp4NB1s+vWFBkgXpQVtB 1xvvkdK7mBD7FYseE X-Spam-Status: No, score=-18.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, GIT_PATCH_0, KAM_SHORT, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Sep 2020 18:00:13 -0000 gdbsupport/ChangeLog: * eintr.h: Add handle_eintr. =2D-- gdbsupport/ChangeLog | 4 ++++ gdbsupport/eintr.h | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 gdbsupport/eintr.h diff --git a/gdbsupport/ChangeLog b/gdbsupport/ChangeLog index a1960537384..7a429367941 100644 =2D-- a/gdbsupport/ChangeLog +++ b/gdbsupport/ChangeLog @@ -1,3 +1,7 @@ +2020-03-17 Kamil Rytarowski + + * eintr.h: Add handle_eintr. + 2020-08-13 Simon Marchi * selftest.h (run_tests): Change parameter to array_view. diff --git a/gdbsupport/eintr.h b/gdbsupport/eintr.h new file mode 100644 index 00000000000..cb35d2ffc3d =2D-- /dev/null +++ b/gdbsupport/eintr.h @@ -0,0 +1,41 @@ +/* Utility for handling interrupted syscalls by signals. + + Copyright (C) 2020 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . = */ + +#ifndef GDBSUPPORT_EINTR_H +#define GDBSUPPORT_EINTR_H + +#include + +namespace gdb +{ +template +inline decltype (auto) handle_eintr (const Fun &F, const Args &... A) +{ + decltype (F (A...)) ret; + do + { + errno =3D 0; + ret =3D F (A...); + } + while (ret =3D=3D -1 && errno =3D=3D EINTR); + return ret; +} +} + +#endif /* GDBSUPPORT_EINTR_H */ =2D- 2.28.0