public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Add an shm_rename syscall
@ 2022-07-11 11:50 Sebastian Huber
  0 siblings, 0 replies; only message in thread
From: Sebastian Huber @ 2022-07-11 11:50 UTC (permalink / raw)
  To: newlib-cvs

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=53648039c4efa32941bf567f9d0ab2f4c012cc4d

commit 53648039c4efa32941bf567f9d0ab2f4c012cc4d
Author: David Bright <dab@FreeBSD.org>
Date:   Thu Sep 26 15:32:28 2019 +0000

    Add an shm_rename syscall
    
    Add an atomic shm rename operation, similar in spirit to a file
    rename. Atomically unlink an shm from a source path and link it to a
    destination path. If an existing shm is linked at the destination
    path, unlink it as part of the same atomic operation. The caller needs
    the same permissions as shm_unlink to the shm being renamed, and the
    same permissions for the shm at the destination which is being
    unlinked, if it exists. If those fail, EACCES is returned, as with the
    other shm_* syscalls.
    
    truss support is included; audit support will come later.
    
    This commit includes only the implementation; the sysent-generated
    bits will come in a follow-on commit.
    
    Submitted by:   Matthew Bryan <matthew.bryan@isilon.com>
    Reviewed by:    jilles (earlier revision)
    Reviewed by:    brueffer (manpages, earlier revision)
    Relnotes:       yes
    Sponsored by:   Dell EMC Isilon
    Differential Revision:  https://reviews.freebsd.org/D21423

Diff:
---
 newlib/libc/sys/rtems/include/sys/mman.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/newlib/libc/sys/rtems/include/sys/mman.h b/newlib/libc/sys/rtems/include/sys/mman.h
index 867b68647..89cc4d699 100644
--- a/newlib/libc/sys/rtems/include/sys/mman.h
+++ b/newlib/libc/sys/rtems/include/sys/mman.h
@@ -133,6 +133,14 @@
  */
 #define MAP_FAILED	((void *)-1)
 
+/*
+ * Flags provided to shm_rename
+ */
+/* Don't overwrite dest, if it exists */
+#define SHM_RENAME_NOREPLACE	(1 << 0)
+/* Atomically swap src and dest */
+#define SHM_RENAME_EXCHANGE	(1 << 1)
+
 /*
  * msync() flags
  */
@@ -264,6 +272,7 @@ int	posix_madvise(void *, size_t, int);
 int	mlockall(int);
 int	munlockall(void);
 int	shm_open(const char *, int, mode_t);
+int	shm_rename(const char *, const char *, int);
 int	shm_unlink(const char *);
 #endif
 #if __BSD_VISIBLE


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-07-11 11:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-11 11:50 [newlib-cygwin] Add an shm_rename syscall Sebastian Huber

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 read-only IMAP folder(s) and NNTP newsgroup(s).