From owner-p4-projects@FreeBSD.ORG Tue Feb 27 01:54:26 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 3DC5016A403; Tue, 27 Feb 2007 01:54:26 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E2A0E16A400 for ; Tue, 27 Feb 2007 01:54:25 +0000 (UTC) (envelope-from jkim@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id D525513C474 for ; Tue, 27 Feb 2007 01:54:25 +0000 (UTC) (envelope-from jkim@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id l1R1sPPb060883 for ; Tue, 27 Feb 2007 01:54:25 GMT (envelope-from jkim@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id l1R1sPw5060880 for perforce@freebsd.org; Tue, 27 Feb 2007 01:54:25 GMT (envelope-from jkim@freebsd.org) Date: Tue, 27 Feb 2007 01:54:25 GMT Message-Id: <200702270154.l1R1sPw5060880@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jkim@freebsd.org using -f From: Jung-uk Kim To: Perforce Change Reviews Cc: Subject: PERFORCE change 115094 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Feb 2007 01:54:26 -0000 http://perforce.freebsd.org/chv.cgi?CH=115094 Change 115094 by jkim@jkim_hammer on 2007/02/27 01:54:21 Linux does not check file descriptor when MAP_ANONYMOUS is set. This should fix recent LTP test regressions. Affected files ... .. //depot/projects/linuxolator/src/sys/amd64/linux32/linux32_machdep.c#43 edit .. //depot/projects/linuxolator/src/sys/i386/linux/linux_machdep.c#34 edit Differences ... ==== //depot/projects/linuxolator/src/sys/amd64/linux32/linux32_machdep.c#43 (text+ko) ==== @@ -831,7 +831,9 @@ if (bsd_args.prot & (PROT_READ | PROT_WRITE | PROT_EXEC)) bsd_args.prot |= PROT_READ | PROT_EXEC; - if (linux_args->fd != -1) { + /* Linux does not check file descriptor when MAP_ANONYMOUS is set. */ + bsd_args.fd = (bsd_args.flags & MAP_ANON) ? -1 : linux_args->fd; + if (bsd_args.fd != -1) { /* * Linux follows Solaris mmap(2) description: * The file descriptor fildes is opened with @@ -839,7 +841,7 @@ * protection options specified. */ - if ((error = fget(td, linux_args->fd, &fp)) != 0) + if ((error = fget(td, bsd_args.fd, &fp)) != 0) return (error); if (fp->f_type != DTYPE_VNODE) { fdrop(fp, td); @@ -854,7 +856,6 @@ fdrop(fp, td); } - bsd_args.fd = linux_args->fd; if (linux_args->flags & LINUX_MAP_GROWSDOWN) { /* ==== //depot/projects/linuxolator/src/sys/i386/linux/linux_machdep.c#34 (text+ko) ==== @@ -669,7 +669,9 @@ if (bsd_args.prot & (PROT_READ | PROT_WRITE | PROT_EXEC)) bsd_args.prot |= PROT_READ | PROT_EXEC; - if (linux_args->fd != -1) { + /* Linux does not check file descriptor when MAP_ANONYMOUS is set. */ + bsd_args.fd = (bsd_args.flags & MAP_ANON) ? -1 : linux_args->fd; + if (bsd_args.fd != -1) { /* * Linux follows Solaris mmap(2) description: * The file descriptor fildes is opened with @@ -677,7 +679,7 @@ * protection options specified. */ - if ((error = fget(td, linux_args->fd, &fp)) != 0) + if ((error = fget(td, bsd_args.fd, &fp)) != 0) return (error); if (fp->f_type != DTYPE_VNODE) { fdrop(fp, td); @@ -692,7 +694,6 @@ fdrop(fp, td); } - bsd_args.fd = linux_args->fd; if (linux_args->flags & LINUX_MAP_GROWSDOWN) { /*