--- old/src/jdk.management/unix/native/libmanagement_ext/OperatingSystemImpl.c 2018-07-17 10:08:16.000000000 -0700 +++ new/src/jdk.management/unix/native/libmanagement_ext/OperatingSystemImpl.c 2018-07-17 10:08:16.000000000 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2018, 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 @@ -74,19 +74,9 @@ #endif /* _ALLBSD_SOURCE */ -static struct dirent* read_dir(DIR* dirp, struct dirent* entry) { -#ifdef __solaris__ - struct dirent* dbuf = readdir(dirp); - return dbuf; -#else /* __linux__ || _ALLBSD_SOURCE */ - struct dirent* p; - if (readdir_r(dirp, entry, &p) == 0) { - return p; - } else { - return NULL; - } +#if defined(_ALLBSD_SOURCE) + #define readdir64 readdir #endif -} // true = get available swap in bytes // false = get total swap in bytes @@ -432,7 +422,6 @@ return (100); #else /* solaris/linux */ DIR *dirp; - struct dirent dbuf; struct dirent* dentp; jlong fds = 0; @@ -453,7 +442,7 @@ // iterate through directory entries, skipping '.' and '..' // each entry represents an open file descriptor. - while ((dentp = read_dir(dirp, &dbuf)) != NULL) { + while ((dentp = readdir64(dirp)) != NULL) { if (isdigit(dentp->d_name[0])) { fds++; }