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=1796480746; b=sZrdRC9Ue8GU8ZNiTWx1qcC8ARBaTUv1vt/PdXwjLEEYrzAFf9w+IS4BGOr9O3KGnVII G8dl7SMioOkWG5DOsNiL3wuTPGFAcDz+5xICCvKeBYPCxoJZuTKmNQx+XV+SkfG+s+v/l nl+VEdscHB0Tulhs7wzcCUo4gpj9nWVChdGYWE1//84Ldt8aV/Tv+feMlAkfOJ1llk4wS 0yC7w8pIq24SqhRhqx0LF1dSffBKu6IF8Uqw7ejykWLhqfrz/jpAqMi9PesPxG4MWTDXV AZ0Zxrw1qzaIIgDGq6uGwPQyOdxjKPBgl3TaqQGYqknY8PEYD8/AdwO8OZoN4hiFzZg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796480746; 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=P4MnDHkja970bhPLcR7iNNbseqGr48kjQ0GOb7z/PrU=; b=ZApgZ9rMT5AXi1akjkiGOGuUUza39x8tE0aU/nr9pPhOP7wSDKJ8ar6fHiLB+W6p9IQS 7Nq93YkPN5LbLjwnTrFd5gLQVZwWYm585+UUvEpV3IhiREuXaK5pLCIgs78HHVRQqjlqr LXVNgw5uwyBiBBIbMmegy6XnyZWARY+XnTK9WNZ75CC3qugI6XfDJnm+qpDRYW23PwAOg fOqa7oAFxkrUsx3801PHsRlm6lr50X30N3tse1p0cjdLzI593QYNEv+kZkQFvkQI7z/mA HXtjzEooKvaolzL78A5OWtbtIFUWru4kaJXc2HlAtFzkch/d4V/H5G0Ne3sshaPEgDg== 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=pJmTBTJs; 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) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1B0FA606A334 for ; Sat, 5 Dec 2026 14:25:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 1B0FA606A334 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, unprotected) header.d=1wt.eu header.i=@1wt.eu header.a=rsa-sha256 header.s=mail header.b=pJmTBTJs DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1wt.eu; s=mail; t=1796480736; bh=P4MnDHkja970bhPLcR7iNNbseqGr48kjQ0GOb7z/PrU=; h=From:Message-ID:From; b=pJmTBTJsENcXiCbi60MR80fzjp3pL7uFAFOrwz1S+LBLjFLcET2PTbq+Jl9Suo7tp VX6wBtQhjQtmkki9w2bH4alnaTQzAfxP/2febHzKBQ+52oKyfNvdVkOXILfxrgjOuq uZlrF7EmLdAPAucOmXF8YCbvWPl7PyABCYXGthAM= Received: from 1wt.eu (ded1.1wt.eu [163.172.96.212]) by mta1.formilux.org (Postfix) with ESMTP id 79A02C000B; Sat, 05 Dec 2026 15:25:36 +0100 (CET) Date: Sat, 5 Dec 2026 15:25:36 +0100 From: Willy Tarreau To: Thomas =?iso-8859-1?Q?Wei=DFschuh?= Cc: linux-kernel@vger.kernel.org, Danish Khateeb Subject: Re: [PATCH v2 3/4] tools/nolibc: add support for fcntl() Message-ID: References: <20261202-nolibc-fcntl-v2-0-651ff5781baa@weissschuh.net> <20261202-nolibc-fcntl-v2-3-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-3-651ff5781baa@weissschuh.net> Hi Thomas! On Wed, Dec 02, 2026 at 08:29:48AM +0100, Thomas Weißschuh wrote: > Add the fcntl() function. > > Special handling is necessary for 'struct flock'. > The definition from the UAPI headers is not large-file capable. > Provide a custom definition which is compatible with 'struct flock64' > on 32-bit systems and 'struct flock' on 64-bit ones. > > Signed-off-by: Thomas Weißschuh (...) > --- a/tools/include/nolibc/types.h > +++ b/tools/include/nolibc/types.h > @@ -32,6 +32,21 @@ struct timeval { > #include > #undef timeval > > +struct flock { > + short l_type; > + short l_whence; > + __kernel_loff_t l_start; > + __kernel_loff_t l_len; > + __kernel_pid_t l_pid; > +#if defined(__sparc__) > + short __pad; > +#endif > +}; The commit message makes no mention of this pad and nothing here explains why it is necessary nor if other architectures might need it in the future. I suspect it might be that __kernel_pid_t would be 16-bit there, but I really don't know. I think a comment here in front of__pad to say why/when it's needed would help. Also I must confess I'm a bit confused because the same patch seems to mix fcntl() and flock(), and even _sys_fcntl() relies on flock definition. There might be a trick there but again it's not explained and the commit message only says that special handling is required for struct flock, which makes one wonder if this is a single feature or two distinct features with one depending on the other. My impression is that this is mostly flock-centric and that it required to fix fcntl() first. If that is the case, I think that the fcntl() call should first do just that with a test on its own that for example does GETFD/SETFD or GETFL/SETFL, and another one specific to advisory locking because even the test_fcntl() function actually essentially tests locking from what I can see. This would also clarify small builds that drop CONFIG_FILE_LOCKING but which still have a properly working fcntl() implementation (which is already not trivial to get right especially in compat mode from what I seem to remember). Thanks, Willy