diff options
author | Theo Schlossnagle <jesus@omniti.com> | 2013-08-23 11:13:02 -0400 |
---|---|---|
committer | Dan McDonald <danmcd@nexenta.com> | 2013-08-23 11:13:02 -0400 |
commit | 1b3b16f35bee1ffc210591d82bca6adf247954b0 (patch) | |
tree | f1cfd2fdc8ff712b2d281a91968ff7a2d85c02ea | |
parent | b62969f868a827f0823a084bc0af9c7d8b76c659 (diff) | |
download | illumos-gate-1b3b16f35bee1ffc210591d82bca6adf247954b0.tar.gz |
3785 Implement MAP_32BIT flag to mmap()
Reviewed by: Albert Lee <trisk@nexenta.com>
Reviewed by: Dan McDonald <danmcd@nexenta.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Approved by: Dan McDonald <danmcd@nexenta.com>
-rw-r--r-- | usr/src/cmd/truss/print.c | 4 | ||||
-rw-r--r-- | usr/src/man/man2/mmap.2 | 17 | ||||
-rw-r--r-- | usr/src/uts/common/os/grow.c | 6 | ||||
-rw-r--r-- | usr/src/uts/common/sys/mman.h | 5 |
4 files changed, 27 insertions, 5 deletions
diff --git a/usr/src/cmd/truss/print.c b/usr/src/cmd/truss/print.c index ed39e33c4f..f49197a7f6 100644 --- a/usr/src/cmd/truss/print.c +++ b/usr/src/cmd/truss/print.c @@ -734,7 +734,7 @@ mmap_type(private_t *pri, long arg) arg &= ~(_MAP_NEW|MAP_TYPE); if (arg & ~(MAP_FIXED|MAP_RENAME|MAP_NORESERVE|MAP_ANON|MAP_ALIGN| - MAP_TEXT|MAP_INITDATA)) + MAP_TEXT|MAP_INITDATA|MAP_32BIT)) (void) snprintf(str + used, sizeof (pri->code_buf) - used, "|0x%lX", arg); else { @@ -752,6 +752,8 @@ mmap_type(private_t *pri, long arg) (void) strlcat(str, "|MAP_TEXT", CBSIZE); if (arg & MAP_INITDATA) (void) strlcat(str, "|MAP_INITDATA", CBSIZE); + if (arg & MAP_32BIT) + (void) strlcat(str, "|MAP_32BIT", CBSIZE); } return ((const char *)str); diff --git a/usr/src/man/man2/mmap.2 b/usr/src/man/man2/mmap.2 index 2c10a4aa78..c32b561a73 100644 --- a/usr/src/man/man2/mmap.2 +++ b/usr/src/man/man2/mmap.2 @@ -1,4 +1,5 @@ '\" te +.\" Copyright 2013 OmniTI Computer Consulting, Inc. All Rights Reserved. .\" Copyright 1989 AT&T. Copyright (c) 2009, Sun Microsystems, Inc. All Rights Reserved. Portions Copyright (c) 1992, X/Open Company Limited. All Rights Reserved. .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at .\" http://www.opengroup.org/bookstore/. @@ -203,6 +204,15 @@ Map initialized data segment. .RE .sp +.ne 2 +.na +\fB\fBMAP_32BIT\fR\fR +.ad +.RS 17n +Map to the lower 32 bits of address space. +.RE + +.sp .LP The \fBMAP_SHARED\fR and \fBMAP_PRIVATE\fR options describe the disposition of write references to the underlying object. If \fBMAP_SHARED\fR is specified, @@ -288,6 +298,13 @@ the system can choose a mapping size larger than the page size returned by dynamic linker for mapping initialized data of shared objects. .sp .LP +The \fBMAP_32BIT\fR option informs the system that the search space for +mapping assignment should be limited to the first 32 bits (4 Gbytes) of the +caller's address space. This flag is accepted in both 32-bit and 64-bit +process models, but does not alter the mapping strategy when used in a +32-bit process model. +.sp +.LP The \fIoff\fR argument is constrained to be aligned and sized according to the value returned by \fBsysconf()\fR when passed \fB_SC_PAGESIZE\fR or \fB_SC_PAGE_SIZE\fR. When \fBMAP_FIXED\fR is specified, the \fIaddr\fR argument diff --git a/usr/src/uts/common/os/grow.c b/usr/src/uts/common/os/grow.c index c08ea0d424..f5e92cfd94 100644 --- a/usr/src/uts/common/os/grow.c +++ b/usr/src/uts/common/os/grow.c @@ -19,6 +19,8 @@ * CDDL HEADER END */ +/* Copyright 2013 OmniTI Computer Consulting, Inc. All rights reserved. */ + /* * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. @@ -814,9 +816,7 @@ smmap64(caddr_t addr, size_t len, int prot, int flags, int fd, off_t pos) struct file *fp; int error; - if (flags & _MAP_LOW32) - error = EINVAL; - else if (fd == -1 && (flags & MAP_ANON) != 0) + if (fd == -1 && (flags & MAP_ANON) != 0) error = smmap_common(&addr, len, prot, flags, NULL, (offset_t)pos); else if ((fp = getf(fd)) != NULL) { diff --git a/usr/src/uts/common/sys/mman.h b/usr/src/uts/common/sys/mman.h index 6c9119e56d..8f66bf7489 100644 --- a/usr/src/uts/common/sys/mman.h +++ b/usr/src/uts/common/sys/mman.h @@ -19,6 +19,7 @@ * CDDL HEADER END */ +/* Copyright 2013 OmniTI Computer Consulting, Inc. All rights reserved. */ /* * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. @@ -104,9 +105,11 @@ extern "C" { #if (_POSIX_C_SOURCE <= 2) || defined(_XPG4_2) #ifdef _KERNEL #define PROT_EXCL 0x20 -#define _MAP_LOW32 0x80 /* force mapping in lower 4G of address space */ #endif /* _KERNEL */ +#define _MAP_LOW32 0x80 /* force mapping in lower 4G of address space */ +#define MAP_32BIT _MAP_LOW32 + /* * For the sake of backward object compatibility, we use the _MAP_NEW flag. * This flag will be automatically or'ed in by the C library for all |