Skip to content

configure: --disable-prgname-prefix#1225

Merged
gc00 merged 2 commits intomainfrom
pedantic-no-prefix
Nov 15, 2025
Merged

configure: --disable-prgname-prefix#1225
gc00 merged 2 commits intomainfrom
pedantic-no-prefix

Conversation

@gc00
Copy link
Copy Markdown
Contributor

@gc00 gc00 commented Nov 11, 2025

  • ADDED: ./configure --disable-prgname-prefix
  • PRGNAME_PREFIX macro created in config.h; The 'DMTCP:' prefix will be prepended to the comm field in 'ps' on restarted processes only if this macro is defined (default).
  • This is needed for the CUDA ckpt API, which uses the 'comm' field on restart
  • The environment variable DMTCP_DISABLE_PRGNAME_PREFIX will have the same effect.

Summary by CodeRabbit

  • New Features

    • Added a build-time option (--enable-prgname-prefix / --disable-prgname-prefix) to control applying a process-name prefix. When enabled, builds set a compile-time flag and default to enabled (use_prgname_prefix = yes). Runtime can also honor a disable signal.
  • Documentation

    • Updated configure help and docs to explain the new option, default, and an environment-variable alternative to disable the prefix at runtime.

@gc00 gc00 requested review from karya0 and xuyao0127 November 11, 2025 20:42
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Nov 11, 2025

Walkthrough

Adds a configure option --enable-prgname-prefix / --disable-prgname-prefix that controls emitting ENABLE_PRGNAME_PREFIX into generated config headers; introduces ENV_VAR_DISABLE_PRGNAME_PREFIX and conditional compile/runtime guards so the "DMTCP:" process-name prefixing in src/threadlist.cpp runs only when compiled with the macro and the env var is not set. Duplicate AC_ARG_ENABLE/AC_DEFINE insertions were added in configure.ac.

Changes

Cohort / File(s) Summary
Autoconf / configure sources
configure.ac, configure
Added --enable-prgname-prefix / --disable-prgname-prefix (default yes); sets use_prgname_prefix and emits -DENABLE_PRGNAME_PREFIX=1 into confdefs.h when enabled. Note: duplicated AC_ARG_ENABLE / AC_DEFINE insertions appear in configure.ac.
Config header template
include/config.h.in
Added #undef ENABLE_PRGNAME_PREFIX entry; updated comments for HAVE_LIBATOMIC and STDC_HEADERS.
Constants / runtime env
src/constants.h
Added ENV_VAR_DISABLE_PRGNAME_PREFIX macro defined as "DMTCP_DISABLE_PRGNAME_PREFIX".
Runtime source
src/threadlist.cpp
Included constants.h; wrapped process-name prefixing logic with #if defined(ENABLE_PRGNAME_PREFIX) && LINUX_VERSION_CODE >= 2.6.11 and added a runtime check to skip prefixing when ENV_VAR_DISABLE_PRGNAME_PREFIX is set. prctl call and related state updates remain preserved under guards.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Dev as Developer (runs configure)
  participant Configure as configure/configure.ac
  participant Build as make
  participant Compile as C++ Compiler
  participant Runtime as Process (binary)

  Dev->>Configure: run configure [--enable-prgname-prefix|--disable-prgname-prefix]
  alt enabled (default yes)
    Configure->>Configure: set use_prgname_prefix = yes
    Configure->>Configure: emit -DENABLE_PRGNAME_PREFIX=1 into confdefs.h
  else disabled
    Configure->>Configure: leave ENABLE_PRGNAME_PREFIX undefined
  end
  Configure->>Build: generate Makefiles + config headers
  Build->>Compile: compile sources (include config.h)
  alt ENABLE_PRGNAME_PREFIX defined at compile
    Compile->>Runtime: build with prefixing code included
    Note right of Runtime: runtime checks ENV_VAR_DISABLE_PRGNAME_PREFIX
    alt env var not set
      Runtime->>Runtime: apply "DMTCP:" prefix via prctl (threadlist)
    else env var set
      Runtime->>Runtime: skip prefixing
    end
  else not defined
    Compile->>Runtime: prefixing code omitted
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Inspect and remove duplicated AC_ARG_ENABLE / AC_DEFINE fragments in configure.ac.
  • Verify confdefs.h / include/config.h.in consistently expose ENABLE_PRGNAME_PREFIX.
  • Confirm ENV_VAR_DISABLE_PRGNAME_PREFIX string matches between src/constants.h and runtime checks.
  • Review src/threadlist.cpp guards (LINUX_VERSION_CODE and macro) to ensure prctl remains correctly applied where intended.

