From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/14413 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: time_t progress/findings Date: Thu, 18 Jul 2019 12:37:45 -0400 Message-ID: <20190718163745.GT1506@brightrain.aerifal.cx> References: <20190718154132.GR1506@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="153666"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.5.21 (2010-09-15) To: musl@lists.openwall.com Original-X-From: musl-return-14429-gllmg-musl=m.gmane.org@lists.openwall.com Thu Jul 18 18:38:04 2019 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.89) (envelope-from ) id 1ho9Pu-000dnL-JI for gllmg-musl@m.gmane.org; Thu, 18 Jul 2019 18:38:02 +0200 Original-Received: (qmail 7927 invoked by uid 550); 18 Jul 2019 16:37:59 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 7877 invoked from network); 18 Jul 2019 16:37:58 -0000 Content-Disposition: inline In-Reply-To: <20190718154132.GR1506@brightrain.aerifal.cx> Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:14413 Archived-At: Second bit of progress here: stat. First change can be done before any actual time64 work is done or even decided upon: changing all the stat-family functions to use fstatat (possibly with AT_EMPTY_PATH) as their backend, and changing fstatat to do proper fallbacks if SYS_fstatat is missing. Now there's a single point of potential stat conversion rather than 4 functions. Next, add an internal, arch-provided kstat type and make fstatat translate from this to the public stat type. This eliminates the need for all the mips*/syscall_arch.h hacks. Third, add use of SYS_statx when it's available, and translate from it to the public stat type. Only fallback to SYS_fstatat if SYS_statx is missing. At this point we have the kernel giving us 64-bit timespecs for stat, even if we can't use them. The last step is just changing over the public types for 32-bit archs (we get to define struct stat entirely, since it's not filled in by the kernel at all anymore at this point). The best part of all this is that none of the steps until the last depend on choices of 64-bit time_t action to take, and all of them are beneficial changes even without 64-bit time_t. Final note: some attention may be needed to how O_PATH file descriptors are handled in the fallback code paths, since this is presently a delicate issue for fstat() due to old kernel bugs. I think modern fstatat+AT_EMPTY_PATH and statx+AT_EMPTY_PATH get it right though. Rich