8160997: Solaris: deprecated <pwd.h> and <gid.h> interfaces should be replaced

Use final POSIX 1003.1c versions of getgrgid_r(), getgrnam_r(), getpwnam_r(), and getpwuid_r().

Reviewed-by: alanb, dcubed, simonis, dholmes
This commit is contained in:
Alan Burlison 2016-07-15 09:36:28 -07:00 committed by Daniel D. Daugherty
parent 56ea8e7efa
commit 1075d11550
4 changed files with 11 additions and 16 deletions
hotspot/src

@ -79,7 +79,6 @@
# include <link.h>
# include <poll.h>
# include <pthread.h>
# include <pwd.h>
# include <schedctl.h>
# include <setjmp.h>
# include <signal.h>

@ -34,16 +34,18 @@
#include "utilities/exceptions.hpp"
// put OS-includes here
# include <sys/types.h>
# include <sys/mman.h>
# include <errno.h>
# include <stdio.h>
# include <unistd.h>
# include <sys/stat.h>
# include <signal.h>
# include <pwd.h>
# include <procfs.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <errno.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/stat.h>
#include <signal.h>
#include <procfs.h>
/* For POSIX-compliant getpwuid_r on Solaris */
#define _POSIX_PTHREAD_SEMANTICS
#include <pwd.h>
static char* backing_store_file_name = NULL; // name of the backing store
// file, if successfully created.
@ -453,12 +455,8 @@ static char* get_user_name(uid_t uid) {
char* pwbuf = NEW_C_HEAP_ARRAY(char, bufsize, mtInternal);
#ifdef _GNU_SOURCE
struct passwd* p = NULL;
int result = getpwuid_r(uid, &pwent, pwbuf, (size_t)bufsize, &p);
#else // _GNU_SOURCE
struct passwd* p = getpwuid_r(uid, &pwent, pwbuf, (int)bufsize);
#endif // _GNU_SOURCE
if (p == NULL || p->pw_name == NULL || *(p->pw_name) == '\0') {
if (PrintMiscellaneous && Verbose) {

@ -74,7 +74,6 @@
# include <sys/systeminfo.h>
# include <sys/socket.h>
# include <sys/lwp.h>
# include <pwd.h>
# include <poll.h>
# include <sys/lwp.h>

@ -74,7 +74,6 @@
# include <sys/socket.h>
# include <sys/trap.h>
# include <sys/lwp.h>
# include <pwd.h>
# include <poll.h>
# include <sys/lwp.h>
# include <procfs.h> // see comment in <sys/procfs.h>