From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0D6A035E93B for ; Thu, 14 May 2026 12:40:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778762454; cv=none; b=SfDdYEesb3VheCVkbrPs3TDp606XwjLUDblku+SUJAvXk9LDG3GFOSEO+aPvsXlwETRz9hUVmYIeQpXHqu3MuEFDWMW2FNEHHpbPjNqexxkeMDHtLaCjZGlaLFki0BkVjC/PXDRygrWhuIvrwJtFfIxojx8swLrXWSTLHhD4eRM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778762454; c=relaxed/simple; bh=EVLCcpk929z6qFMkyJI7OFs3cpTM4HTVYIstcqVT3bs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Voo3VHi59mrYeGdgW2eZjuT6/0gUaQKjxdqhOZS/D8q9+XfNQcmgYi0HPo/6ReQxuD97fw0aHAc/w+rW2hde8wq/CFLvtNGvzxZqLvQqnZELoJRdo7Pu55hA+0CCuCaaCFyZG/NM1jP5QgSXHFMHBv2vEaNrZgUrG0YC3SiDALM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=mSgVNwUf; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="mSgVNwUf" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1778762450; bh=EVLCcpk929z6qFMkyJI7OFs3cpTM4HTVYIstcqVT3bs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=mSgVNwUfLRLZjHQ6r3eQVbM3AH89uKJRe3za4aaPdrJXlDoOz0ZhGUF8U2YZD4BtI 6y64LPKXdFQ6NP5VWVxz603kuEMaRrqPnataDqSfSLHEIx4x6ydN7LN465lEYc2QiH NtRne3+pzCbCNbONbICwz68aAQH9WIFqjpErDiV8= Date: Thu, 14 May 2026 14:40:50 +0200 From: Thomas =?utf-8?Q?Wei=C3=9Fschuh?= To: Daniel Palmer Cc: w@1wt.eu, david.laight.linux@gmail.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 2/3] tools/nolibc: Add statfs() Message-ID: <17ef96e0-2cc3-4076-907d-7a8536c92dcb@t-8ch.de> References: <20260507090353.356764-1-daniel@thingy.jp> <20260507090353.356764-3-daniel@thingy.jp> <7afa6d33-1673-4766-b939-301597e675ed@t-8ch.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On 2026-05-14 21:28:19+0900, Daniel Palmer wrote: > On Thu, 14 May 2026 at 20:42, Thomas Weißschuh wrote: > > > +/* Some preprocessor hackery to get struct statfs to > > > + * always be the 64bit one. > > > + */ > > > +#define statfs __nolibc_kernel_statfs > > > +#define statfs64 __nolibc_kernel_statfs64 > > > +#include > > > +#undef statfs > > > +#undef statfs64 > > > + > > > +#ifdef __NR_statfs64 > > > +#define statfs __nolibc_kernel_statfs64 > > > +#else > > > +#define statfs __nolibc_kernel_statfs > > > +#endif > > > > This #define can wreak havoc in user code. > > While it would be nice to have statfs() in nolibc, > > I don't see a proper way to work with the current UAPI header. > > Can we do without statfs() for now? > > I thought maybe we could look at /proc/mounts but it seems like if > tmpfs is actually ramfs (CONFIG_SHMEM=n) it still shows tmpfs as the > filesystem type. > So we'd be back to square one. Maybe look for tmpfs in /proc/mounts > then try something that ramfs doesn't support like creating a tmp file > and fallocate() on it to see if it's ramfs? Why not check for EOPNOTSUPP from fallocate() and skip the test in that case? This would also allow the test to run on a regular filesystem on /tmp which does support fallocate(). Thomas