Skip to content

Commit f1d8236

Browse files
authored
Merge pull request #3073 from naughtont3/tjn-br2x-orteclean
orte-clean: fix bad username/uid usage, add orte-dvm
2 parents f605f6c + 246f221 commit f1d8236

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

config/opal_check_ps.m4

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ dnl All rights reserved.
1313
dnl Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved.
1414
dnl Copyright (c) 2008 Cisco Systems, Inc. All rights reserved.
1515
dnl Copyright (c) 2014 Intel, Inc. All rights reserved.
16+
dnl Copyright (c) 2017 UT-Battelle, LLC. All rights reserved.
1617
dnl $COPYRIGHT$
1718
dnl
1819
dnl Additional copyrights may follow
@@ -30,11 +31,11 @@ PS_FLAVOR="unknown"
3031
ps -A -o fname > /dev/null 2>&1
3132

3233
if test "$?" = "0"; then
33-
PS_FLAVOR="ps -A -o fname,pid,user"
34+
PS_FLAVOR="ps -A -o fname,pid,uid"
3435
else
3536
ps -A -o command > /dev/null 2>&1
3637
if test "$?" = "0"; then
37-
PS_FLAVOR="ps -A -o command,pid,user"
38+
PS_FLAVOR="ps -A -o command,pid,uid"
3839
fi
3940
fi
4041
AC_MSG_RESULT([$PS_FLAVOR])

orte/tools/orte-clean/orte-clean.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
* Copyright (c) 2015 Research Organization for Information Science
1717
* and Technology (RIST). All rights reserved.
1818
* Copyright (c) 2015 Intel, Inc. All rights reserved.
19+
* Copyright (c) 2017 UT-Battelle, LLC. All rights reserved.
1920
* $COPYRIGHT$
2021
*
2122
* Additional copyrights may follow
@@ -247,12 +248,10 @@ void kill_procs(void) {
247248
* This is the command that is used to get the information about
248249
* all the processes that are running. The output looks like the
249250
* following:
250-
* COMMAND PID USER
251-
* tcsh 12556 rolfv
252-
* ps 14424 rolfv
251+
* COMMAND PID UID
252+
* tcsh 12556 1000
253+
* ps 14424 1000
253254
* etc.
254-
* Currently, we do not make use of the USER field, but we may later
255-
* on so we grab it also.
256255
*/
257256

258257
/*
@@ -273,7 +272,7 @@ void kill_procs(void) {
273272
*/
274273
ortedpid = getppid();
275274

276-
/* get the name of the user */
275+
/* get the userid of the user */
277276
uid = getuid();
278277
asprintf(&this_user, "%d", uid);
279278

@@ -294,8 +293,7 @@ void kill_procs(void) {
294293
psfile = popen(command, "r");
295294
/*
296295
* Read the first line of the output. We just throw it away
297-
* as it is the header consisting of the words COMMAND, PID and
298-
* USER.
296+
* as it is the header consisting of the words COMMAND, PID and UID.
299297
*/
300298
if (NULL == (inputline = orte_getline(psfile))) {
301299
free(this_user);
@@ -319,7 +317,7 @@ void kill_procs(void) {
319317
/* If the user is not us, and the user is not root, then skip
320318
* further checking. If the user is root, then continue on as
321319
* we want root to kill off everybody. */
322-
if ((0 != strcmp(user, this_user)) && (0 != strcmp("root", this_user))) {
320+
if ((0 != strcmp(user, this_user)) && (0 != strcmp("0", this_user))) {
323321
/* not us */
324322
free(inputline);
325323
continue;
@@ -343,11 +341,13 @@ void kill_procs(void) {
343341
* proc is sometimes reported that way
344342
*/
345343
if (0 == strncmp("orted", procname, strlen("orted")) ||
346-
0 == strncmp("(orted)", procname, strlen("(orted)"))) {
344+
0 == strncmp("(orted)", procname, strlen("(orted)")) ||
345+
0 == strncmp("orte-dvm", procname, strlen("orte-dvm")) ||
346+
0 == strncmp("(orte-dvm)", procname, strlen("(orte-dvm)"))) {
347347
if (procpid != ortedpid) {
348348
if (orte_clean_globals.verbose) {
349349
fprintf(stderr, "orte-clean: found potential rogue orted process"
350-
" (pid=%d,user=%s), sending SIGKILL...\n",
350+
" (pid=%d,uid=%s), sending SIGKILL...\n",
351351
procpid, user);
352352
}
353353
/*
@@ -369,7 +369,7 @@ void kill_procs(void) {
369369
if (procpid != ortedpid) {
370370
if (orte_clean_globals.verbose) {
371371
fprintf(stderr, "orte-clean: found potential rogue orterun process"
372-
" (pid=%d,user=%s), sending SIGKILL...\n",
372+
" (pid=%d,uid=%s), sending SIGKILL...\n",
373373
procpid, user);
374374

375375
}

0 commit comments

Comments
 (0)