From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H2 autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 18410 invoked from network); 19 Nov 2022 18:32:00 -0000 Received: from second.openwall.net (193.110.157.125) by inbox.vuxu.org with ESMTPUTF8; 19 Nov 2022 18:32:00 -0000 Received: (qmail 32183 invoked by uid 550); 19 Nov 2022 18:31:58 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 32145 invoked from network); 19 Nov 2022 18:31:57 -0000 Date: Sat, 19 Nov 2022 13:31:45 -0500 From: Rich Felker To: =?utf-8?B?572X5YuH5YiaKFlvbmdnYW5nIEx1byk=?= Cc: musl@lists.openwall.com, Jens Gustedt , Jason Ekstrand Message-ID: <20221119183145.GO29905@brightrain.aerifal.cx> References: <20220923162518.56284329@inria.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: [musl] C23 implications for C libraries On Sat, Nov 19, 2022 at 04:46:22AM +0800, 罗勇刚(Yonggang Luo) wrote: > There is a concept called CLOCK_MONOTONIC_RAW (since Linux 2.6.28; > Linux-specific), > May C2x provide TIME_MONOTONIC_RAW in future or can we just implement > TIME_MONOTONIC with > CLOCK_MONOTONIC_RAW on Linux? When implement mesa vulkan driver, it's ask > for CLOCK_MONOTONIC_RAW at > > https://gitlab.freedesktop.org/mesa/mesa/-/blob/c6c5949ff70a47c47795fe9161a7514173b5be24/src/vulkan/runtime/vk_device.c#L557 > > May intention is using C2x timespec_get to replace function > vk_clock_gettime but it's lack of TIME_MONOTONIC_RAW, so I don't know > what's the best way The code there is already doing exactly what it should do in the case where CLOCK_MONOTONIC_RAW is not defined so I'm not sure what you're trying to achieve. On a system where CLOCK_MONOTONIC_RAW is defined, the caller may have (for likely-nonsensical reasons) chosen to pass CLOCK_MONOTONIC_RAW, and they're handling the case where the kernel is too old to have that extension clock by substituting CLOCK_MONOTONIC instead. If CLOCK_MONOTONIC_RAW is not defined, then most certainly the caller did not pass it (since there's no such thing) and thus there is no need for any fallback code. No action is needed at all here. Rich