From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from sog-mx-4.v43.ch3.sourceforge.com ([172.29.43.194] helo=mx.sourceforge.net) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1Sx8ra-0005lh-PM for ltp-list@lists.sourceforge.net; Fri, 03 Aug 2012 03:47:46 +0000 Received: from [222.73.24.84] (helo=song.cn.fujitsu.com) by sog-mx-4.v43.ch3.sourceforge.com with esmtp (Exim 4.76) id 1Sx8rZ-0004Y5-9A for ltp-list@lists.sourceforge.net; Fri, 03 Aug 2012 03:47:46 +0000 Message-ID: <501B4997.8060002@cn.fujitsu.com> Date: Fri, 03 Aug 2012 11:46:31 +0800 From: Wanlong Gao MIME-Version: 1.0 References: <1343926437-2099-1-git-send-email-xu.simon@oracle.com> In-Reply-To: <1343926437-2099-1-git-send-email-xu.simon@oracle.com> Subject: Re: [LTP] [PATCH 1/1] madvise03: let the system select an address for shmat() Reply-To: gaowanlong@cn.fujitsu.com List-Id: Linux Test Project General Discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ltp-list-bounces@lists.sourceforge.net To: Simon Xu Cc: ltp-list@lists.sourceforge.net On 08/03/2012 12:53 AM, Simon Xu wrote: > In certain occasions, 0x22000000 is invalid for shmat() and madvise03 fails: > > madvise03 1 TBROK : shmat error > madvise03 2 TBROK : Remaining cases broken > > Use `NULL' for shmat() to let the system attach the shared memory segment > at the first available address. > > Signed-off-by: Simon Xu > --- > testcases/kernel/syscalls/madvise/madvise03.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/testcases/kernel/syscalls/madvise/madvise03.c b/testcases/kernel/syscalls/madvise/madvise03.c > index 2e696e8..fd0bd97 100644 > --- a/testcases/kernel/syscalls/madvise/madvise03.c > +++ b/testcases/kernel/syscalls/madvise/madvise03.c > @@ -154,13 +154,13 @@ int main(int argc, char *argv[]) > if (shmid1 == -1) > tst_brkm(TBROK, cleanup, "shmget failed"); > > - /* Attach shared memory segment to 0x22000000 address */ > - addr1 = shmat(shmid1, (void *)0x22000000, 0); > + /* Attach shared memory segment to an address selected by the system */ > + addr1 = shmat(shmid1, NULL, 0); > if (addr1 == (void *) -1) > tst_brkm(TBROK, cleanup, "shmat error"); > > /* (1) Test case for MADV_REMOVE */ > - TEST(madvise((void *)0x22000000, 4096, MADV_REMOVE)); > + TEST(madvise((void *)addr1, 4096, MADV_REMOVE)); (void *) is not needed now ? otherwise, looks OK to me. Thanks, Wanlong Gao > check_and_print("MADV_REMOVE"); > > /* (2) Test case for MADV_DONTFORK */ > ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list