Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always define __MAP_64 #6989

Merged
merged 1 commit into from
May 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion include_core/omrutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,30 @@ omr_error_t detectVMDirectory(wchar_t *vmDirectory, size_t vmDirectoryLength, wc

uintptr_t getStorageKey(void);

#endif /*if defined(J9ZOS390)*/
/* ---------------- zosversion.c ---------------- */

#define ZOS_V1R10_RELEASE 20.00
#define ZOS_V1R10_VERSION 3

#define ZOS_V2R4_RELEASE 27.00
#define ZOS_V2R4_VERSION 4
hangshao0 marked this conversation as resolved.
Show resolved Hide resolved

/**
* Determine if the z/OS version is greater than or equal to a given
* release and version. The implementation is based on uname(),
* NOT on __osname() as the __osname() release numbers are not
* guaranteed to increase.
*
* For release and version numbers, see
* https://www.ibm.com/docs/en/zos/2.5.0?topic=functions-uname-display-current-operating-system-name
*
* @param[in] min_release the release to be checked.
* @param[in] min_version the version to be checked.
* @return TRUE if the z/OS version is greater than or equal to the given release and version,
* FALSE otherwise.
*/
BOOLEAN zos_version_at_least(double min_release, double min_version);
hangshao0 marked this conversation as resolved.
Show resolved Hide resolved
#endif /* defined(J9ZOS390) */

/**
* Returns a string representing the type of page indicated by the given pageFlags.
Expand Down
25 changes: 22 additions & 3 deletions port/unix/omrmmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
#include "ut_omrport.h"
#include "protect_helpers.h"
#include "omrportpriv.h"
#include "omrutil.h"

#if defined(J9ZOS390)
#include "omrvmem.h"
Expand All @@ -56,6 +57,10 @@
#endif /* !defined(MAP_FAILED) */
#endif /* defined(J9ZOS390) */

#if defined(J9ZOS39064) && !defined(__MAP_64)
#define __MAP_64 0x10
#endif /* defined(J9ZOS39064) && !defined(__MAP_64) */

#if defined(AIXPPC)
#include <sys/shm.h>
#include <sys/vminfo.h>
Expand Down Expand Up @@ -205,11 +210,25 @@ omrmmap_map_file(struct OMRPortLibrary *portLibrary, intptr_t file, uint64_t off
spCount++;
}

#if defined(J9ZOS39064) && defined(__MAP_64)
#if defined(J9ZOS39064)
if (OMR_ARE_ANY_BITS_SET(flags, OMRPORT_MMAP_FLAG_ZOS_64BIT)) {
mmapFlags |= __MAP_64;
if (zos_version_at_least(ZOS_V2R4_RELEASE, ZOS_V2R4_VERSION)) {
mmapFlags |= __MAP_64;
} else {
Trc_PRT_mmap_map_file_unix_invalidFlags();
errMsg = portLibrary->nls_lookup_message(
portLibrary,
J9NLS_ERROR | J9NLS_DO_NOT_APPEND_NEWLINE,
J9NLS_PORT_MMAP_INVALID_FLAG,
NULL);
portLibrary->error_set_last_error_with_message(
portLibrary,
OMRPORT_ERROR_MMAP_MAP_FILE_INVALIDFLAGS,
errMsg);
return NULL;
}
}
#endif /* defined(J9ZOS39064) && defined(__MAP_64) */
#endif /* defined(J9ZOS39064) */

if (1 != rwCount) {
Trc_PRT_mmap_map_file_unix_invalidFlags();
Expand Down