Skip to content
This repository has been archived by the owner on Jul 17, 2024. It is now read-only.
/ jdk22u Public archive

Commit

Permalink
8324834: Use _LARGE_FILES on AIX
Browse files Browse the repository at this point in the history
Backport-of: 8e45182357f4990c86fd0b711a7a91887945480b
  • Loading branch information
MBaesken committed Mar 8, 2024
1 parent f510fe8 commit fd11382
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 17 deletions.
2 changes: 1 addition & 1 deletion make/autoconf/flags-cflags.m4
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
CFLAGS_OS_DEF_JVM="-D_ALLBSD_SOURCE -D_DARWIN_C_SOURCE -D_XOPEN_SOURCE"
CFLAGS_OS_DEF_JDK="-D_ALLBSD_SOURCE -D_DARWIN_UNLIMITED_SELECT"
elif test "x$OPENJDK_TARGET_OS" = xaix; then
CFLAGS_OS_DEF_JVM="-DAIX"
CFLAGS_OS_DEF_JVM="-DAIX -D_LARGE_FILES"
elif test "x$OPENJDK_TARGET_OS" = xbsd; then
CFLAGS_OS_DEF_JDK="-D_ALLBSD_SOURCE"
elif test "x$OPENJDK_TARGET_OS" = xwindows; then
Expand Down
14 changes: 7 additions & 7 deletions src/hotspot/os/aix/attachListener_aix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -478,14 +478,14 @@ AttachOperation* AttachListener::dequeue() {

void AttachListener::vm_start() {
char fn[UNIX_PATH_MAX];
struct stat64 st;
struct stat st;
int ret;

int n = snprintf(fn, UNIX_PATH_MAX, "%s/.java_pid%d",
os::get_temp_directory(), os::current_process_id());
assert(n < (int)UNIX_PATH_MAX, "java_pid file name buffer overflow");

RESTARTABLE(::stat64(fn, &st), ret);
RESTARTABLE(::stat(fn, &st), ret);
if (ret == 0) {
ret = ::unlink(fn);
if (ret == -1) {
Expand All @@ -505,8 +505,8 @@ int AttachListener::pd_init() {

bool AttachListener::check_socket_file() {
int ret;
struct stat64 st;
ret = stat64(AixAttachListener::path(), &st);
struct stat st;
ret = stat(AixAttachListener::path(), &st);
if (ret == -1) { // need to restart attach listener.
log_debug(attach)("Socket file %s does not exist - Restart Attach Listener",
AixAttachListener::path());
Expand Down Expand Up @@ -545,14 +545,14 @@ bool AttachListener::is_init_trigger() {
}
char fn[PATH_MAX + 1];
int ret;
struct stat64 st;
struct stat st;
os::snprintf_checked(fn, sizeof(fn), ".attach_pid%d", os::current_process_id());
RESTARTABLE(::stat64(fn, &st), ret);
RESTARTABLE(::stat(fn, &st), ret);
if (ret == -1) {
log_trace(attach)("Failed to find attach file: %s, trying alternate", fn);
snprintf(fn, sizeof(fn), "%s/.attach_pid%d",
os::get_temp_directory(), os::current_process_id());
RESTARTABLE(::stat64(fn, &st), ret);
RESTARTABLE(::stat(fn, &st), ret);
if (ret == -1) {
log_debug(attach)("Failed to find attach file: %s", fn);
}
Expand Down
18 changes: 11 additions & 7 deletions src/hotspot/os/aix/os_aix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@
#include <sys/utsname.h>
#include <sys/vminfo.h>

#ifndef _LARGE_FILES
#error Hotspot on AIX must be compiled with -D_LARGE_FILES
#endif

// Missing prototypes for various system APIs.
extern "C"
int mread_real_time(timebasestruct_t *t, size_t size_of_timebasestruct_t);
Expand Down Expand Up @@ -2511,19 +2515,19 @@ int os::open(const char *path, int oflag, int mode) {
// IV90804: OPENING A FILE IN AFS WITH O_CLOEXEC FAILS WITH AN EINVAL ERROR APPLIES TO AIX 7100-04 17/04/14 PTF PECHANGE
int oflag_with_o_cloexec = oflag | O_CLOEXEC;

int fd = ::open64(path, oflag_with_o_cloexec, mode);
int fd = ::open(path, oflag_with_o_cloexec, mode);
if (fd == -1) {
// we might fail in the open call when O_CLOEXEC is set, so try again without (see IV90804)
fd = ::open64(path, oflag, mode);
fd = ::open(path, oflag, mode);
if (fd == -1) {
return -1;
}
}

// If the open succeeded, the file might still be a directory.
{
struct stat64 buf64;
int ret = ::fstat64(fd, &buf64);
struct stat buf64;
int ret = ::fstat(fd, &buf64);
int st_mode = buf64.st_mode;

if (ret != -1) {
Expand Down Expand Up @@ -2577,17 +2581,17 @@ int os::open(const char *path, int oflag, int mode) {
int os::create_binary_file(const char* path, bool rewrite_existing) {
int oflags = O_WRONLY | O_CREAT;
oflags |= rewrite_existing ? O_TRUNC : O_EXCL;
return ::open64(path, oflags, S_IREAD | S_IWRITE);
return ::open(path, oflags, S_IREAD | S_IWRITE);
}

// return current position of file pointer
jlong os::current_file_offset(int fd) {
return (jlong)::lseek64(fd, (off64_t)0, SEEK_CUR);
return (jlong)::lseek(fd, (off_t)0, SEEK_CUR);
}

// move file pointer to the specified offset
jlong os::seek_to_file_offset(int fd, jlong offset) {
return (jlong)::lseek64(fd, (off64_t)offset, SEEK_SET);
return (jlong)::lseek(fd, (off_t)offset, SEEK_SET);
}

// Map a block of memory.
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/os/posix/os_posix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -753,11 +753,11 @@ void os::dll_unload(void *lib) {
}

jlong os::lseek(int fd, jlong offset, int whence) {
return (jlong) AIX_ONLY(::lseek64) NOT_AIX(::lseek)(fd, offset, whence);
return (jlong) ::lseek(fd, offset, whence);
}

int os::ftruncate(int fd, jlong length) {
return AIX_ONLY(::ftruncate64) NOT_AIX(::ftruncate)(fd, length);
return ::ftruncate(fd, length);
}

const char* os::get_current_directory(char *buf, size_t buflen) {
Expand Down

1 comment on commit fd11382

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.