]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/core/job.h
test-network: tun/tap fd may be owned by tentative worker processes
[thirdparty/systemd.git] / src / core / job.h
index 1b3ddc7b4b7cc26e8785936d78558ea5700eda29..8318b524b4401d7f01cfa594f9d6cf9de43b585d 100644 (file)
@@ -6,8 +6,11 @@
 #include "sd-event.h"
 
 #include "list.h"
+#include "unit-dependency-atom.h"
 #include "unit-name.h"
+#include "unit.h"
 
+typedef struct ActivationDetails ActivationDetails;
 typedef struct Job Job;
 typedef struct JobDependency JobDependency;
 typedef enum JobType JobType;
@@ -57,14 +60,14 @@ enum JobType {
         JOB_RELOAD_OR_START,        /* if running, reload, otherwise start */
 
         _JOB_TYPE_MAX,
-        _JOB_TYPE_INVALID = -1
+        _JOB_TYPE_INVALID = -EINVAL,
 };
 
 enum JobState {
         JOB_WAITING,
         JOB_RUNNING,
         _JOB_STATE_MAX,
-        _JOB_STATE_INVALID = -1
+        _JOB_STATE_INVALID = -EINVAL,
 };
 
 enum JobMode {
@@ -76,12 +79,13 @@ enum JobMode {
         JOB_IGNORE_DEPENDENCIES, /* Ignore both requirement and ordering dependencies */
         JOB_IGNORE_REQUIREMENTS, /* Ignore requirement dependencies */
         JOB_TRIGGERING,          /* Adds TRIGGERED_BY dependencies to the same transaction */
+        JOB_RESTART_DEPENDENCIES,/* A "start" job for the specified unit becomes "restart" for depending units */
         _JOB_MODE_MAX,
-        _JOB_MODE_INVALID = -1
+        _JOB_MODE_INVALID = -EINVAL,
 };
 
 enum JobResult {
-        JOB_DONE,                /* Job completed successfully (or skipped due to a failed ConditionXYZ=) */
+        JOB_DONE,                /* Job completed successfully (or skipped due to an unmet ConditionXYZ=) */
         JOB_CANCELED,            /* Job canceled by a conflicting job installation or by explicit cancel request */
         JOB_TIMEOUT,             /* Job timeout elapsed */
         JOB_FAILED,              /* Job failed */
@@ -92,12 +96,11 @@ enum JobResult {
         JOB_UNSUPPORTED,         /* Couldn't start a unit, because the unit type is not supported on the system */
         JOB_COLLECTED,           /* Job was garbage collected, since nothing needed it anymore */
         JOB_ONCE,                /* Unit was started before, and hence can't be started again */
+        JOB_FROZEN,              /* Unit is currently frozen, so we can't safely operate on it */
         _JOB_RESULT_MAX,
-        _JOB_RESULT_INVALID = -1
+        _JOB_RESULT_INVALID = -EINVAL,
 };
 
-#include "unit.h"
-
 struct JobDependency {
         /* Encodes that the 'subject' job needs the 'object' job in
          * some way. This structure is used only while building a transaction. */
@@ -149,6 +152,9 @@ struct Job {
 
         unsigned run_queue_idx;
 
+        /* If the job had a specific trigger that needs to be advertised (eg: a path unit), store it. */
+        ActivationDetails *activation_details;
+
         bool installed:1;
         bool in_run_queue:1;
         bool matters_to_anchor:1;
@@ -164,7 +170,7 @@ Job* job_new(Unit *unit, JobType type);
 Job* job_new_raw(Unit *unit);
 void job_unlink(Job *job);
 Job* job_free(Job *job);
-Job* job_install(Job *j);
+Job* job_install(Job *j, bool refuse_late_merge);
 int job_install_deserialized(Job *j);
 void job_uninstall(Job *j);
 void job_dump(Job *j, FILE *f, const char *prefix);
@@ -216,7 +222,7 @@ char *job_dbus_path(Job *j);
 
 void job_shutdown_magic(Job *j);
 
-int job_get_timeout(Job *j, usec_t *timeout) _pure_;
+int job_get_timeout(Job *j, usec_t *ret);
 
 bool job_may_gc(Job *j);
 void job_add_to_gc_queue(Job *j);
@@ -240,4 +246,6 @@ JobResult job_result_from_string(const char *s) _pure_;
 
 const char* job_type_to_access_method(JobType t);
 
-int job_compare(Job *a, Job *b, UnitDependency assume_dep);
+int job_compare(Job *a, Job *b, UnitDependencyAtom assume_dep);
+
+void job_set_activation_details(Job *j, ActivationDetails *info);