diff options
Diffstat (limited to 'sys/compat/linux/linux_misc.c')
-rw-r--r-- | sys/compat/linux/linux_misc.c | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c index 7ae04c3..a3ca05d 100644 --- a/sys/compat/linux/linux_misc.c +++ b/sys/compat/linux/linux_misc.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: linux_misc.c,v 1.37 1998/04/06 08:26:01 phk Exp $ + * $Id: linux_misc.c,v 1.38 1998/05/17 11:52:26 phk Exp $ */ #include <sys/param.h> @@ -615,6 +615,37 @@ linux_mmap(struct proc *p, struct linux_mmap_args *args) return mmap(p, &bsd_args); } +int +linux_mremap(struct proc *p, struct linux_mremap_args *args) +{ + struct munmap_args /* { + void *addr; + size_t len; + } */ bsd_args; + int error = 0; + +#ifdef DEBUG + printf("Linux-emul(%d): mremap(%08x, %08x, %08x, %08x)\n", + p->p_pid, args->addr, args->old_len, args->new_len, args->flags); +#endif + args->new_len = round_page(args->new_len); + args->old_len = round_page(args->old_len); + + if (args->new_len > args->old_len) { + p->p_retval[0] = 0; + return ENOMEM; + } + + if (args->new_len < args->old_len) { + bsd_args.addr = args->addr + args->new_len; + bsd_args.len = args->old_len - args->new_len; + error = munmap(p, &bsd_args); + } + + p->p_retval[0] = error ? 0 : (int)args->addr; + return error; +} + int linux_msync(struct proc *p, struct linux_msync_args *args) { |