Skip to content

Commit

Permalink
8341967: Unify os::current_file_offset and os::seek_to_file_offset ac…
Browse files Browse the repository at this point in the history
…ross posix platforms

Reviewed-by: jsjolen, mdoerr
  • Loading branch information
MBaesken committed Oct 14, 2024
1 parent dcac4b0 commit b20c5c7
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 30 deletions.
10 changes: 0 additions & 10 deletions src/hotspot/os/aix/os_aix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2483,16 +2483,6 @@ int os::open(const char *path, int oflag, int mode) {
return fd;
}

// return current position of file pointer
jlong os::current_file_offset(int fd) {
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)::lseek(fd, (off_t)offset, SEEK_SET);
}

// current_thread_cpu_time(bool) and thread_cpu_time(Thread*, bool)
// are used by JVM M&M and JVMTI to get user+sys or user CPU time
// of a thread.
Expand Down
10 changes: 0 additions & 10 deletions src/hotspot/os/bsd/os_bsd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2400,16 +2400,6 @@ int os::open(const char *path, int oflag, int mode) {
return fd;
}

// return current position of file pointer
jlong os::current_file_offset(int fd) {
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)::lseek(fd, (off_t)offset, SEEK_SET);
}

// current_thread_cpu_time(bool) and thread_cpu_time(Thread*, bool)
// are used by JVM M&M and JVMTI to get user+sys or user CPU time
// of a thread.
Expand Down
10 changes: 0 additions & 10 deletions src/hotspot/os/linux/os_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5053,16 +5053,6 @@ int os::open(const char *path, int oflag, int mode) {
return fd;
}

// return current position of file pointer
jlong os::current_file_offset(int fd) {
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)::lseek(fd, (off_t)offset, SEEK_SET);
}

static jlong slow_thread_cpu_time(Thread *thread, bool user_sys_cpu_time);

static jlong fast_cpu_time(Thread *thread) {
Expand Down
10 changes: 10 additions & 0 deletions src/hotspot/os/posix/os_posix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,16 @@ int os::create_file_for_heap(const char* dir) {
return fd;
}

// return current position of file pointer
jlong os::current_file_offset(int fd) {
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)::lseek(fd, (off_t)offset, SEEK_SET);
}

// Is a (classpath) directory empty?
bool os::dir_is_empty(const char* path) {
DIR *dir = nullptr;
Expand Down

0 comments on commit b20c5c7

Please sign in to comment.