This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
[PATCH 01/44] Implement read(2)/write(2) and neccessary lseek(2) for posix shmfd. Add MAC framework entries for posix shm read and write.
- From: Sebastian Huber <sebastian dot huber at embedded-brains dot de>
- To: newlib at sourceware dot org
- Date: Thu, 9 Aug 2018 08:08:53 +0200
- Subject: [PATCH 01/44] Implement read(2)/write(2) and neccessary lseek(2) for posix shmfd. Add MAC framework entries for posix shm read and write.
- References: <20180809060936.9726-1-sebastian.huber@embedded-brains.de>
From: kib <kib@FreeBSD.org>
Do not allow implicit extension of the underlying memory segment past
the limit set by ftruncate(2) by either of the syscalls. Read and
write returns short i/o, lseek(2) fails with EINVAL when resulting
offset does not fit into the limit.
Discussed with: alc
Tested by: pho
Sponsored by: The FreeBSD Foundation
---
newlib/libc/sys/rtems/include/sys/mman.h | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/newlib/libc/sys/rtems/include/sys/mman.h b/newlib/libc/sys/rtems/include/sys/mman.h
index e7e5cf46b..536bfd562 100644
--- a/newlib/libc/sys/rtems/include/sys/mman.h
+++ b/newlib/libc/sys/rtems/include/sys/mman.h
@@ -190,6 +190,10 @@ typedef __size_t size_t;
#endif
#if defined(_KERNEL) || defined(_WANT_FILE)
+#include <sys/lock.h>
+#include <sys/mutex.h>
+#include <sys/queue.h>
+#include <sys/rangelock.h>
#include <vm/vm.h>
struct file;
@@ -215,6 +219,9 @@ struct shmfd {
struct label *shm_label; /* MAC label */
const char *shm_path;
+
+ struct rangelock shm_rl;
+ struct mtx shm_mtx;
};
#endif
--
2.13.7