Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions config/opal_check_ps.m4
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ dnl All rights reserved.
dnl Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved.
dnl Copyright (c) 2008 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2014 Intel, Inc. All rights reserved.
dnl Copyright (c) 2017 UT-Battelle, LLC. All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
Expand All @@ -30,11 +31,11 @@ PS_FLAVOR="unknown"
ps -A -o fname > /dev/null 2>&1

if test "$?" = "0"; then
PS_FLAVOR="ps -A -o fname,pid,user"
PS_FLAVOR="ps -A -o fname,pid,uid"
else
ps -A -o command > /dev/null 2>&1
if test "$?" = "0"; then
PS_FLAVOR="ps -A -o command,pid,user"
PS_FLAVOR="ps -A -o command,pid,uid"
fi
fi
AC_MSG_RESULT([$PS_FLAVOR])
Expand Down
24 changes: 12 additions & 12 deletions orte/tools/orte-clean/orte-clean.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2015 Intel, Inc. All rights reserved.
* Copyright (c) 2017 UT-Battelle, LLC. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -247,12 +248,10 @@ void kill_procs(void) {
* This is the command that is used to get the information about
* all the processes that are running. The output looks like the
* following:
* COMMAND PID USER
* tcsh 12556 rolfv
* ps 14424 rolfv
* COMMAND PID UID
* tcsh 12556 1000
* ps 14424 1000
* etc.
* Currently, we do not make use of the USER field, but we may later
* on so we grab it also.
*/

/*
Expand All @@ -273,7 +272,7 @@ void kill_procs(void) {
*/
ortedpid = getppid();

/* get the name of the user */
/* get the userid of the user */
uid = getuid();
asprintf(&this_user, "%d", uid);

Expand All @@ -294,8 +293,7 @@ void kill_procs(void) {
psfile = popen(command, "r");
/*
* Read the first line of the output. We just throw it away
* as it is the header consisting of the words COMMAND, PID and
* USER.
* as it is the header consisting of the words COMMAND, PID and UID.
*/
if (NULL == (inputline = orte_getline(psfile))) {
free(this_user);
Expand All @@ -319,7 +317,7 @@ void kill_procs(void) {
/* If the user is not us, and the user is not root, then skip
* further checking. If the user is root, then continue on as
* we want root to kill off everybody. */
if ((0 != strcmp(user, this_user)) && (0 != strcmp("root", this_user))) {
if ((0 != strcmp(user, this_user)) && (0 != strcmp("0", this_user))) {
/* not us */
free(inputline);
continue;
Expand All @@ -343,11 +341,13 @@ void kill_procs(void) {
* proc is sometimes reported that way
*/
if (0 == strncmp("orted", procname, strlen("orted")) ||
0 == strncmp("(orted)", procname, strlen("(orted)"))) {
0 == strncmp("(orted)", procname, strlen("(orted)")) ||
0 == strncmp("orte-dvm", procname, strlen("orte-dvm")) ||
0 == strncmp("(orte-dvm)", procname, strlen("(orte-dvm)"))) {
if (procpid != ortedpid) {
if (orte_clean_globals.verbose) {
fprintf(stderr, "orte-clean: found potential rogue orted process"
" (pid=%d,user=%s), sending SIGKILL...\n",
" (pid=%d,uid=%s), sending SIGKILL...\n",
procpid, user);
}
/*
Expand All @@ -369,7 +369,7 @@ void kill_procs(void) {
if (procpid != ortedpid) {
if (orte_clean_globals.verbose) {
fprintf(stderr, "orte-clean: found potential rogue orterun process"
" (pid=%d,user=%s), sending SIGKILL...\n",
" (pid=%d,uid=%s), sending SIGKILL...\n",
procpid, user);

}
Expand Down