getgid.2 getgroups.2 getitimer.2 getlogin.2 getpeername.2 getpgrp.2 \
getpid.2 getpriority.2 getrlimit.2 getrusage.2 getsockname.2 \
getsockopt.2 gettimeofday.2 getuid.2 intro.2 ioctl.2 kill.2 link.2 \
- listen.2 lseek.2 mkdir.2 mkfifo.2 mknod.2 madvise.2 mincore.2 mlock.2 \
+ listen.2 lseek.2 mkdir.2 mkfifo.2 mknod.2 madvise.2 mincore.2 \
+ minherit.2 mlock.2 \
mmap.2 mount.2 mprotect.2 msync.2 munmap.2 nfssvc.2 open.2 pathconf.2 \
pipe.2 profil.2 ptrace.2 quotactl.2 read.2 readlink.2 reboot.2 recv.2 \
rename.2 revoke.2 rmdir.2 select.2 send.2 setgroups.2 setpgid.2 \
.Ed
.Sh SEE ALSO
.Xr mincore 2 ,
+.Xr minherit 2 ,
.Xr mprotect 2 ,
.Xr msync 2 ,
.Xr munmap 2
with a value of 1 meaning that the page is in-core.
.Sh SEE ALSO
.Xr madvise 2 ,
+.Xr minherit 2 ,
.Xr mlock 2 ,
.Xr mprotect 2 ,
.Xr msync 2 ,
--- /dev/null
+.\" $NetBSD: mprotect.2,v 1.6 1995/10/12 15:41:08 jtc Exp $
+.\"
+.\" Copyright (c) 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)mprotect.2 8.1 (Berkeley) 6/9/93
+.\"
+.Dd June 9, 1993
+.Dt MPROTECT 2
+.Os
+.Sh NAME
+.Nm minherit
+.Nd control the inheritance of pages
+.Sh SYNOPSIS
+.Fd #include <sys/types.h>
+.Fd #include <sys/mman.h>
+.Ft int
+.Fn minherit "caddr_t addr" "size_t len" "int inherit"
+.Sh DESCRIPTION
+The
+.Fn minherit
+system call
+changes the specified pages to have the inheritance characteristic
+.Fa inherit .
+Not all implementations will guarantee that the inheritance characteristic
+can be set on a page basis;
+the granularity of changes may be as large as an entire region.
+.Sh SEE ALSO
+.Xr madvise 2 ,
+.Xr mincore 2 ,
+.Xr mprotect 2 ,
+.Xr msync 2 ,
+.Xr munmap 2
+.Sh HISTORY
+The
+.Fn mprotect
+function first appeared in 4.4BSD.
.Sh "SEE ALSO"
.Xr fork 2 ,
.Xr mincore 2 ,
+.Xr minherit 2 ,
.Xr mmap 2 ,
.Xr munmap 2 ,
.Xr setrlimit 2 ,
An I/O error occured while writing to the file system.
.Sh SEE ALSO
.Xr madvise 2 ,
+.Xr minherit 2 ,
.Xr munmap 2 ,
.Xr mprotect 2 ,
.Xr mincore 2
{ 0, 0,
sys_nosys }, /* 231 = unimplemented shmget */
#endif
+ { 0, 0,
+ sys_nosys }, /* 232 = unimplemented */
+ { 0, 0,
+ sys_nosys }, /* 233 = unimplemented */
+ { 0, 0,
+ sys_nosys }, /* 234 = unimplemented */
+ { 0, 0,
+ sys_nosys }, /* 235 = unimplemented */
+ { 0, 0,
+ sys_nosys }, /* 236 = unimplemented */
+ { 0, 0,
+ sys_nosys }, /* 237 = unimplemented */
+ { 0, 0,
+ sys_nosys }, /* 238 = unimplemented */
+ { 0, 0,
+ sys_nosys }, /* 239 = unimplemented */
+ { 0, 0,
+ sys_nosys }, /* 240 = unimplemented */
+ { 0, 0,
+ sys_nosys }, /* 241 = unimplemented */
+ { 0, 0,
+ sys_nosys }, /* 242 = unimplemented */
+ { 0, 0,
+ sys_nosys }, /* 243 = unimplemented */
+ { 0, 0,
+ sys_nosys }, /* 244 = unimplemented */
+ { 0, 0,
+ sys_nosys }, /* 245 = unimplemented */
+ { 0, 0,
+ sys_nosys }, /* 246 = unimplemented */
+ { 0, 0,
+ sys_nosys }, /* 247 = unimplemented */
+ { 0, 0,
+ sys_nosys }, /* 248 = unimplemented */
+ { 0, 0,
+ sys_nosys }, /* 249 = unimplemented */
+ { 3, s(struct sys_minherit_args),
+ sys_minherit }, /* 250 = minherit */
};
"#230 (unimplemented shmdt)", /* 230 = unimplemented shmdt */
"#231 (unimplemented shmget)", /* 231 = unimplemented shmget */
#endif
+ "#232 (unimplemented)", /* 232 = unimplemented */
+ "#233 (unimplemented)", /* 233 = unimplemented */
+ "#234 (unimplemented)", /* 234 = unimplemented */
+ "#235 (unimplemented)", /* 235 = unimplemented */
+ "#236 (unimplemented)", /* 236 = unimplemented */
+ "#237 (unimplemented)", /* 237 = unimplemented */
+ "#238 (unimplemented)", /* 238 = unimplemented */
+ "#239 (unimplemented)", /* 239 = unimplemented */
+ "#240 (unimplemented)", /* 240 = unimplemented */
+ "#241 (unimplemented)", /* 241 = unimplemented */
+ "#242 (unimplemented)", /* 242 = unimplemented */
+ "#243 (unimplemented)", /* 243 = unimplemented */
+ "#244 (unimplemented)", /* 244 = unimplemented */
+ "#245 (unimplemented)", /* 245 = unimplemented */
+ "#246 (unimplemented)", /* 246 = unimplemented */
+ "#247 (unimplemented)", /* 247 = unimplemented */
+ "#248 (unimplemented)", /* 248 = unimplemented */
+ "#249 (unimplemented)", /* 249 = unimplemented */
+ "minherit", /* 250 = minherit */
};
230 UNIMPL shmdt
231 UNIMPL shmget
#endif
+232 UNIMPL
+233 UNIMPL
+234 UNIMPL
+235 UNIMPL
+236 UNIMPL
+237 UNIMPL
+238 UNIMPL
+239 UNIMPL
+240 UNIMPL
+241 UNIMPL
+242 UNIMPL
+243 UNIMPL
+244 UNIMPL
+245 UNIMPL
+246 UNIMPL
+247 UNIMPL
+248 UNIMPL
+249 UNIMPL
+250 STD { int sys_minherit(caddr_t addr, size_t len, \
+ int inherit); }
#define SYS_shmctl 229
#define SYS_shmdt 230
#define SYS_shmget 231
-#define SYS_MAXSYSCALL 232
+#define SYS_minherit 250
+#define SYS_MAXSYSCALL 251
syscallarg(int) shmflg;
};
+struct sys_minherit_args {
+ syscallarg(caddr_t) addr;
+ syscallarg(size_t) len;
+ syscallarg(int) inherit;
+};
+
/*
* System call prototypes.
*/
int sys_shmget __P((struct proc *, void *, register_t *));
#else
#endif
+int sys_minherit __P((struct proc *, void *, register_t *));
int madvise __P((struct proc *, void *, int *));
int mincore __P((struct proc *, void *, int *));
int mprotect __P((struct proc *, void *, int *));
+int minherit __P((struct proc *, void *, int *));
int msync __P((struct proc *, void *, int *));
int munmap __P((struct proc *, void *, int *));
int obreak __P((struct proc *, void *, int *));
return (EINVAL);
}
+int
+sys_minherit(p, v, retval)
+ struct proc *p;
+ void *v;
+ register_t *retval;
+{
+ struct sys_minherit_args /* {
+ syscallarg(caddr_t) addr;
+ syscallarg(int) len;
+ syscallarg(int) inherit;
+ } */ *uap = v;
+ vm_offset_t addr;
+ vm_size_t size, pageoff;
+ register vm_inherit_t inherit;
+
+ addr = (vm_offset_t)SCARG(uap, addr);
+ size = (vm_size_t)SCARG(uap, len);
+ inherit = SCARG(uap, inherit);
+#ifdef DEBUG
+ if (mmapdebug & MDB_FOLLOW)
+ printf("minherit(%d): addr %x len %x inherit %d\n", p->p_pid,
+ addr, size, inherit);
+#endif
+ /*
+ * Align the address to a page boundary,
+ * and adjust the size accordingly.
+ */
+ pageoff = (addr & PAGE_MASK);
+ addr -= pageoff;
+ size += pageoff;
+ size = (vm_size_t) round_page(size);
+ if ((int)size < 0)
+ return(EINVAL);
+
+ switch (vm_map_inherit(&p->p_vmspace->vm_map, addr, addr+size,
+ inherit)) {
+ case KERN_SUCCESS:
+ return (0);
+ case KERN_PROTECTION_FAILURE:
+ return (EACCES);
+ }
+ return (EINVAL);
+}
+
/* ARGSUSED */
int
sys_madvise(p, v, retval)