From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/14122 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: "zhaohang (F)" Newsgroups: gmane.linux.lib.musl.general Subject: src/thread/__timedwait.c: Clock type Date: Mon, 13 May 2019 01:36:15 +0000 Message-ID: <59FB1E003EF3A943BD6BAD197ABD4D6A272CE7@dggemi524-mbx.china.huawei.com> Reply-To: musl@lists.openwall.com Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="_000_59FB1E003EF3A943BD6BAD197ABD4D6A272CE7dggemi524mbxchina_" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="65277"; mail-complaints-to="usenet@blaine.gmane.org" To: "musl@lists.openwall.com" Original-X-From: musl-return-14138-gllmg-musl=m.gmane.org@lists.openwall.com Mon May 13 03:36:37 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 1hPztM-000Gpa-HU for gllmg-musl@m.gmane.org; Mon, 13 May 2019 03:36:36 +0200 Original-Received: (qmail 3926 invoked by uid 550); 13 May 2019 01:36:33 -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 3889 invoked from network); 13 May 2019 01:36:32 -0000 Thread-Topic: src/thread/__timedwait.c: Clock type Thread-Index: AdUJKx4qsZxAH9JsTq2kcHRkXxueUg== Accept-Language: en-US Content-Language: zh-CN x-originating-ip: [10.177.224.64] X-CFilter-Loop: Reflected Xref: news.gmane.org gmane.linux.lib.musl.general:14122 Archived-At: --_000_59FB1E003EF3A943BD6BAD197ABD4D6A272CE7dggemi524mbxchina_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable In the function _timedwait_cp, 'clk' indicates the type of clock used, CLOC= K_REALTIME or CLOCK_MONOTONIC. when we call __syscall_cp in this function, the fifth parameter 'top' is ca= lculated based on the clock type. However, the third parameter is not set according to the clock type. CLOCK_= MONOTONIC is used by default. Is this a bug? Or other considerations? Thanks, Zhao Hang --_000_59FB1E003EF3A943BD6BAD197ABD4D6A272CE7dggemi524mbxchina_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

In the function _timedwait_cp, ‘clk’ indicates the type of clock used, CLOCK_REALTIME o= r CLOCK_MONOTONIC.

 

when we call __syscall_cp in th= is function, the fifth parameter ‘top’ is calculated based on t= he clock type.

 

However, the third parameter is= not set according to the clock type. CLOCK_MONOTONIC is used by default.

 

Is this a bug? Or other conside= rations?

 

Thanks,

 

Zhao Hang

--_000_59FB1E003EF3A943BD6BAD197ABD4D6A272CE7dggemi524mbxchina_-- From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/14123 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: src/thread/__timedwait.c: Clock type Date: Mon, 13 May 2019 08:41:24 -0400 Message-ID: <20190513124124.GQ23599@brightrain.aerifal.cx> References: <59FB1E003EF3A943BD6BAD197ABD4D6A272CE7@dggemi524-mbx.china.huawei.com> 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="98227"; 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-14139-gllmg-musl=m.gmane.org@lists.openwall.com Mon May 13 14:41:40 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 1hQAGy-000PPh-Bs for gllmg-musl@m.gmane.org; Mon, 13 May 2019 14:41:40 +0200 Original-Received: (qmail 15555 invoked by uid 550); 13 May 2019 12:41:37 -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 15533 invoked from network); 13 May 2019 12:41:37 -0000 Content-Disposition: inline In-Reply-To: <59FB1E003EF3A943BD6BAD197ABD4D6A272CE7@dggemi524-mbx.china.huawei.com> Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:14123 Archived-At: On Mon, May 13, 2019 at 01:36:15AM +0000, zhaohang (F) wrote: > In the function _timedwait_cp, 'clk' indicates the type of clock used, CLOCK_REALTIME or CLOCK_MONOTONIC. > > when we call __syscall_cp in this function, the fifth parameter 'top' is calculated based on the clock type. > > However, the third parameter is not set according to the clock type. CLOCK_MONOTONIC is used by default. > > Is this a bug? Or other considerations? The timeout argument to the FUTEX_WAIT operation is always relative, and does not support choosing a clock. To support the more exotic clocks (e.g. cputime for a given thread) it would need explicit support here, but for just realtime and monotonic, it suffices to compute the relative sleep based on the argument and the current time in the given clock. The behavior is of course different under non-continuous changes to the clock. This is a fundamental limitation of the FUTEX_WAIT operation; using the FUTEX_WAIT_BITSET operation if available would avoid this, but seems less likely to be able to support arbitrary other clocks in the future, and the behavior distinction only appears when you do something fundamentally broken (setting the clock wrong) and half the time it's worse rather than better... Rich From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/14128 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: "zhaohang (F)" Newsgroups: gmane.linux.lib.musl.general Subject: =?gb2312?B?tPC4tDogW211c2xdIHNyYy90aHJlYWQvX190aW1lZHdhaXQuYzogQ2xvY2sg?= =?gb2312?Q?type?= Date: Wed, 15 May 2019 12:27:22 +0000 Message-ID: <59FB1E003EF3A943BD6BAD197ABD4D6A272F65@dggemi524-mbx.china.huawei.com> References: <59FB1E003EF3A943BD6BAD197ABD4D6A272CE7@dggemi524-mbx.china.huawei.com> <20190513124124.GQ23599@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com Mime-Version: 1.0 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: base64 Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="106448"; mail-complaints-to="usenet@blaine.gmane.org" To: "musl@lists.openwall.com" Original-X-From: musl-return-14144-gllmg-musl=m.gmane.org@lists.openwall.com Wed May 15 14:27:42 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 1hQt0Y-000Rbi-Cp for gllmg-musl@m.gmane.org; Wed, 15 May 2019 14:27:42 +0200 Original-Received: (qmail 1261 invoked by uid 550); 15 May 2019 12:27:39 -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 1224 invoked from network); 15 May 2019 12:27:37 -0000 Thread-Topic: [musl] src/thread/__timedwait.c: Clock type Thread-Index: AdUJKx4qsZxAH9JsTq2kcHRkXxueUgAGwBAAAHTOudA= In-Reply-To: <20190513124124.GQ23599@brightrain.aerifal.cx> Accept-Language: en-US Content-Language: zh-CN x-originating-ip: [10.177.224.64] X-CFilter-Loop: Reflected Xref: news.gmane.org gmane.linux.lib.musl.general:14128 Archived-At: VGhhbmsgeW91IFJpY2ggZm9yIHRoZSBhbmFseXNpcy4NCg0KQmVzdHMsDQpaaGFvIEhhbmcNCg0K LS0tLS3Tyrz+1K28/i0tLS0tDQq3orz+yMs6IFJpY2ggRmVsa2VyIFttYWlsdG86ZGFsaWFzQGFl cmlmYWwuY3hdILT6se0gUmljaCBGZWxrZXINCreiy83KsbzkOiAyMDE5xOo11MIxM8jVIDIwOjQx DQrK1bz+yMs6IG11c2xAbGlzdHMub3BlbndhbGwuY29tDQrW98ziOi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