mailing list of musl libc
 help / color / mirror / code / Atom feed
* [PATCH 0/3] Use v2 syscalls when appropriate
@ 2019-03-21 15:32 Drew DeVault
  2019-03-21 15:32 ` [PATCH 1/3] mman/mlock: use mlock2 " Drew DeVault
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Drew DeVault @ 2019-03-21 15:32 UTC (permalink / raw)
  To: musl; +Cc: Drew DeVault

Some architectures (notably RISC-V) don't support v1 syscalls at all.

Drew DeVault (3):
  mman/mlock: use mlock2 when appropriate
  stdio/rename: use renameat2 when appropriate
  unistd/renameat: use renameat2 when appropriate

 src/mman/mlock.c      | 4 ++++
 src/stdio/rename.c    | 6 ++++--
 src/unistd/renameat.c | 4 ++++
 3 files changed, 12 insertions(+), 2 deletions(-)

-- 
2.21.0



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

* [PATCH 1/3] mman/mlock: use mlock2 when appropriate
  2019-03-21 15:32 [PATCH 0/3] Use v2 syscalls when appropriate Drew DeVault
@ 2019-03-21 15:32 ` Drew DeVault
  2019-03-21 15:32 ` [PATCH 2/3] stdio/rename: use renameat2 " Drew DeVault
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Drew DeVault @ 2019-03-21 15:32 UTC (permalink / raw)
  To: musl; +Cc: Drew DeVault

---
 src/mman/mlock.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/mman/mlock.c b/src/mman/mlock.c
index e683a44a..71af582f 100644
--- a/src/mman/mlock.c
+++ b/src/mman/mlock.c
@@ -3,5 +3,9 @@
 
 int mlock(const void *addr, size_t len)
 {
+#ifdef SYS_mlock
 	return syscall(SYS_mlock, addr, len);
+#else
+	return syscall(SYS_mlock2, addr, len, 0);
+#endif
 }
-- 
2.21.0



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

* [PATCH 2/3] stdio/rename: use renameat2 when appropriate
  2019-03-21 15:32 [PATCH 0/3] Use v2 syscalls when appropriate Drew DeVault
  2019-03-21 15:32 ` [PATCH 1/3] mman/mlock: use mlock2 " Drew DeVault
@ 2019-03-21 15:32 ` Drew DeVault
  2019-03-21 15:32 ` [PATCH 3/3] unistd/renameat: " Drew DeVault
  2019-03-22  1:20 ` [PATCH 0/3] Use v2 syscalls " Rich Felker
  3 siblings, 0 replies; 5+ messages in thread
From: Drew DeVault @ 2019-03-21 15:32 UTC (permalink / raw)
  To: musl; +Cc: Drew DeVault

---
 src/stdio/rename.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/stdio/rename.c b/src/stdio/rename.c
index 04c90c01..f540adb6 100644
--- a/src/stdio/rename.c
+++ b/src/stdio/rename.c
@@ -4,9 +4,11 @@
 
 int rename(const char *old, const char *new)
 {
-#ifdef SYS_rename
+#if defined(SYS_rename)
 	return syscall(SYS_rename, old, new);
-#else
+#elif defined(SYS_renameat)
 	return syscall(SYS_renameat, AT_FDCWD, old, AT_FDCWD, new);
+#else
+	return syscall(SYS_renameat2, AT_FDCWD, old, AT_FDCWD, new, 0);
 #endif
 }
-- 
2.21.0



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

* [PATCH 3/3] unistd/renameat: use renameat2 when appropriate
  2019-03-21 15:32 [PATCH 0/3] Use v2 syscalls when appropriate Drew DeVault
  2019-03-21 15:32 ` [PATCH 1/3] mman/mlock: use mlock2 " Drew DeVault
  2019-03-21 15:32 ` [PATCH 2/3] stdio/rename: use renameat2 " Drew DeVault
@ 2019-03-21 15:32 ` Drew DeVault
  2019-03-22  1:20 ` [PATCH 0/3] Use v2 syscalls " Rich Felker
  3 siblings, 0 replies; 5+ messages in thread
From: Drew DeVault @ 2019-03-21 15:32 UTC (permalink / raw)
  To: musl; +Cc: Drew DeVault

---
 src/unistd/renameat.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/unistd/renameat.c b/src/unistd/renameat.c
index 12574822..c3b40a25 100644
--- a/src/unistd/renameat.c
+++ b/src/unistd/renameat.c
@@ -3,5 +3,9 @@
 
 int renameat(int oldfd, const char *old, int newfd, const char *new)
 {
+#ifdef SYS_renameat
 	return syscall(SYS_renameat, oldfd, old, newfd, new);
+#else
+	return syscall(SYS_renameat2, oldfd, old, newfd, new, 0);
+#endif
 }
-- 
2.21.0



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

* Re: [PATCH 0/3] Use v2 syscalls when appropriate
  2019-03-21 15:32 [PATCH 0/3] Use v2 syscalls when appropriate Drew DeVault
                   ` (2 preceding siblings ...)
  2019-03-21 15:32 ` [PATCH 3/3] unistd/renameat: " Drew DeVault
@ 2019-03-22  1:20 ` Rich Felker
  3 siblings, 0 replies; 5+ messages in thread
From: Rich Felker @ 2019-03-22  1:20 UTC (permalink / raw)
  To: musl

On Thu, Mar 21, 2019 at 11:32:37AM -0400, Drew DeVault wrote:
> Some architectures (notably RISC-V) don't support v1 syscalls at all.
> 
> Drew DeVault (3):
>   mman/mlock: use mlock2 when appropriate
>   stdio/rename: use renameat2 when appropriate
>   unistd/renameat: use renameat2 when appropriate
> 
>  src/mman/mlock.c      | 4 ++++
>  src/stdio/rename.c    | 6 ++++--
>  src/unistd/renameat.c | 4 ++++
>  3 files changed, 12 insertions(+), 2 deletions(-)

Thanks! Merging with purpose in commit messages clarified.

Rich


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

end of thread, other threads:[~2019-03-22  1:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-21 15:32 [PATCH 0/3] Use v2 syscalls when appropriate Drew DeVault
2019-03-21 15:32 ` [PATCH 1/3] mman/mlock: use mlock2 " Drew DeVault
2019-03-21 15:32 ` [PATCH 2/3] stdio/rename: use renameat2 " Drew DeVault
2019-03-21 15:32 ` [PATCH 3/3] unistd/renameat: " Drew DeVault
2019-03-22  1:20 ` [PATCH 0/3] Use v2 syscalls " Rich Felker

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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).