jdk
1/*
2* Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
3* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*
5* This code is free software; you can redistribute it and/or modify it
6* under the terms of the GNU General Public License version 2 only, as
7* published by the Free Software Foundation.
8*
9* This code is distributed in the hope that it will be useful, but WITHOUT
10* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12* version 2 for more details (a copy is included in the LICENSE file that
13* accompanied this code).
14*
15* You should have received a copy of the GNU General Public License version
16* 2 along with this work; if not, write to the Free Software Foundation,
17* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18*
19* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20* or visit www.oracle.com if you need additional information or have any
21* questions.
22*/
23
24#include "precompiled.hpp"25
26#ifdef AIX27
28#include "runtime/os.inline.hpp"29#include "utilities/debug.hpp"30#include "utilities/globalDefinitions.hpp"31#include "unittest.hpp"32
33// On Aix, when using shmget() in os::attempt_reserve_memory_at() we should fail with attach
34// attempts not aligned to shmget() segment boundaries (256m)
35// But shmget() is only used in cases we want to have 64K pages and mmap() does not provide it.
36TEST_VM(os_aix, aix_reserve_at_non_shmlba_aligned_address) {37if (os::vm_page_size() != 4*K && !os::Aix::supports_64K_mmap_pages()) {38// With this condition true shmget() is used inside39char* p = os::attempt_reserve_memory_at((char*)0x1f00000, M);40ASSERT_EQ(p, nullptr); // should have failed41p = os::attempt_reserve_memory_at((char*)((64 * G) + M), M);42ASSERT_EQ(p, nullptr); // should have failed43}44}
45
46#endif // AIX47