From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) by sourceware.org (Postfix) with ESMTPS id 9EA133857C74 for ; Fri, 4 Sep 2020 00:30:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 9EA133857C74 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=1599179386; bh=jykMTX9CM9i/3QnMMO8+AmQ07V+s9rIlTZHoyMQFjXg=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=JU+pFCYoqzZ6LBMc8mufZQ6V/qK0bVj2x5X1Ydx5LHw5Ry8jdN95Ma30mmhQBbsFm sZtKuLz2LgzCTOHPuALjnjsF88IyjiUst+PkTBwOB/FhIrNsS9B5ATNqHNNoWCCzfg 8dNSqs0uVlbflhKzRkRqsLxuEL+TOO4btkU0xDpQ= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.localdomain ([89.79.191.25]) by mail.gmx.com (mrgmx005 [212.227.17.184]) with ESMTPSA (Nemesis) id 1MLiCo-1jwSj3490y-00He1x; Fri, 04 Sep 2020 02:29:46 +0200 From: Kamil Rytarowski To: gdb-patches@sourceware.org Cc: tom@tromey.com, tankut.baris.aktemur@intel.com, Kamil Rytarowski Subject: [PATCH v2 01/10] Add handle_eintr to wrap EINTR handling in syscalls Date: Fri, 4 Sep 2020 02:28:56 +0200 Message-Id: <20200904002905.13616-2-n54@gmx.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200904002905.13616-1-n54@gmx.com> References: <20200904002905.13616-1-n54@gmx.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:89ch9qVJZ3dsNxZOZnZ3AJZBsP+ulKLNx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FSOQpkBCBbJDKqzId7wxnnzTlnJo162x7oRc2RQdU/JxUd748TOq1LXVq S+/eJZ/bZpOiFSp1lFrSge3NmNAb+coL2I1tkqbV/2p5OwlBczKwep81bK8Qzoc/mXGbjGQR9 Z8n6rOHfqcQw8HLEZlgqzaNCotK1Xi3RQmSpLjWzrsKhE43spGSsD5CMUK9SPKeA4fSDjysei iHSqZ5BTlfjOVoGD8gaqf8SImrjayTpwxnFkPRQSn0muphNDsd3qqh+QW9lsDCMKvawMBTklp Z3gO0cqjPseDKDo+5cALjRwEGPJGAngzLYVnURyDvIZz7U0ujtsrI9Q26Msdpb1zZohgLzw5E +Xrhf1QW1GR7Xv1q2PFPVw6Y571QCypo0gXpqgT6Gk5y9F0pE70T1j1w6HX6b3xy9aUq8xEOt Rv+4vlcfJ1aDoA3SL X-Spam-Status: No, score=-17.5 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: Fri, 04 Sep 2020 00:30:06 -0000 gdbsupport/ChangeLog: * eintr.h: New file. =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..d26000e36ac 100644 =2D-- a/gdbsupport/ChangeLog +++ b/gdbsupport/ChangeLog @@ -1,3 +1,7 @@ +2020-09-04 Kamil Rytarowski + + * eintr.h: New file. + 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..74b7038da60 =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 Ret handle_eintr (const Ret &R, const Fun &F, const Args &... A) +{ + Ret ret; + do + { + errno =3D 0; + ret =3D F (A...); + } + while (ret =3D=3D R && errno =3D=3D EINTR); + return ret; +} +} + +#endif /* GDBSUPPORT_EINTR_H */ =2D- 2.28.0