Skip to content

Commit dbf404a

Browse files
committed
configure: --disable-prgname-prefix
* This creates PRGNAME_PREFIX; The 'DMTCP:' prefix will be prepended to the comm field in 'ps' on restarted processes _only_ if this is enabled (default). * This is needed for the CUDA ckpt API, which uses the 'comm' field on restart
1 parent 88d7de4 commit dbf404a

File tree

4 files changed

+39
-2
lines changed

4 files changed

+39
-2
lines changed

configure

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -846,6 +846,7 @@ enable_test_suite
846846
enable_experts_only_space1
847847
enable_experts_only
848848
enable_experts_only_after
849+
enable_prgname_prefix
849850
enable_fsgsbase_override
850851
enable_m32
851852
enable_multilib
@@ -1535,6 +1536,10 @@ Optional Features:
15351536
=== **** NOTE: EXPERTS ONLY BELOW HERE **** ===
15361537
(Use at your own risk!!)
15371538
1539+
--disable-prgname-prefix
1540+
Disables 'DMTCP:' prefix of comm field in ps to
1541+
avoid incompatibility with CUDA ckp API
1542+
(Alternative: set DISABLE_PRGNAME_PREFIX env var)
15381543
--enable-fsgsbase-override
15391544
Defines HAS_FSGSBASE for cross-configure; The target
15401545
computer must have the FSGSBASE kernel patch.
@@ -8073,6 +8078,20 @@ then :
80738078
fi
80748079

80758080

8081+
# Check whether --enable-prgname-prefix was given.
8082+
if test ${enable_prgname_prefix+y}
8083+
then :
8084+
enableval=$enable_prgname_prefix; use_prgname_prefix=$enableval
8085+
else $as_nop
8086+
use_prgname_prefix=yes
8087+
fi
8088+
8089+
if test "$use_prgname_prefix" = "yes"; then
8090+
8091+
printf "%s\n" "#define ENABLE_PRGNAME_PREFIX 1" >>confdefs.h
8092+
8093+
fi
8094+
80768095
# Check whether --enable-fsgsbase-override was given.
80778096
if test ${enable_fsgsbase_override+y}
80788097
then :

configure.ac

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,19 @@ AC_ARG_ENABLE([experts_only],
229229
[], [])
230230
AC_ARG_ENABLE([experts_only_after], [AS_HELP_STRING([ ], [])], [], [])
231231

232+
AC_ARG_ENABLE([prgname-prefix],
233+
[AS_HELP_STRING([--disable-prgname-prefix],
234+
[Disables 'DMTCP:' prefix of comm field in ps
235+
to avoid incompatibility with CUDA ckp API
236+
(Alternative: set DISABLE_PRGNAME_PREFIX
237+
env var)])],
238+
[use_prgname_prefix=$enableval],
239+
[use_prgname_prefix=yes])
240+
if test "$use_prgname_prefix" = "yes"; then
241+
AC_DEFINE([ENABLE_PRGNAME_PREFIX],[1],[Enable 'DMTCP:' prefix in comm
242+
field of 'ps' (for CUDA ckpt)])
243+
fi
244+
232245
AC_ARG_ENABLE([fsgsbase-override],
233246
[AS_HELP_STRING([--enable-fsgsbase-override],
234247
[Defines HAS_FSGSBASE for cross-configure; The

include/config.h.in

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
/* Override to use FSGSBASE kernel patch */
2222
#undef ENABLE_FSGSBASE_OVERRIDE
2323

24+
/* Enable 'DMTCP:' prefix in comm field of 'ps' (for CUDA ckpt) */
25+
#undef ENABLE_PRGNAME_PREFIX
26+
2427
/* Child process does checkpointing */
2528
#undef FORKED_CHECKPOINTING
2629

@@ -51,7 +54,7 @@
5154
/* Define to 1 if you have the <inttypes.h> header file. */
5255
#undef HAVE_INTTYPES_H
5356

54-
/* Define to 1 if you have the 'atomic' library (-latomic). */
57+
/* Define to 1 if you have the `atomic' library (-latomic). */
5558
#undef HAVE_LIBATOMIC
5659

5760
/* Define to 1 if you have the <linux/version.h> header file. */
@@ -132,7 +135,7 @@
132135
/* No output, not even NOTE and WARNING */
133136
#undef QUIET
134137

135-
/* Define to 1 if all of the C89 standard headers exist (not just the ones
138+
/* Define to 1 if all of the C90 standard headers exist (not just the ones
136139
required in a freestanding environment). This macro is provided for
137140
backward compatibility; new code need not use it. */
138141
#undef STDC_HEADERS

src/threadlist.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,7 @@ stopthisthread(int signum)
659659
JASSERT(DmtcpRWLockUnlock(&threadResumeLock) == 0);
660660
} else {
661661
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11)
662+
# ifdef PRGNAME_PREFIX
662663
if (!Util::strStartsWith(curThread->procname, DMTCP_PRGNAME_PREFIX)) {
663664
// Add the "DMTCP:" prefix.
664665
string newName = string(DMTCP_PRGNAME_PREFIX) + curThread->procname;
@@ -669,6 +670,7 @@ stopthisthread(int signum)
669670
// Add a NULL at the end to make sure the string terminates in all cases
670671
curThread->procname[sizeof(curThread->procname) - 1] = '\0';
671672
}
673+
# endif
672674
JASSERT(prctl(PR_SET_NAME, curThread->procname) != -1 || errno == EINVAL)
673675
(curThread->procname) (JASSERT_ERRNO)
674676
.Text("prctl(PR_SET_NAME, ...) failed");

0 commit comments

Comments
 (0)