mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-17 17:44:40 +02:00
8203680: os::stat() on Posix platform does not need to copy input path
Reviewed-by: hseigel, dholmes
This commit is contained in:
parent
79fea6b201
commit
6f462fbc70
9 changed files with 10 additions and 56 deletions
|
@ -3737,16 +3737,6 @@ bool os::message_box(const char* title, const char* message) {
|
||||||
return buf[0] == 'y' || buf[0] == 'Y';
|
return buf[0] == 'y' || buf[0] == 'Y';
|
||||||
}
|
}
|
||||||
|
|
||||||
int os::stat(const char *path, struct stat *sbuf) {
|
|
||||||
char pathbuf[MAX_PATH];
|
|
||||||
if (strlen(path) > MAX_PATH - 1) {
|
|
||||||
errno = ENAMETOOLONG;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
os::native_path(strcpy(pathbuf, path));
|
|
||||||
return ::stat(pathbuf, sbuf);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Is a (classpath) directory empty?
|
// Is a (classpath) directory empty?
|
||||||
bool os::dir_is_empty(const char* path) {
|
bool os::dir_is_empty(const char* path) {
|
||||||
DIR *dir = NULL;
|
DIR *dir = NULL;
|
||||||
|
|
|
@ -93,10 +93,6 @@ inline int os::fsync(int fd) {
|
||||||
return ::fsync(fd);
|
return ::fsync(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline char* os::native_path(char *path) {
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline int os::ftruncate(int fd, jlong length) {
|
inline int os::ftruncate(int fd, jlong length) {
|
||||||
return ::ftruncate64(fd, length);
|
return ::ftruncate64(fd, length);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3489,16 +3489,6 @@ bool os::message_box(const char* title, const char* message) {
|
||||||
return buf[0] == 'y' || buf[0] == 'Y';
|
return buf[0] == 'y' || buf[0] == 'Y';
|
||||||
}
|
}
|
||||||
|
|
||||||
int os::stat(const char *path, struct stat *sbuf) {
|
|
||||||
char pathbuf[MAX_PATH];
|
|
||||||
if (strlen(path) > MAX_PATH - 1) {
|
|
||||||
errno = ENAMETOOLONG;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
os::native_path(strcpy(pathbuf, path));
|
|
||||||
return ::stat(pathbuf, sbuf);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline struct timespec get_mtime(const char* filename) {
|
static inline struct timespec get_mtime(const char* filename) {
|
||||||
struct stat st;
|
struct stat st;
|
||||||
int ret = os::stat(filename, &st);
|
int ret = os::stat(filename, &st);
|
||||||
|
|
|
@ -96,10 +96,6 @@ inline int os::fsync(int fd) {
|
||||||
return ::fsync(fd);
|
return ::fsync(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline char* os::native_path(char *path) {
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline int os::ftruncate(int fd, jlong length) {
|
inline int os::ftruncate(int fd, jlong length) {
|
||||||
return ::ftruncate(fd, length);
|
return ::ftruncate(fd, length);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5378,16 +5378,6 @@ bool os::message_box(const char* title, const char* message) {
|
||||||
return buf[0] == 'y' || buf[0] == 'Y';
|
return buf[0] == 'y' || buf[0] == 'Y';
|
||||||
}
|
}
|
||||||
|
|
||||||
int os::stat(const char *path, struct stat *sbuf) {
|
|
||||||
char pathbuf[MAX_PATH];
|
|
||||||
if (strlen(path) > MAX_PATH - 1) {
|
|
||||||
errno = ENAMETOOLONG;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
os::native_path(strcpy(pathbuf, path));
|
|
||||||
return ::stat(pathbuf, sbuf);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Is a (classpath) directory empty?
|
// Is a (classpath) directory empty?
|
||||||
bool os::dir_is_empty(const char* path) {
|
bool os::dir_is_empty(const char* path) {
|
||||||
DIR *dir = NULL;
|
DIR *dir = NULL;
|
||||||
|
|
|
@ -88,10 +88,6 @@ inline int os::fsync(int fd) {
|
||||||
return ::fsync(fd);
|
return ::fsync(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline char* os::native_path(char *path) {
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline int os::ftruncate(int fd, jlong length) {
|
inline int os::ftruncate(int fd, jlong length) {
|
||||||
return ::ftruncate64(fd, length);
|
return ::ftruncate64(fd, length);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1334,6 +1334,13 @@ char* os::Posix::realpath(const char* filename, char* outbuf, size_t outbuflen)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int os::stat(const char *path, struct stat *sbuf) {
|
||||||
|
return ::stat(path, sbuf);
|
||||||
|
}
|
||||||
|
|
||||||
|
char * os::native_path(char *path) {
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
// Check minimum allowable stack sizes for thread creation and to initialize
|
// Check minimum allowable stack sizes for thread creation and to initialize
|
||||||
// the java system classes, including StackOverflowError - depends on page
|
// the java system classes, including StackOverflowError - depends on page
|
||||||
|
|
|
@ -1667,16 +1667,6 @@ void* os::get_default_process_handle() {
|
||||||
return (void*)::dlopen(NULL, RTLD_LAZY);
|
return (void*)::dlopen(NULL, RTLD_LAZY);
|
||||||
}
|
}
|
||||||
|
|
||||||
int os::stat(const char *path, struct stat *sbuf) {
|
|
||||||
char pathbuf[MAX_PATH];
|
|
||||||
if (strlen(path) > MAX_PATH - 1) {
|
|
||||||
errno = ENAMETOOLONG;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
os::native_path(strcpy(pathbuf, path));
|
|
||||||
return ::stat(pathbuf, sbuf);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline time_t get_mtime(const char* filename) {
|
static inline time_t get_mtime(const char* filename) {
|
||||||
struct stat st;
|
struct stat st;
|
||||||
int ret = os::stat(filename, &st);
|
int ret = os::stat(filename, &st);
|
||||||
|
@ -4474,10 +4464,6 @@ jlong os::lseek(int fd, jlong offset, int whence) {
|
||||||
return (jlong) ::lseek64(fd, offset, whence);
|
return (jlong) ::lseek64(fd, offset, whence);
|
||||||
}
|
}
|
||||||
|
|
||||||
char * os::native_path(char *path) {
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
|
|
||||||
int os::ftruncate(int fd, jlong length) {
|
int os::ftruncate(int fd, jlong length) {
|
||||||
return ::ftruncate64(fd, length);
|
return ::ftruncate64(fd, length);
|
||||||
}
|
}
|
||||||
|
|
|
@ -558,6 +558,9 @@ class os: AllStatic {
|
||||||
static FILE* fopen(const char* path, const char* mode);
|
static FILE* fopen(const char* path, const char* mode);
|
||||||
static int close(int fd);
|
static int close(int fd);
|
||||||
static jlong lseek(int fd, jlong offset, int whence);
|
static jlong lseek(int fd, jlong offset, int whence);
|
||||||
|
// This function, on Windows, canonicalizes a given path (see os_windows.cpp for details).
|
||||||
|
// On Posix, this function is a noop: it does not change anything and just returns
|
||||||
|
// the input pointer.
|
||||||
static char* native_path(char *path);
|
static char* native_path(char *path);
|
||||||
static int ftruncate(int fd, jlong length);
|
static int ftruncate(int fd, jlong length);
|
||||||
static int fsync(int fd);
|
static int fsync(int fd);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue