[rtems commit] posix: add stub implementations for mman functions

Gedare Bloom gedare at rtems.org
Fri Jan 13 17:40:02 UTC 2017


Module:    rtems
Branch:    master
Commit:    1ca8ee137e9e7dc815e55cc06ebd2c2c4e2191be
Changeset: http://git.rtems.org/rtems/commit/?id=1ca8ee137e9e7dc815e55cc06ebd2c2c4e2191be

Author:    Gedare Bloom <gedare at rtems.org>
Date:      Fri Aug 12 11:17:40 2016 -0400

posix: add stub implementations for mman functions

---

 cpukit/posix/Makefile.am         |  8 ++++++++
 cpukit/posix/src/mlock.c         | 27 +++++++++++++++++++++++++++
 cpukit/posix/src/mlockall.c      | 26 ++++++++++++++++++++++++++
 cpukit/posix/src/msync.c         | 28 ++++++++++++++++++++++++++++
 cpukit/posix/src/munlock.c       | 27 +++++++++++++++++++++++++++
 cpukit/posix/src/munlockall.c    | 24 ++++++++++++++++++++++++
 cpukit/posix/src/posix_madvise.c | 28 ++++++++++++++++++++++++++++
 cpukit/posix/src/shmopen.c       | 28 ++++++++++++++++++++++++++++
 cpukit/posix/src/shmunlink.c     | 26 ++++++++++++++++++++++++++
 9 files changed, 222 insertions(+)

diff --git a/cpukit/posix/Makefile.am b/cpukit/posix/Makefile.am
index 8323de8..53faace 100644
--- a/cpukit/posix/Makefile.am
+++ b/cpukit/posix/Makefile.am
@@ -89,9 +89,17 @@ libposix_a_SOURCES += src/cond.c src/condattrdestroy.c \
     src/condtimedwait.c src/condwait.c src/condwaitsupp.c src/condget.c
 
 ## MEMORY_C_FILES
+libposix_a_SOURCES += src/mlockall.c
+libposix_a_SOURCES += src/mlock.c
 libposix_a_SOURCES += src/mmap.c
 libposix_a_SOURCES += src/mprotect.c
+libposix_a_SOURCES += src/msync.c
+libposix_a_SOURCES += src/munlockall.c
+libposix_a_SOURCES += src/munlock.c
 libposix_a_SOURCES += src/munmap.c
+libposix_a_SOURCES += src/posix_madvise.c
+libposix_a_SOURCES += src/shmopen.c
+libposix_a_SOURCES += src/shmunlink.c
 
 ## MESSAGE_QUEUE_C_FILES
 libposix_a_SOURCES += src/mqueue.c src/mqueueclose.c \
diff --git a/cpukit/posix/src/mlock.c b/cpukit/posix/src/mlock.c
new file mode 100644
index 0000000..4f7d3c0
--- /dev/null
+++ b/cpukit/posix/src/mlock.c
@@ -0,0 +1,27 @@
+/**
+ * @file
+ */
+
+/*
+ * Copyright (c) 2016 Gedare Bloom.
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <sys/mman.h>
+#include <errno.h>
+#include <rtems/seterr.h>
+
+int mlock( const void *addr, size_t len )
+{
+  (void) addr;
+  (void) len;
+
+  rtems_set_errno_and_return_minus_one( ENOMEM );
+}
diff --git a/cpukit/posix/src/mlockall.c b/cpukit/posix/src/mlockall.c
new file mode 100644
index 0000000..1fd4ed5
--- /dev/null
+++ b/cpukit/posix/src/mlockall.c
@@ -0,0 +1,26 @@
+/**
+ * @file
+ */
+
+/*
+ * Copyright (c) 2016 Gedare Bloom.
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <sys/mman.h>
+#include <errno.h>
+#include <rtems/seterr.h>
+
+int mlockall( int flags )
+{
+  (void) flags;
+
+  rtems_set_errno_and_return_minus_one( EINVAL );
+}
diff --git a/cpukit/posix/src/msync.c b/cpukit/posix/src/msync.c
new file mode 100644
index 0000000..fa84083
--- /dev/null
+++ b/cpukit/posix/src/msync.c
@@ -0,0 +1,28 @@
+/**
+ * @file
+ */
+
+/*
+ * Copyright (c) 2016 Gedare Bloom.
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <sys/mman.h>
+#include <errno.h>
+#include <rtems/seterr.h>
+
+int msync( void *addr, size_t len, int flags )
+{
+  (void) addr;
+  (void) len;
+  (void) flags;
+
+  rtems_set_errno_and_return_minus_one( EINVAL );
+}
diff --git a/cpukit/posix/src/munlock.c b/cpukit/posix/src/munlock.c
new file mode 100644
index 0000000..7a4b104
--- /dev/null
+++ b/cpukit/posix/src/munlock.c
@@ -0,0 +1,27 @@
+/**
+ * @file
+ */
+
+/*
+ * Copyright (c) 2016 Gedare Bloom.
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <sys/mman.h>
+#include <errno.h>
+#include <rtems/seterr.h>
+
+int munlock( const void *addr, size_t len )
+{
+  (void) addr;
+  (void) len;
+
+  rtems_set_errno_and_return_minus_one( ENOMEM );
+}
diff --git a/cpukit/posix/src/munlockall.c b/cpukit/posix/src/munlockall.c
new file mode 100644
index 0000000..c24cfc9
--- /dev/null
+++ b/cpukit/posix/src/munlockall.c
@@ -0,0 +1,24 @@
+/**
+ * @file
+ */
+
+/*
+ * Copyright (c) 2016 Gedare Bloom.
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <sys/mman.h>
+#include <errno.h>
+#include <rtems/seterr.h>
+
+int munlockall( void )
+{
+  rtems_set_errno_and_return_minus_one( EINVAL );
+}
diff --git a/cpukit/posix/src/posix_madvise.c b/cpukit/posix/src/posix_madvise.c
new file mode 100644
index 0000000..b909a1c
--- /dev/null
+++ b/cpukit/posix/src/posix_madvise.c
@@ -0,0 +1,28 @@
+/**
+ * @file
+ */
+
+/*
+ * Copyright (c) 2016 Gedare Bloom.
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <sys/mman.h>
+#include <errno.h>
+#include <rtems/seterr.h>
+
+int posix_madvise( void *addr, size_t len, int advice )
+{
+  (void) addr;
+  (void) len;
+  (void) advice;
+
+  return EINVAL;
+}
diff --git a/cpukit/posix/src/shmopen.c b/cpukit/posix/src/shmopen.c
new file mode 100644
index 0000000..abac3f4
--- /dev/null
+++ b/cpukit/posix/src/shmopen.c
@@ -0,0 +1,28 @@
+/**
+ * @file
+ */
+
+/*
+ * Copyright (c) 2016 Gedare Bloom.
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <sys/mman.h>
+#include <errno.h>
+#include <rtems/seterr.h>
+
+int shm_open( const char *name, int oflag, mode_t mode )
+{
+  (void) name;
+  (void) oflag;
+  (void) mode;
+
+  rtems_set_errno_and_return_minus_one( EINVAL );
+}
diff --git a/cpukit/posix/src/shmunlink.c b/cpukit/posix/src/shmunlink.c
new file mode 100644
index 0000000..f559922
--- /dev/null
+++ b/cpukit/posix/src/shmunlink.c
@@ -0,0 +1,26 @@
+/**
+ * @file
+ */
+
+/*
+ * Copyright (c) 2016 Gedare Bloom.
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <sys/mman.h>
+#include <errno.h>
+#include <rtems/seterr.h>
+
+int shm_unlink( const char *name )
+{
+  (void) name;
+
+  rtems_set_errno_and_return_minus_one( ENOENT );
+}




More information about the vc mailing list