Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4461225pxj; Wed, 12 May 2021 06:15:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxU9qpFB5WAwR7mN9HlIFE+6RX9wy/0wZVQvUI2eEH0P/e9KxsoXsPiuSatbgD9WVMmt6gX X-Received: by 2002:a17:906:7842:: with SMTP id p2mr36857634ejm.487.1620825334767; Wed, 12 May 2021 06:15:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620825334; cv=none; d=google.com; s=arc-20160816; b=gv4ePImb+2l/4M0xZDLmwqH0rI9afRErPdx/DBLP4lfn+W4LGmXXFP1gcIQ01RJGyc NR1Ge+wjB/qlpxn4IEOu+wGPTV3ZP77AFLQi/k+BPHWJXtvGFu3RdCDaLIzhR3GA0Fuz hH7jPQnPoDlboCBTkmy44Bnuwaev0YsN4R0Hgh+TBTpyns+MrcnObQ1OQZZxKmXcjMTq LkQFxoUZkCiUeH549ondtFyDHF8TIhPEXElctJbJCfkAJRMadyFftbygxX9PSRZRWQ7v P25ESSZC7glYhJZS59O4baKjXLF7PDL25oxf+TVqSp2it6I3eOYzY/tXI0bWia7d36rD vMXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=DLK8GTZ2Y/tW4uy8r/pjnBAbwCk6xs5fdZFOKl1eLPU=; b=uGTOFMEbR7OTHY3bJrHveI5KN/D+oKPblHHxZN3JuVYbgogm7RBn7TihkDNxrFzu6C MTk9ovVK5tv1NrQXMtfDjAM07IWSPr7gMYJN9MVk3/IVstR4l6+FVsO91MLrGNbN3Bft Rdedy8mSHbHxl1fuCQVXY8bplCzGmGL4f61PaE8ni7Tyc17gsf+UIZFwZ7VrSpOYxU3R jfWh9va0kSy/O0u+ve3TXrsFbtf//tuJZPYb6fp9nKK0HMqiFjR8d4ZQ9UYc2g2q0xxO Cesmc2hRnjm3W1JzfrBTAEnoC+KzwrONawqen32HR3tRnEqaB7xTp3QSpoO+9jXNoswB 8a9A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id op26si24498452ejb.603.2021.05.12.06.15.11; Wed, 12 May 2021 06:15:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230301AbhELMvP (ORCPT + 99 others); Wed, 12 May 2021 08:51:15 -0400 Received: from wtarreau.pck.nerim.net ([62.212.114.60]:52986 "EHLO 1wt.eu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230037AbhELMvN (ORCPT ); Wed, 12 May 2021 08:51:13 -0400 Received: (from willy@localhost) by pcw.home.local (8.15.2/8.15.2/Submit) id 14CCo0vc021169; Wed, 12 May 2021 14:50:00 +0200 Date: Wed, 12 May 2021 14:50:00 +0200 From: Willy Tarreau To: Mark Brown Cc: linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] tools/nolibc: Implement msleep() Message-ID: <20210512125000.GB20883@1wt.eu> References: <20210512114728.19015-1-broonie@kernel.org> <20210512115949.GA20883@1wt.eu> <20210512121858.GA6343@sirena.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210512121858.GA6343@sirena.org.uk> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 12, 2021 at 01:18:58PM +0100, Mark Brown wrote: > On Wed, May 12, 2021 at 01:59:49PM +0200, Willy Tarreau wrote: > > On Wed, May 12, 2021 at 12:47:28PM +0100, Mark Brown wrote: > > > > - Return the number of seconds remaining if the delay does not > > > complete. > > > But why returning the number of seconds instead of milliseconds ? > > The common use case is this: > > > delay = delay_before_next_event(); > > while ((ret = msleep(delay)) > 0) > > delay -= ret; > > It seemed to be what you were asking for and I didn't have strong enough > opinions for it to be worth pushing back. Sorry if I wasn't clear then, but I proposed this example which should return the number of ms left: if (sys_select(0, 0, 0, 0, &my_timeval) < 0) return my_timeval.tv_sec * 1000 + (my_timeval.tv_usec + 999) / 1000; else return 0; In any case all of this is not critical but I'm fairly convinced that your addition is useful, especially if done like this, which is why I was asking. Willy