LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH nolibc 0/2] nolibc commits for v5.15
@ 2021-07-21 20:36 Paul E. McKenney
  2021-07-21 20:36 ` [PATCH nolibc 1/2] tools: include: nolibc: Fix a typo occured to occurred in the file nolibc.h Paul E. McKenney
  2021-07-21 20:36 ` [PATCH nolibc 2/2] tools/nolibc: Implement msleep() Paul E. McKenney
  0 siblings, 2 replies; 3+ messages in thread
From: Paul E. McKenney @ 2021-07-21 20:36 UTC (permalink / raw)
  To: rcu
  Cc: linux-kernel, kernel-team, mingo, jiangshanlai, akpm,
	mathieu.desnoyers, josh, tglx, peterz, rostedt, dhowells,
	edumazet, fweisbec, oleg, joel

Hello!

This series contains nolibc updates:

1.	include: nolibc: Fix a typo occured to occurred in the file
	nolibc.h, courtesy of Bhaskar Chowdhury.

2.	Implement msleep(), courtesy of Mark Brown.

						Thanx, Paul

------------------------------------------------------------------------

 b/tools/include/nolibc/nolibc.h |    2 +-
 tools/include/nolibc/nolibc.h   |   13 +++++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH nolibc 1/2] tools: include: nolibc: Fix a typo occured to occurred in the file nolibc.h
  2021-07-21 20:36 [PATCH nolibc 0/2] nolibc commits for v5.15 Paul E. McKenney
@ 2021-07-21 20:36 ` Paul E. McKenney
  2021-07-21 20:36 ` [PATCH nolibc 2/2] tools/nolibc: Implement msleep() Paul E. McKenney
  1 sibling, 0 replies; 3+ messages in thread
From: Paul E. McKenney @ 2021-07-21 20:36 UTC (permalink / raw)
  To: rcu
  Cc: linux-kernel, kernel-team, mingo, jiangshanlai, akpm,
	mathieu.desnoyers, josh, tglx, peterz, rostedt, dhowells,
	edumazet, fweisbec, oleg, joel, Bhaskar Chowdhury, Randy Dunlap,
	Willy Tarreau, Paul E . McKenney

From: Bhaskar Chowdhury <unixbhaskar@gmail.com>

s/occured/occurred/

Signed-off-by: Bhaskar Chowdhury <unixbhaskar@gmail.com>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
 tools/include/nolibc/nolibc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/include/nolibc/nolibc.h b/tools/include/nolibc/nolibc.h
index 8b7a9830dd221..13c194aeaf3f0 100644
--- a/tools/include/nolibc/nolibc.h
+++ b/tools/include/nolibc/nolibc.h
@@ -1031,7 +1031,7 @@ struct sys_stat_struct {
  *     scall32-o32.S in the kernel sources.
  *   - the system call is performed by calling "syscall"
  *   - syscall return comes in v0, and register a3 needs to be checked to know
- *     if an error occured, in which case errno is in v0.
+ *     if an error occurred, in which case errno is in v0.
  *   - the arguments are cast to long and assigned into the target registers
  *     which are then simply passed as registers to the asm code, so that we
  *     don't have to experience issues with register constraints.
-- 
2.31.1.189.g2e36527f23


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH nolibc 2/2] tools/nolibc: Implement msleep()
  2021-07-21 20:36 [PATCH nolibc 0/2] nolibc commits for v5.15 Paul E. McKenney
  2021-07-21 20:36 ` [PATCH nolibc 1/2] tools: include: nolibc: Fix a typo occured to occurred in the file nolibc.h Paul E. McKenney
@ 2021-07-21 20:36 ` Paul E. McKenney
  1 sibling, 0 replies; 3+ messages in thread
From: Paul E. McKenney @ 2021-07-21 20:36 UTC (permalink / raw)
  To: rcu
  Cc: linux-kernel, kernel-team, mingo, jiangshanlai, akpm,
	mathieu.desnoyers, josh, tglx, peterz, rostedt, dhowells,
	edumazet, fweisbec, oleg, joel, Mark Brown, Willy Tarreau,
	Paul E . McKenney

From: Mark Brown <broonie@kernel.org>

Allow users to implement shorter delays than a full second by implementing
msleep().

Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
 tools/include/nolibc/nolibc.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/tools/include/nolibc/nolibc.h b/tools/include/nolibc/nolibc.h
index 13c194aeaf3f0..3430667b0d241 100644
--- a/tools/include/nolibc/nolibc.h
+++ b/tools/include/nolibc/nolibc.h
@@ -2243,6 +2243,19 @@ unsigned int sleep(unsigned int seconds)
 		return 0;
 }
 
+static __attribute__((unused))
+int msleep(unsigned int msecs)
+{
+	struct timeval my_timeval = { msecs / 1000, (msecs % 1000) * 1000 };
+
+	if (sys_select(0, 0, 0, 0, &my_timeval) < 0)
+		return (my_timeval.tv_sec * 1000) +
+			(my_timeval.tv_usec / 1000) +
+			!!(my_timeval.tv_usec % 1000);
+	else
+		return 0;
+}
+
 static __attribute__((unused))
 int stat(const char *path, struct stat *buf)
 {
-- 
2.31.1.189.g2e36527f23


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-07-21 20:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-21 20:36 [PATCH nolibc 0/2] nolibc commits for v5.15 Paul E. McKenney
2021-07-21 20:36 ` [PATCH nolibc 1/2] tools: include: nolibc: Fix a typo occured to occurred in the file nolibc.h Paul E. McKenney
2021-07-21 20:36 ` [PATCH nolibc 2/2] tools/nolibc: Implement msleep() Paul E. McKenney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).