From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=51.159.59.229 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796480791; b=EFmaqBnLBDqoCW6Pa7hcR7N5KY/ND9/Nz8tFeMkQJzcTPfB52DSLLSu7XU653vgfYWFw AEiROoPYbEnUYgg+bO0hpBpnI9y3FzVQd9DU0KKhJTK4nrYnVYib5dtB8pBDE9OfXVvDk 0Q1QYkBb+Mcs+0adrzOK1JTc/6ze30rIzUjzS48wk6pOxDKrWK2SpSwqccqzsTZzRF1OQ LggT96/fQgo28LLUamVUiB3aBxq+v69q1eJ8y5VRUhFkPKGYrXU4AHfWFQ7ixWcs1gjRo 4RdIlJ3On344BZVRfq9plh1OhblQfAkkbHBEMLPV5WZfJ3HezXLR6QFExrGxOTL+a7g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796480791; h=DMARC-Filter:DKIM-Signature:Received:Date:From:To:Cc:Subject: Message-ID:References:MIME-Version:Content-Type:Content-Disposition: Content-Transfer-Encoding:In-Reply-To; bh=kwc+HwzCrXLfBnuey6mW/Nod5//p0wd8KmXZWp/wxNk=; b=wydxentO7VOUumA19BHNmzo4UUAR74jMQ+/kPTxqrQ2PbAm+cv0YVTmx+Kxj9NpAF+8n 6IgSyZkQDj59/ltbiZ/71XmFpRnaCG9CEYxf0gMagRNFpM2YYPe2PenUmiukLoy9Jx6/7 O7CNkr85mSicfSfAPDlnRPaHLL62IPAu1K4gzxvqDsXPx1kpaOP4gpKDr0n69GUH3ABHC p0gP19CwTjpyHfMqqJUkSk2L63CwrOpLcyl3a75feui5St+HPQnEN2NoHJeOuaF2U/i/U OtDtDYE00juM3JrJmG5nxkyB3zfA5tQXbJV5VgZ6SI1+CZq+4dj+SUB7ABaPfwgbCCQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=1wt.eu; spf=pass smtp.mailfrom=1wt.eu; dkim=pass header.d=1wt.eu header.i=@1wt.eu header.a=rsa-sha256 header.s=mail header.b=nsfcGzUQ; arc=none smtp.remote-ip=51.159.59.229 Received: from mta1.formilux.org (mta1.formilux.org [51.159.59.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 82A5B606A333 for ; Sat, 5 Dec 2026 14:26:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 82A5B606A333 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=1wt.eu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=1wt.eu Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=1wt.eu header.i=@1wt.eu header.a=rsa-sha256 header.s=mail header.b=nsfcGzUQ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1wt.eu; s=mail; t=1796480789; bh=kwc+HwzCrXLfBnuey6mW/Nod5//p0wd8KmXZWp/wxNk=; h=From:Message-ID:From; b=nsfcGzUQr6o6yzlhLgbwM1C+ug8WtIAspwtZqrJRadjlMbPRu/v1elwEjK790340K TKv2CxcZ4X/jaU8NrLUkyMcW4ogvHOetv+6wEnRdNJ0t2kqYT6mi8fTUf1YSVH2zrC dr8k4PkHIELWablflTvfBw1UrA/9JZh/JMQw3ixU= Received: from 1wt.eu (ded1.1wt.eu [163.172.96.212]) by mta1.formilux.org (Postfix) with ESMTP id BEC92C000B; Sat, 05 Dec 2026 15:26:28 +0100 (CET) Date: Sat, 5 Dec 2026 15:26:28 +0100 From: Willy Tarreau To: Thomas =?iso-8859-1?Q?Wei=DFschuh?= Cc: linux-kernel@vger.kernel.org, Danish Khateeb Subject: Re: [PATCH v2 4/4] tools/nolibc: remove the open-coded fcntl() in dup2() Message-ID: References: <20261202-nolibc-fcntl-v2-0-651ff5781baa@weissschuh.net> <20261202-nolibc-fcntl-v2-4-651ff5781baa@weissschuh.net> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20261202-nolibc-fcntl-v2-4-651ff5781baa@weissschuh.net> On Wed, Dec 02, 2026 at 08:29:49AM +0100, Thomas Weißschuh wrote: > Now that nolibc has a proper fctnl() wrapper use that in the dup2() > implementation instead of the open-coded logic. > > Signed-off-by: Thomas Weißschuh Yeah much cleaner, thanks! Reviewed-by: Willy Tarreau Willy > --- > tools/include/nolibc/sys.h | 11 +++-------- > 1 file changed, 3 insertions(+), 8 deletions(-) > > diff --git a/tools/include/nolibc/sys.h b/tools/include/nolibc/sys.h > index b63fa6c618c5..5cd1c3ea9013 100644 > --- a/tools/include/nolibc/sys.h > +++ b/tools/include/nolibc/sys.h > @@ -29,6 +29,7 @@ > #include "stdarg.h" > #include "types.h" > > +static int _sys_fcntl(int fd, int cmd, unsigned long arg); > > /* Syscall return helper: takes the syscall value in argument and checks for an > * error in it. This may only be used with signed returns (int or long), but > @@ -262,16 +263,10 @@ static __attribute__((unused)) > int _sys_dup2(int old, int new) > { > #if defined(__NR_dup3) > - int ret, nr_fcntl; > - > -#ifdef __NR_fcntl64 > - nr_fcntl = __NR_fcntl64; > -#else > - nr_fcntl = __NR_fcntl; > -#endif > + int ret; > > if (old == new) { > - ret = __nolibc_syscall2(nr_fcntl, old, F_GETFD); > + ret = _sys_fcntl(old, F_GETFD, 0); > return ret < 0 ? ret : old; > } > > > -- > 2.56.1