Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oC07O-0002yo-NI for pgsql-hackers@arkaria.postgresql.org; Thu, 14 Jul 2022 14:47:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oC07N-0008WO-DI for pgsql-hackers@arkaria.postgresql.org; Thu, 14 Jul 2022 14:47:05 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oC07M-0008TJ-Hb for pgsql-hackers@lists.postgresql.org; Thu, 14 Jul 2022 14:47:05 +0000 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oC07J-0001nf-Oa for pgsql-hackers@lists.postgresql.org; Thu, 14 Jul 2022 14:47:03 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 597423200A12; Thu, 14 Jul 2022 10:46:57 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Thu, 14 Jul 2022 10:46:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1657810016; x=1657896416; bh=O eO2NAGrkqLETJ2XKyL4sdQVL38sBz1VirLU/ikmXb0=; b=U9IOwGwtEdtELwoNO O0scVuw7RqLEJ1Yu6vWxec8LgQDkPL6mQgqz9yFybtXgQ4MGyD1l8g+CRG6N+xap l2dH2yq8OT4XapXyAzIARHYAkx5CnAAxqczlATpEhbVe0irD0CxlndHaPv6c4xmG L4Glil/qjfO/TgPhajhMW32FnO6FV2QnSu9RRJAqMpI1kWpFnNU+O2NIXoCXk5fA BIQzAMij2AgqKe0zY9QL98gHM9GoJRRYCwQqZd5zrf0NPelkkEg8JqhjlkI41Yyb mhruD5LqUIe66igKUTQtM/jd6O5srNCn3MiHMj4umrmdmJiRds3DL0dYcYIiE2Bm ANltg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrudejledgkedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkgggtugfgjgesthekredttddtjeenucfhrhhomheptehlvhgr rhhoucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh eqnecuggftrfgrthhtvghrnhepvdektdffudfftdffffehfffhjeejhffgieeuueekjeek fffgudffhfduffffueevnecuffhomhgrihhnpegvnhhtvghrphhrihhsvggusgdrtghomh enucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhv hhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhg X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 14 Jul 2022 10:46:56 -0400 (EDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id E27CA36E; Thu, 14 Jul 2022 16:46:52 +0200 (CEST) Date: Thu, 14 Jul 2022 16:46:52 +0200 From: Alvaro Herrera To: Thomas Munro Cc: Andres Freund , Pg Hackers Subject: Re: EINTR in ftruncate() Message-ID: <20220714144652.jph7exiywushg4gc@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2022-Jul-15, Thomas Munro wrote: > I checked that this throw-away assertion doesn't fail currently: > > if (IsUnderPostmaster) > + { > + sigset_t old; > + sigprocmask(SIG_SETMASK, NULL, &old); > + Assert(memcmp(&old, &UnBlockSig, sizeof(UnBlockSig)) == 0); > PG_SETMASK(&BlockSig); > + } > > ... but now I'm wondering if we should be more defensive and possibly > even save/restore the mask. Yeah, that sounds better to me. > Originally I discounted that because I thought I had to go through > PG_SETMASK for portability reasons, but on closer inspection, I don't > see any reason not to use sigprocmask directly in Unix-only code. ISTM it would be cleaner to patch PG_SETMASK to have a second argument and to return the original mask if that's not NULL. This is more invasive, but there aren't that many callsites of that macro. -- Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/