From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from rock.gnat.com (rock.gnat.com [IPv6:2620:20:4000:0:a9e:1ff:fe9b:1d1]) by sourceware.org (Postfix) with ESMTP id 907A03857C74 for ; Wed, 16 Sep 2020 16:08:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 907A03857C74 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey@adacore.com Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 6F64F117714; Wed, 16 Sep 2020 12:08:30 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at gnat.com Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id e9wGeX5+2HBo; Wed, 16 Sep 2020 12:08:30 -0400 (EDT) Received: from murgatroyd (75-166-96-88.hlrn.qwest.net [75.166.96.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by rock.gnat.com (Postfix) with ESMTPSA id 1EA79117170; Wed, 16 Sep 2020 12:08:30 -0400 (EDT) From: Tom Tromey To: Kamil Rytarowski Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 10/10] Add minimal and functional NetBSD/amd64 gdbserver References: <20200902175926.13182-1-n54@gmx.com> <20200902175926.13182-11-n54@gmx.com> X-Attribution: Tom Date: Wed, 16 Sep 2020 10:08:29 -0600 In-Reply-To: <20200902175926.13182-11-n54@gmx.com> (Kamil Rytarowski's message of "Wed, 2 Sep 2020 19:59:26 +0200") Message-ID: <874knxaema.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, 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, 16 Sep 2020 16:08:31 -0000 >>>>> "Kamil" == Kamil Rytarowski writes: While switching the target wait flags to be a flag enum type, I found a small problem in the new NetBSD gdbserver work. Kamil> +/* Implement a safe wrapper around waitpid(). */ Kamil> + Kamil> +static pid_t Kamil> +netbsd_waitpid (ptid_t ptid, struct target_waitstatus *ourstatus, int options) Here options is either 0 or: #define TARGET_WNOHANG 1 Kamil> +{ Kamil> + int status; Kamil> + Kamil> + pid_t pid = gdb::handle_eintr (::waitpid, ptid.pid (), &status, options); ... but it is passed directly to ::waitpid. This is fine for now if the system WNOHANG happens to be 1. However, I think it would be better not to rely on this. For one thing, there's no guarantee that the value of TARGET_WNOHANG will never change. Kamil> + pid_t pid = netbsd_waitpid (ptid, ourstatus, target_options); Here's a spot making the call; this shows that the target option is being passed untranslated. thanks, Tom