Implement read(2)/write(2) and neccessary lseek(2)

for posix shmfd. Add MAC framework entries for posix shm read and write.

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
This commit is contained in:
kib 2013-08-21 17:45:00 +00:00 committed by Sebastian Huber
parent 5d29023c11
commit e6a85661ce
1 changed files with 7 additions and 0 deletions

View File

@ -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