]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Merge pull request #6931 from poettering/job-timeout-sec
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 5 Oct 2017 12:42:29 +0000 (14:42 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 5 Oct 2017 12:43:13 +0000 (14:43 +0200)
1  2 
src/core/load-fragment.c

index 46041de5424fd0dd0cb9c35f001cede80399355b,632b7d774dd18c0eeec10c2b333a8e8587ddaab5..a4e39a84eab5982fb13d4d72d6e68402f18916b3
@@@ -4145,6 -4145,78 +4145,78 @@@ int config_parse_protect_system
  
  DEFINE_CONFIG_PARSE_ENUM(config_parse_exec_keyring_mode, exec_keyring_mode, ExecKeyringMode, "Failed to parse keyring mode");
  
 -         * versions. If JobRunningTimeoutSec= was explicitly set, avoid this however as whatever the usec picked should
+ int config_parse_job_timeout_sec(
+                 const char* unit,
+                 const char *filename,
+                 unsigned line,
+                 const char *section,
+                 unsigned section_line,
+                 const char *lvalue,
+                 int ltype,
+                 const char *rvalue,
+                 void *data,
+                 void *userdata) {
+         Unit *u = data;
+         usec_t usec;
+         int r;
+         assert(filename);
+         assert(lvalue);
+         assert(rvalue);
+         assert(u);
+         r = parse_sec_fix_0(rvalue, &usec);
+         if (r < 0) {
+                 log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse JobTimeoutSec= parameter, ignoring: %s", rvalue);
+                 return 0;
+         }
+         /* If the user explicitly changed JobTimeoutSec= also change JobRunningTimeoutSec=, for compatibility with old
++         * versions. If JobRunningTimeoutSec= was explicitly set, avoid this however as whatever the user picked should
+          * count. */
+         if (!u->job_running_timeout_set)
+                 u->job_running_timeout = usec;
+         u->job_timeout = usec;
+         return 0;
+ }
+ int config_parse_job_running_timeout_sec(
+                 const char* unit,
+                 const char *filename,
+                 unsigned line,
+                 const char *section,
+                 unsigned section_line,
+                 const char *lvalue,
+                 int ltype,
+                 const char *rvalue,
+                 void *data,
+                 void *userdata) {
+         Unit *u = data;
+         usec_t usec;
+         int r;
+         assert(filename);
+         assert(lvalue);
+         assert(rvalue);
+         assert(u);
+         r = parse_sec_fix_0(rvalue, &usec);
+         if (r < 0) {
+                 log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse JobRunningTimeoutSec= parameter, ignoring: %s", rvalue);
+                 return 0;
+         }
+         u->job_running_timeout = usec;
+         u->job_running_timeout_set = true;
+         return 0;
+ }
  #define FOLLOW_MAX 8
  
  static int open_follow(char **filename, FILE **_f, Set *names, char **_final) {