Suggested reviewers

  • karya0
  • xuyao0127

Poem

🐰 I nudged a flag into configure's den,
A tiny hop to mark when builds will prepend,
If compiled true, "DMTCP:" will peep,
Unless the env var bids it sleep,
A rabbit's tweak — both gentle and zen.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'configure: --disable-prgname-prefix' accurately describes the main feature added—a new configure option for disabling the process name prefix in DMTCP.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch pedantic-no-prefix

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/threadlist.cpp (1)

662-673: Critical: Inverted preprocessor logic breaks intended functionality.

The conditional compilation logic is inverted. When NO_DMTCP_PRGNAME_PREFIX is defined, the code currently adds the prefix, but according to the PR description and the comment in config.h.in (line 111: "Do not use 'DMTCP:' prefix"), it should skip adding the prefix.

The condition on line 662 should be #ifndef instead of #ifdef to match the intended behavior.

Apply this diff to fix the inverted logic:

-# ifdef NO_DMTCP_PRGNAME_PREFIX
+# ifndef NO_DMTCP_PRGNAME_PREFIX
       if (!Util::strStartsWith(curThread->procname, DMTCP_PRGNAME_PREFIX)) {
         // Add the "DMTCP:" prefix.
         string newName = string(DMTCP_PRGNAME_PREFIX) + curThread->procname;
🧹 Nitpick comments (2)
include/config.h.in (1)

54-54: Minor: Quote style inconsistency in comment.

The comment changed from single quotes 'atomic' to mixed quotes `atomic'. Consider using consistent quote styling throughout the file.

configure (1)

1539-1540: Tighten help text for clarity (optional)

Consider wording: “Omit the 'DMTCP:' prefix from process names shown by ps/top (defines NO_DMTCP_PRGNAME_PREFIX). Default: disabled.” This makes scope and default explicit.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 88d7de4 and c81b866.

📒 Files selected for processing (4)
  • configure (3 hunks)
  • configure.ac (1 hunks)
  • include/config.h.in (3 hunks)
  • src/threadlist.cpp (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (4)
include/config.h.in (2)

111-112: LGTM: New macro definition is correctly configured.

The new NO_DMTCP_PRGNAME_PREFIX macro is properly defined and documented for the pedantic build option. The comment clearly describes its purpose for CUDA checkpoint scenarios.


138-141: LGTM: Updated standard reference.

The change from C89 to C90 is accurate—both refer to the same ANSI C standard, but C90 is the more commonly used designation.

configure (1)

849-849: Option recognized by parser — looks good

enable_pedantic is correctly registered in the option parser list. No issues.

configure.ac (1)

232-241: --enable-pedantic handling looks solid.

Help text, default, and AC_DEFINE wiring are consistent with the rest of the configure script. No issues spotted.

@xuyao0127
Copy link
Copy Markdown
Collaborator

@gc00 Should we make this configuration at compile time or runtime, like using a environment variable?

@gc00 gc00 force-pushed the pedantic-no-prefix branch from c81b866 to f2ce01f Compare November 13, 2025 18:22
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (1)
configure (1)

8079-8092: Define wiring OK; verify negative-sense usage and header placeholder

The define injection is correct. Please verify across the tree that:

  • include/config.h.in contains #undef NO_DMTCP_PRGNAME_PREFIX.
  • Call sites only add the "DMTCP:" prefix when the macro is NOT defined.

Optionally, add a runtime escape hatch (env var) to override compile-time behavior if needed per reviewer feedback.

Run from repo root:

#!/usr/bin/env bash
set -euo pipefail

echo "1) Placeholder in config.h.in"
rg -n --hidden --no-ignore -C2 '\bNO_DMTCP_PRGNAME_PREFIX\b' include/config.h.in || {
  echo "Missing #undef NO_DMTCP_PRGNAME_PREFIX in include/config.h.in"; exit 1; }

echo "2) Usage sense in src/"
rg -n -C3 '(NO_DMTCP_PRGNAME_PREFIX|DMTCP[_A-Z]*PRGNAME[_A-Z]*PREFIX|DMTCP:)' src include || true
🧹 Nitpick comments (1)
configure (1)

1539-1541: Clarify flag name/help; consider alias and runtime override

“pedantic” doesn’t convey “suppress DMTCP: prefix”. Suggest:

  • Rename or add alias: --disable-prgname-prefix (preferred UX).
  • Expand help text to say “omit 'DMTCP:' from process comm (ps(1))” and mention CUDA use-case.
  • Optionally support an env var override (e.g., DMTCP_NO_PRGNAME_PREFIX=1) to allow runtime control without rebuilds.

These are source changes in configure.ac; the generated configure will follow.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c81b866 and f2ce01f.

📒 Files selected for processing (4)
  • configure (3 hunks)
  • configure.ac (1 hunks)
  • include/config.h.in (3 hunks)
  • src/threadlist.cpp (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • include/config.h.in
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (3)
src/threadlist.cpp (1)

662-673: Conditional compilation is correctly implemented—no additional changes needed.

The #ifndef NO_DMTCP_PRGNAME_PREFIX guard at lines 662-673 properly excludes the prefix-addition logic when the macro is defined. Verification confirms that DMTCP_PRGNAME_PREFIX is defined only once (line 56) and referenced only in lines 663 and 665, both within the conditional block. The prctl(PR_SET_NAME) call at line 674 will execute with the original (unprefixed) procname when the flag is set, which is the intended behavior.

configure.ac (1)

232-241: The option name "pedantic" is misleading, but the design choice merits clarification rather than revision.

The review correctly identifies that "pedantic" doesn't convey the option's actual purpose. However, examining the codebase reveals this is an intentional design choice consistent with DMTCP's build system:

  1. Naming concern is valid: The option controls CUDA checkpoint compatibility (whether to suppress the "DMTCP:" prefix in process names). The term "pedantic" obscures this purpose.

  2. Compile-time vs runtime is a valid discussion point: DMTCP extensively uses runtime environment variables (DMTCP_TMPDIR, DMTCP_RESTART_PAUSE, DMTCP_GDB_ATTACH_ON_RESTART, etc.), so the suggestion to support runtime configuration via an env var has merit. However, all AC_ARG_ENABLE options in configure.ac are compile-time toggles, making the current approach consistent.

  3. Placement is deliberate: The option is in the "EXPERTS ONLY" section, suggesting specialized use. This explains the non-obvious naming—it's not meant for general users.

The review's suggestions to rename it or support runtime configuration are reasonable improvements but represent design preferences rather than functional issues. The current implementation is correct and follows the project's established patterns.

configure (1)

849-849: Option registered with parser — looks good

enable_pedantic is correctly added to the recognized options set, avoiding failures with enable_option_checking=fatal.

@gc00 gc00 force-pushed the pedantic-no-prefix branch from f2ce01f to dbf404a Compare November 13, 2025 19:43
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/threadlist.cpp (1)

662-673: Critical: Macro name mismatch prevents feature from working.

The conditional compilation checks for PRGNAME_PREFIX (line 662), but configure.ac defines ENABLE_PRGNAME_PREFIX (line 241). This mismatch means the prefixing code will never be compiled, even when --enable-prgname-prefix is used.

Apply this diff to fix the macro name:

-# ifdef PRGNAME_PREFIX
+# ifdef ENABLE_PRGNAME_PREFIX
       if (!Util::strStartsWith(curThread->procname, DMTCP_PRGNAME_PREFIX)) {
         // Add the "DMTCP:" prefix.
         string newName = string(DMTCP_PRGNAME_PREFIX) + curThread->procname;
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f2ce01f and dbf404a.

📒 Files selected for processing (4)
  • configure (3 hunks)
  • configure.ac (1 hunks)
  • include/config.h.in (3 hunks)
  • src/threadlist.cpp (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • include/config.h.in
  • configure
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (1)
configure.ac (1)

232-243: Note: PR title and description are inconsistent with implementation.

The PR title mentions --enable-pedantic, but the actual change implements --enable-prgname-prefix. Additionally, the PR description states "defines NO_DMTCP_PRGNAME_PREFIX" but the code defines ENABLE_PRGNAME_PREFIX. Please update the PR title and description to accurately reflect the implementation.

@gc00 gc00 force-pushed the pedantic-no-prefix branch from dbf404a to 805ae9f Compare November 13, 2025 19:47
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
configure.ac (1)

236-237: Environment variable reference already flagged.

This has already been identified in a previous review comment. The help text mentions DMTCP_DISABLE_PRGNAME_PREFIX as an environment variable alternative, but no runtime environment variable handling is implemented.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 805ae9f and b9f9aaf.

📒 Files selected for processing (2)
  • configure (3 hunks)
  • configure.ac (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • configure

@gc00 gc00 force-pushed the pedantic-no-prefix branch 2 times, most recently from 44aacf4 to cde4510 Compare November 13, 2025 20:27
@gc00
Copy link
Copy Markdown
Contributor Author

gc00 commented Nov 13, 2025

@xuyao0127 , I changed this PR as we agreed: --disable-prgname-prefix and env. var. DMTCP_DISABLE_PRGNAME_PREFIX now exist.

Could you review this again? Thanks.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/threadlist.cpp (1)

635-685: Bug: env-var guard breaks restart path when prefix is disabled

The change from:

if (!restoreInProgress) {
  ...
} else {
  ...
  JASSERT(Thread_UpdateState(curThread, ST_RUNNING, ST_SUSPENDED));
  ThreadList::waitForAllRestored(curThread);
}

to:

if (!restoreInProgress) {
  ...
} else if (getenv(ENV_VAR_DISABLE_PRGNAME_PREFIX) == NULL) {
  ...
  JASSERT(Thread_UpdateState(curThread, ST_RUNNING, ST_SUSPENDED));
  ThreadList::waitForAllRestored(curThread);
}

means that when restoreInProgress is true and DMTCP_DISABLE_PRGNAME_PREFIX is set, the whole else if block is skipped:

  • Thread_UpdateState(curThread, ST_RUNNING, ST_SUSPENDED) is never called.
  • ThreadList::waitForAllRestored(curThread) is never called.

That changes the core restart protocol for threads that happen to run with the env var set, not just the process-name prefixing behavior, and is very likely incorrect/unstable.

The env-var should guard only the prefixing logic, not the whole “restore” branch. A minimal fix is to restore the original else and move the env-var test inside the Linux/feature guard:

-    if (!restoreInProgress) {
+    if (!restoreInProgress) {
       ...
-      JASSERT(DmtcpRWLockUnlock(&threadResumeLock) == 0);
-    } else if (getenv(ENV_VAR_DISABLE_PRGNAME_PREFIX) == NULL) {
-      // If the user defined DMTCP_DISABLE_PRGNAME_PREFIX, skip this prefix.
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11)
-# ifdef ENABLE_PRGNAME_PREFIX
-      if (!Util::strStartsWith(curThread->procname, DMTCP_PRGNAME_PREFIX)) {
-        ...
-      }
-# endif
-      JASSERT(prctl(PR_SET_NAME, curThread->procname) != -1 || errno == EINVAL)
-        (curThread->procname) (JASSERT_ERRNO)
-      .Text("prctl(PR_SET_NAME, ...) failed");
-#endif  // if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11)
-      JASSERT(Thread_UpdateState(curThread, ST_RUNNING, ST_SUSPENDED));
-      /* Else restoreinprog >= 1;  This stuff executes to do a restart */
-      ThreadList::waitForAllRestored(curThread);
-    }
+      JASSERT(DmtcpRWLockUnlock(&threadResumeLock) == 0);
+    } else {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11)
+# ifdef ENABLE_PRGNAME_PREFIX
+      if (getenv(ENV_VAR_DISABLE_PRGNAME_PREFIX) == NULL &&
+          !Util::strStartsWith(curThread->procname, DMTCP_PRGNAME_PREFIX)) {
+        // Add the "DMTCP:" prefix.
+        string newName = string(DMTCP_PRGNAME_PREFIX) + curThread->procname;
+        strncpy(curThread->procname, newName.c_str(),
+                sizeof(curThread->procname));
+        curThread->procname[sizeof(curThread->procname) - 1] = '\0';
+      }
+# endif
+      JASSERT(prctl(PR_SET_NAME, curThread->procname) != -1 || errno == EINVAL)
+        (curThread->procname) (JASSERT_ERRNO)
+        .Text("prctl(PR_SET_NAME, ...) failed");
+#endif  // if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11)
+
+      JASSERT(Thread_UpdateState(curThread, ST_RUNNING, ST_SUSPENDED));
+      /* Else restoreinprog >= 1;  This stuff executes to do a restart */
+      ThreadList::waitForAllRestored(curThread);
+    }

This keeps the restart handshake intact for all cases while still allowing both compile‑time (ENABLE_PRGNAME_PREFIX) and runtime (DMTCP_DISABLE_PRGNAME_PREFIX) control over the prefixing.

🧹 Nitpick comments (3)
src/constants.h (1)

107-112: Consider whether the new env var should be “protected”

ENV_VAR_DISABLE_PRGNAME_PREFIX is added but not included in ENV_VARS_ALL, which is supposed to track all “protected” DMTCP env vars. Please double‑check whether this variable should:

  • be preserved/propagated the same way as other DMTCP_* env vars (in which case it likely belongs in ENV_VARS_ALL), or
  • remain user‑only and not be treated as protected.

If you intend it to control behavior across restarts and child processes, adding it to ENV_VARS_ALL may be appropriate.

src/threadlist.cpp (1)

57-58: Optional: guard DMTCP_PRGNAME_PREFIX with the feature macro

When ENABLE_PRGNAME_PREFIX is not defined (compile‑time prefix disabled), the global:

static const char *DMTCP_PRGNAME_PREFIX = "DMTCP:";

becomes unused. Depending on your compiler flags (especially with pedantic / -Wextra / -Werror), this may trigger unused-variable warnings.

To avoid that, you could wrap the definition:

- static const char *DMTCP_PRGNAME_PREFIX = "DMTCP:";
+ #ifdef ENABLE_PRGNAME_PREFIX
+ static const char *DMTCP_PRGNAME_PREFIX = "DMTCP:";
+ #endif

Not mandatory, but it keeps pedantic builds quieter.

configure (1)

1539-1544: Help text is clear; consider also mentioning the enable alias.

You list --disable-prgname-prefix and the env var. For completeness, consider noting that --enable-prgname-prefix is the counterpart and is enabled by default. This avoids ambiguity in ./configure --help.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b9f9aaf and cde4510.

📒 Files selected for processing (5)
  • configure (3 hunks)
  • configure.ac (1 hunks)
  • include/config.h.in (3 hunks)
  • src/constants.h (1 hunks)
  • src/threadlist.cpp (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • configure.ac
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (6)
include/config.h.in (3)

24-26: New feature macro wiring looks consistent

Introducing ENABLE_PRGNAME_PREFIX here matches the usage pattern elsewhere (#ifdef ENABLE_PRGNAME_PREFIX), so the autotools flow should propagate this flag cleanly. No issues from this file’s side.


57-58: Doc tweak for atomic library is fine

Using backticks around atomic clarifies that it refers to the library name; no functional impact.


138-141: STDC_HEADERS comment clarification is reasonable

The updated wording about C90 and backward compatibility is clearer and still matches how autotools uses STDC_HEADERS. Nothing else needed here.

src/threadlist.cpp (1)

16-16: Including constants.h here is appropriate

Pulling in constants.h to use ENV_VAR_DISABLE_PRGNAME_PREFIX is consistent with how other env‑var constants are handled. No concerns.

configure (2)

849-856: Option registered correctly (default “on”).

Adding enable_prgname_prefix to ac_user_opts is consistent with using --enable/--disable flags and matches the desired default behavior.


8082-8095: All verification checks passed; macro gating and runtime integration are correct.

#undef ENABLE_PRGNAME_PREFIX placeholder present in include/config.h.in:25
✓ No references to old NO_DMTCP_PRGNAME_PREFIX macro
ENV_VAR_DISABLE_PRGNAME_PREFIX constant defined in src/constants.h:110
✓ Runtime logic in src/threadlist.cpp:661–667 correctly checks env var and applies #ifdef ENABLE_PRGNAME_PREFIX guard

Positive-sense semantics are consistent throughout: enabled by default, disabled only when DMTCP_DISABLE_PRGNAME_PREFIX is set.

@gc00 gc00 force-pushed the pedantic-no-prefix branch from cde4510 to 204d9ae Compare November 13, 2025 20:46
@gc00 gc00 changed the title configure: --enable-pedantic configure: --disable-prgname-prefix Nov 13, 2025
fi


# Check whether --enable-prgname-prefix was given.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In line 1539 you defined --disable-prgname-prefix, but here you are checking --enable-prgname-prefix. Is this the correct logic?

@gc00 gc00 force-pushed the pedantic-no-prefix branch from 204d9ae to de8932d Compare November 14, 2025 15:13
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
configure (1)

1539-1543: Polish help text for clarity (default + env var usage).

  • State default explicitly, e.g., “Default: enabled.”
  • Show env var usage form, e.g., DMTCP_DISABLE_PRGNAME_PREFIX=1 dmtcp_launch ….
    This reduces ambiguity for users skimming --help.
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 204d9ae and de8932d.

📒 Files selected for processing (5)
  • configure (3 hunks)
  • configure.ac (1 hunks)
  • include/config.h.in (3 hunks)
  • src/constants.h (1 hunks)
  • src/threadlist.cpp (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/threadlist.cpp
  • src/constants.h
  • configure.ac
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (3)
include/config.h.in (1)

24-26: LGTM! Default behavior verified as correct.

The ENABLE_PRGNAME_PREFIX macro is properly configured to be enabled by default. The configure.ac sets use_prgname_prefix=yes as the default, and the macro is defined when this condition is true. Users can disable it with --disable-prgname-prefix as intended.

configure (2)

849-849: Option recognized by parser — looks good.

Adding enable_prgname_prefix to ac_user_opts ensures --disable-prgname-prefix is accepted and sets enable_prgname_prefix=no per Autoconf semantics.


8082-8094: Verification complete; all requirements satisfied.

The implementation is correct:

  • ✓ Placeholder #undef ENABLE_PRGNAME_PREFIX present in include/config.h.in
  • ✓ Call sites gate on #ifdef ENABLE_PRGNAME_PREFIX (src/threadlist.cpp:664)
  • ✓ Runtime check for DMTCP_DISABLE_PRGNAME_PREFIX env var implemented (src/threadlist.cpp:665)
  • ✓ No stale negative-sense macro found

Copy link
Copy Markdown
Collaborator

@xuyao0127 xuyao0127 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gc00 gc00 force-pushed the pedantic-no-prefix branch 2 times, most recently from 66233b1 to 771babe Compare November 15, 2025 17:01
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
configure.ac (1)

232-244: Configure option and macro definition for PRGNAME prefix look correct; help text could be a bit clearer.

  • The AC_ARG_ENABLE([prgname-prefix]) block with default use_prgname_prefix=yes and the AC_DEFINE([ENABLE_PRGNAME_PREFIX], ...) guard are consistent with the new ENABLE_PRGNAME_PREFIX macro in include/config.h.in and the intended behavior.
  • Referencing DMTCP_DISABLE_PRGNAME_PREFIX in the help text aligns with the runtime env-var mechanism added elsewhere in the PR.

If you want to polish the UX, consider tweaking the help string to explicitly say this is a compile-time toggle (--enable/--disable-prgname-prefix, default enabled) and that DMTCP_DISABLE_PRGNAME_PREFIX is the runtime alternative, so the distinction is obvious from ./configure --help.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between de8932d and 66233b1.

📒 Files selected for processing (5)
  • configure (3 hunks)
  • configure.ac (1 hunks)
  • include/config.h.in (3 hunks)
  • src/constants.h (1 hunks)
  • src/threadlist.cpp (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/threadlist.cpp
  • configure
  • src/constants.h
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (3)
include/config.h.in (3)

24-26: ENABLE_PRGNAME_PREFIX macro wiring looks consistent.

The new ENABLE_PRGNAME_PREFIX entry matches the autoconf definition in configure.ac and clearly documents the feature; no issues here.


57-58: HAVE_LIBATOMIC comment is clear and accurate.

The updated wording for HAVE_LIBATOMIC correctly describes the -latomic dependency and is consistent with its usage later in configure.ac.


138-141: STDC_HEADERS comment clarification is fine.

Updating the description to reference C90 and note backward compatibility is purely documentation and improves precision without affecting behavior.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
include/config.h.in (1)

24-26: Clarify the comment to explain the feature's relationship to CUDA checkpoint.

The comment "(for CUDA ckpt)" is ambiguous. Based on the PR description, CUDA checkpoint API requires the comm field without the prefix, which is why the disable option was added. Consider revising to clarify:

-/* Enable 'DMTCP:' prefix in comm field of 'ps' (for CUDA ckpt) */
+/* Enable 'DMTCP:' prefix in comm field of 'ps'. Disable for CUDA ckpt API. */

Or more explicitly:

-/* Enable 'DMTCP:' prefix in comm field of 'ps' (for CUDA ckpt) */
+/* Enable 'DMTCP:' prefix in comm field shown by 'ps' (enabled by default; use --disable-prgname-prefix or DMTCP_DISABLE_PRGNAME_PREFIX for CUDA ckpt) */
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 66233b1 and 771babe.

📒 Files selected for processing (5)
  • configure (3 hunks)
  • configure.ac (1 hunks)
  • include/config.h.in (3 hunks)
  • src/constants.h (1 hunks)
  • src/threadlist.cpp (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • src/threadlist.cpp
  • configure
  • src/constants.h
  • configure.ac
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (2)
include/config.h.in (2)

57-57: Incidental formatting change from autoheader regeneration.

The backticks around 'atomic' appear to be from regenerating this file with autoheader, rather than a manual change for this PR. This is expected for auto-generated files.


138-141: Incidental documentation improvement from autoheader regeneration.

The updated comment (C89→C90 and backward compatibility note) reflects changes in modern autoconf/autoheader versions. This is expected when regenerating config.h.in and is unrelated to the PR's prgname-prefix feature.

gc00 added 2 commits November 15, 2025 12:25
  * PRGNAME_PREFIX macro created in config.h; The 'DMTCP:' prefix will
    be prepended to the comm field in 'ps' on restarted processes _only_
    if this macro is defined (default).
  * This is needed for the CUDA ckpt API, which uses the 'comm' field
    on restart
  * This has the same effect as:  ./configure --disable-prgname-prefix
@gc00 gc00 force-pushed the pedantic-no-prefix branch from 771babe to 3c005f5 Compare November 15, 2025 17:26
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
configure (1)

1539-1543: Help text okay; minor UX polish suggestion.

The disable help reads well. Consider clarifying the env var usage, e.g., “set DMTCP_DISABLE_PRGNAME_PREFIX=1” to make the expected value explicit.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 771babe and 3c005f5.

📒 Files selected for processing (5)
  • configure (3 hunks)
  • configure.ac (1 hunks)
  • include/config.h.in (3 hunks)
  • src/constants.h (1 hunks)
  • src/threadlist.cpp (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/constants.h
  • src/threadlist.cpp
  • include/config.h.in
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (3)
configure (2)

849-849: Option registered correctly; supports both --enable/--disable forms.

Adding enable_prgname_prefix to ac_user_opts lets Autoconf accept --disable-prgname-prefix by setting enable_prgname_prefix=no, and --enable-prgname-prefix[=yes/no] likewise. LGTM.


8082-8095: Header placeholder and macro usage verified correctly.

All verification points passed:

  • #undef ENABLE_PRGNAME_PREFIX present in include/config.h.in (line 25)
  • Call site correctly uses #ifdef ENABLE_PRGNAME_PREFIX in src/threadlist.cpp (line 664)
  • Runtime gate properly checks ENV_VAR_DISABLE_PRGNAME_PREFIX environment variable (src/threadlist.cpp:665, src/constants.h:110)
  • No stale macro name references found
  • No problematic numeric #if ENABLE_PRGNAME_PREFIX checks present

The implementation is consistent and ready.

configure.ac (1)

232-243: Configure knob matches runtime escape hatch.

The new --disable-prgname-prefix option cleanly mirrors the DMTCP_DISABLE_PRGNAME_PREFIX runtime toggle and follows the existing Autoconf patterns. Looks good to me.

@gc00 gc00 merged commit abb1cfc into main Nov 15, 2025
2 checks passed
@gc00 gc00 deleted the pedantic-no-prefix branch November 15, 2025 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants