< prev index next >

src/java.base/unix/native/libjava/ProcessHandleImpl_unix.c

Print this page
rev 59383 : [mq]: final

*** 1,7 **** /* ! * Copyright (c) 2014, 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 * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 2014, 2020, 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 * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 43,66 **** #include <limits.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/wait.h> - /* For POSIX-compliant getpwuid_r on Solaris */ - #if defined(__solaris__) - #define _POSIX_PTHREAD_SEMANTICS - #endif #include <pwd.h> - #ifdef _AIX - #include <sys/procfs.h> - #endif - #ifdef __solaris__ - #include <procfs.h> - #endif - #if defined(_AIX) #define DIR DIR64 #define dirent dirent64 #define opendir opendir64 #define readdir readdir64 #define closedir closedir64 --- 43,56 ---- #include <limits.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/wait.h> #include <pwd.h> #if defined(_AIX) + #include <sys/procfs.h> #define DIR DIR64 #define dirent dirent64 #define opendir opendir64 #define readdir readdir64 #define closedir closedir64
*** 136,157 **** #ifndef WTERMSIG #define WTERMSIG(status) ((status)&0x7F) #endif - #ifdef __solaris__ /* The child exited because of a signal. * The best value to return is 0x80 + signal number, * because that is what all Unix shells do, and because * it allows callers to distinguish between process exit and * process death by signal. ! * Unfortunately, the historical behavior on Solaris is to return ! * the signal number, and we preserve this for compatibility. */ ! #define WTERMSIG_RETURN(status) WTERMSIG(status) ! #else #define WTERMSIG_RETURN(status) (WTERMSIG(status) + 0x80) - #endif #define RESTARTABLE(_cmd, _result) do { \ do { \ _result = _cmd; \ } while((_result == -1) && (errno == EINTR)); \ --- 126,142 ---- #ifndef WTERMSIG #define WTERMSIG(status) ((status)&0x7F) #endif /* The child exited because of a signal. * The best value to return is 0x80 + signal number, * because that is what all Unix shells do, and because * it allows callers to distinguish between process exit and * process death by signal. ! */ #define WTERMSIG_RETURN(status) (WTERMSIG(status) + 0x80) #define RESTARTABLE(_cmd, _result) do { \ do { \ _result = _cmd; \ } while((_result == -1) && (errno == EINTR)); \
*** 501,511 **** /* * The following functions are common on Solaris, Linux and AIX. */ ! #if defined(__solaris__) || defined (__linux__) || defined(_AIX) /* * Returns the children of the requested pid and optionally each parent and * start time. * Reads /proc and accumulates any process who parent pid matches. --- 486,496 ---- /* * The following functions are common on Solaris, Linux and AIX. */ ! #if defined (__linux__) || defined(_AIX) /* * Returns the children of the requested pid and optionally each parent and * start time. * Reads /proc and accumulates any process who parent pid matches.
*** 620,636 **** closedir(dir); // If more pids than array had size for; count will be greater than array size return count; } ! #endif // defined(__solaris__) || defined (__linux__) || defined(_AIX) /* ! * The following functions are common on Solaris and AIX. */ ! #if defined(__solaris__) || defined(_AIX) /** * Helper function to get the 'psinfo_t' data from "/proc/%d/psinfo". * Returns 0 on success and -1 on error. */ --- 605,621 ---- closedir(dir); // If more pids than array had size for; count will be greater than array size return count; } ! #endif // defined (__linux__) || defined(_AIX) /* ! * The following functions are for AIX. */ ! #if defined(_AIX) /** * Helper function to get the 'psinfo_t' data from "/proc/%d/psinfo". * Returns 0 on success and -1 on error. */
*** 690,712 **** char prargs[PRARGSZ + 1]; jstring cmdexe = NULL; int ret; /* - * On Solaris, the full path to the executable command is the link in - * /proc/<pid>/paths/a.out. But it is only readable for processes we own. - */ - #if defined(__solaris__) - snprintf(fn, sizeof fn, "/proc/%d/path/a.out", pid); - if ((ret = readlink(fn, exePath, PATH_MAX - 1)) > 0) { - // null terminate and create String to store for command - exePath[ret] = '\0'; - CHECK_NULL(cmdexe = JNU_NewStringPlatform(env, exePath)); - } - #endif - - /* * Now try to open /proc/%d/psinfo */ if (getPsinfo(pid, &psinfo) < 0) { unix_fillArgArray(env, jinfo, 0, NULL, NULL, cmdexe, NULL); return; --- 675,684 ----
*** 731,736 **** } unix_fillArgArray(env, jinfo, 0, NULL, NULL, cmdexe, prargs[0] == '\0' ? NULL : prargs); } ! #endif // defined(__solaris__) || defined(_AIX) --- 703,708 ---- } unix_fillArgArray(env, jinfo, 0, NULL, NULL, cmdexe, prargs[0] == '\0' ? NULL : prargs); } ! #endif // defined(_AIX)
< prev index next >