@@ -218,18 +218,9 @@ bool write_status(int fd, int result) {
218218#endif
219219}
220220
221- // CRIU verbosity flag. Defaults to "-v1" (warnings + errors) instead of the
222- // previous hard-coded "-v4": the verbose debug log is written while the target
223- // process (and its GPU) are frozen, so trimming it shortens the freeze window.
224- // Override with LUPINE_SNAPSHOT_CRIU_VERBOSITY (0-4) when debugging failures.
225- std::string criu_verbosity_flag () {
226- const char *level = getenv (" LUPINE_SNAPSHOT_CRIU_VERBOSITY" );
227- char value = (level != nullptr && level[0 ] >= ' 0' && level[0 ] <= ' 4' &&
228- level[1 ] == ' \0 ' )
229- ? level[0 ]
230- : ' 1' ;
231- return std::string (" -v" ) + value;
232- }
221+ // CRIU log verbosity: warnings + errors only. The verbose log is written while
222+ // the target (and its GPU) are frozen, so keep it minimal.
223+ static const char *kCriuVerbosity = " -v1" ;
233224
234225int run_criu_dump (pid_t pid, const std::string &images_dir,
235226 const std::string &log_file) {
@@ -273,8 +264,7 @@ int run_criu_dump(pid_t pid, const std::string &images_dir,
273264 close (status_pipe[1 ]);
274265 signal (SIGCHLD , SIG_DFL );
275266 std::string pid_arg = std::to_string (static_cast <long long >(pid));
276- std::string vflag = criu_verbosity_flag ();
277- execlp (" criu" , " criu" , " dump" , " --unprivileged" , vflag.c_str (), " --tree" ,
267+ execlp (" criu" , " criu" , " dump" , " --unprivileged" , kCriuVerbosity , " --tree" ,
278268 pid_arg.c_str (), " --images-dir" , images_dir.c_str (),
279269 " --leave-running" , " --shell-job" , " --tcp-close" ,
280270 " --file-locks" , " --log-file" , log_file.c_str (),
@@ -343,8 +333,7 @@ int run_criu_restore(const std::string &images_dir, const std::string &log_file,
343333 }
344334 if (child == 0 ) {
345335 signal (SIGCHLD , SIG_DFL );
346- std::string vflag = criu_verbosity_flag ();
347- execlp (" criu" , " criu" , " restore" , " --unprivileged" , vflag.c_str (),
336+ execlp (" criu" , " criu" , " restore" , " --unprivileged" , kCriuVerbosity ,
348337 " --images-dir" , images_dir.c_str (), " --restore-detached" ,
349338 " --shell-job" , " --tcp-close" , " --file-locks" , " --inherit-fd" ,
350339 inherit_arg.c_str (), " --log-file" , log_file.c_str (),
0 commit comments