8218857: Confusing overloads for os::open

Reviewed-by: kbarrett, rehn
This commit is contained in:
Harold Seigel 2022-01-10 13:57:45 +00:00
parent 4ff6720573
commit 11d88ce82e
6 changed files with 10 additions and 10 deletions

View File

@ -675,7 +675,7 @@ const char* os::get_current_directory(char *buf, size_t buflen) {
return getcwd(buf, buflen);
}
FILE* os::open(int fd, const char* mode) {
FILE* os::fdopen(int fd, const char* mode) {
return ::fdopen(fd, mode);
}

View File

@ -4754,7 +4754,7 @@ int os::open(const char *path, int oflag, int mode) {
return fd;
}
FILE* os::open(int fd, const char* mode) {
FILE* os::fdopen(int fd, const char* mode) {
return ::_fdopen(fd, mode);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -64,7 +64,7 @@ ClassListParser::ClassListParser(const char* file) : _id2klass_table(INITIAL_TAB
if (fd != -1) {
// Obtain a File* from the file descriptor so that fgets()
// can be used in parse_one_line()
_file = os::open(fd, "r");
_file = os::fdopen(fd, "r");
}
if (_file == NULL) {
char errmsg[JVM_MAXPATHLEN];

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -1688,7 +1688,7 @@ void ciEnv::dump_replay_data(int compile_id) {
if (ret > 0) {
int fd = os::open(buffer, O_RDWR | O_CREAT | O_TRUNC, 0666);
if (fd != -1) {
FILE* replay_data_file = os::open(fd, "w");
FILE* replay_data_file = os::fdopen(fd, "w");
if (replay_data_file != NULL) {
fileStream replay_data_stream(replay_data_file, /*need_close=*/true);
dump_replay_data(&replay_data_stream);
@ -1706,7 +1706,7 @@ void ciEnv::dump_inline_data(int compile_id) {
if (ret > 0) {
int fd = os::open(buffer, O_RDWR | O_CREAT | O_TRUNC, 0666);
if (fd != -1) {
FILE* inline_data_file = os::open(fd, "w");
FILE* inline_data_file = os::fdopen(fd, "w");
if (inline_data_file != NULL) {
fileStream replay_data_stream(inline_data_file, /*need_close=*/true);
GUARDED_VM_ENTRY(

View File

@ -541,7 +541,7 @@ class os: AllStatic {
// File i/o operations
static int open(const char *path, int oflag, int mode);
static FILE* open(int fd, const char* mode);
static FILE* fdopen(int fd, const char* mode);
static FILE* fopen(const char* path, const char* mode);
static int close(int fd);
static jlong lseek(int fd, jlong offset, int whence);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2020 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -1676,7 +1676,7 @@ void VMError::report_and_die(int id, const char* message, const char* detail_fmt
const bool overwrite = false; // We do not overwrite an existing replay file.
int fd = prepare_log_file(ReplayDataFile, "replay_pid%p.log", overwrite, buffer, sizeof(buffer));
if (fd != -1) {
FILE* replay_data_file = os::open(fd, "w");
FILE* replay_data_file = os::fdopen(fd, "w");
if (replay_data_file != NULL) {
fileStream replay_data_stream(replay_data_file, /*need_close=*/true);
env->dump_replay_data_unsafe(&replay_data_stream);