From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id LA//HrGLyGDEZAAAWB0awg (envelope-from ) for ; Tue, 15 Jun 2021 07:14:57 -0400 Received: by simark.ca (Postfix, from userid 112) id 698EB1F163; Tue, 15 Jun 2021 07:14:56 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 9F2ED1E813 for ; Tue, 15 Jun 2021 07:14:52 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0B374396E83E for ; Tue, 15 Jun 2021 11:14:52 +0000 (GMT) Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) by sourceware.org (Postfix) with ESMTPS id 0960B384000D for ; Tue, 15 Jun 2021 11:14:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0960B384000D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f48.google.com with SMTP id t4-20020a1c77040000b029019d22d84ebdso1481467wmi.3 for ; Tue, 15 Jun 2021 04:14:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=veJvXe7KI4Ayby6nk+yGbY1vM2U/M2O8NZeKLS9KLTk=; b=ELOXmCoE+WeQJ4lM5/rOy6CtT4Es/m5jts3pp8PkoHTNGAE/oLqF/ZfGaDnlrsxiDb UqtNE5LK4uC6ZlTZ8kRb63S2YFBVPYVcJFuD75dtzVlZeSir1AeqkmJZaFXeEKJxQo0I 4mXRFMm9/zbzKDaVqYaWQHHOu71DHvYcnsjQS7mR+9TtA3paNJnlUYFpzurp+zYuVLJ9 zB/92b7QaCedJ57eaQXOLMJg7p/8n1x2y6238qyQF7CCdJ4CVK841/PqIjrt2ImiB5mU IpG7TXUxxJoMlWIdciDAMEq0GZLZQumQ+1mqnYAnzXDWxdRlZjAXv1sfdbOzcumB/GKH FK4A== X-Gm-Message-State: AOAM532P/DDE/pgnOjIDhyNu+P2P5wuWKPEs9rRQbRgHQhkkXl2/+n1t 4sA7pIv8jl7JTPDbWeYAnkMj+c0UwEYxkA== X-Google-Smtp-Source: ABdhPJyK2QNLQh4slpfisDtwuiZnDG8W66eaEfyT4qWlY1+5ZHGySIuuqEiZh1kehUAsMuhzx2cDpw== X-Received: by 2002:a05:600c:4fc5:: with SMTP id o5mr22339720wmq.148.1623755671508; Tue, 15 Jun 2021 04:14:31 -0700 (PDT) Received: from localhost ([2001:8a0:f932:6a00:6b6e:c7b6:c5a7:aac3]) by smtp.gmail.com with ESMTPSA id j1sm15583221wmi.44.2021.06.15.04.14.30 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 15 Jun 2021 04:14:30 -0700 (PDT) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 0/4] Introduce scoped_ignore_signal & make it thread safe Date: Tue, 15 Jun 2021 12:14:25 +0100 Message-Id: <20210615111429.1879286-1-pedro@palves.net> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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: , Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" For the Ctrl-C rework series I posted recently, I stared at code using scoped_ignore_sigttou a lot, and it annoyed me that it isn't thread safe, because it changes the signal's disposition. Very recently, we got a new scoped_ignore_sigpipe class modelled on scoped_ignore_sigttou, which made me want to fix this before it ever becomes a (hard to debug) problem. I mentioned this here: https://sourceware.org/pipermail/gdb-patches/2021-June/179958.html This series then: - Moves scoped_ignore_sigttou to gdbsupport/. This patch is actually included in my Ctrl-C series too, I just borrowed it from there. - Introduces a scoped_ignore_signal template, to be used by both scoped_ignore_sigpipe and scoped_ignore_sigttou. - Makes scoped_ignore_signal thread-safe, by using sigprocmask + sigtimedwait. - Adds a scoped_ignore_sigpipe unit test. You can also find this in the users/palves/scoped_ignore_signal branch. Pedro Alves (4): Move scoped_ignore_sigttou to gdbsupport/ Introduce scoped_restore_signal scoped_ignore_signal: Use sigprocmask+sigtimedwait instead of signal Add a unit test for scoped_ignore_sigpipe gdb/Makefile.in | 2 +- gdb/compile/compile.c | 29 +--- gdb/inf-ptrace.c | 1 - gdb/inflow.c | 2 +- gdb/procfs.c | 1 - gdb/ser-unix.c | 2 +- .../scoped_ignore_signal-selftests.c | 125 ++++++++++++++++++ gdbsupport/scoped_ignore_signal.h | 97 ++++++++++++++ .../scoped_ignore_sigttou.h | 56 +++++--- 9 files changed, 266 insertions(+), 49 deletions(-) create mode 100644 gdb/unittests/scoped_ignore_signal-selftests.c create mode 100644 gdbsupport/scoped_ignore_signal.h rename gdb/inflow.h => gdbsupport/scoped_ignore_sigttou.h (51%) base-commit: c8795e1f2f4d8617f22c3bd40dad75c75482e164 -- 2.26.2