summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKay Sievers <kay@vrfy.org>2013-11-07 14:56:31 +0100
committerKay Sievers <kay@vrfy.org>2013-11-07 14:56:31 +0100
commitab49725fd8587ef2b90dd0a67b2c915bc772d089 (patch)
tree7249d0ed11b3145e0c39a4bd724dda547c6bb5e3 /src
parent27e72d6b22890ba4a8cbc05c49667cd1cccf1461 (diff)
machine: move symbols referenced by shared code from main to shared file
With --enable-address-sanitizer we get: machined-dbus.c:228: undefined reference to 'manager_add_machine'
Diffstat (limited to 'src')
-rw-r--r--src/machine/machined-dbus.c41
-rw-r--r--src/machine/machined.c41
2 files changed, 41 insertions, 41 deletions
diff --git a/src/machine/machined-dbus.c b/src/machine/machined-dbus.c
index 11256da98..d60be0d3b 100644
--- a/src/machine/machined-dbus.c
+++ b/src/machine/machined-dbus.c
@@ -688,3 +688,44 @@ int manager_job_is_active(Manager *manager, const char *path) {
return true;
}
+
+int manager_get_machine_by_pid(Manager *m, pid_t pid, Machine **machine) {
+ _cleanup_free_ char *unit = NULL;
+ Machine *mm;
+ int r;
+
+ assert(m);
+ assert(pid >= 1);
+ assert(machine);
+
+ r = cg_pid_get_unit(pid, &unit);
+ if (r < 0)
+ mm = hashmap_get(m->machine_leaders, UINT_TO_PTR(pid));
+ else
+ mm = hashmap_get(m->machine_units, unit);
+
+ if (!mm)
+ return 0;
+
+ *machine = mm;
+ return 1;
+}
+
+int manager_add_machine(Manager *m, const char *name, Machine **_machine) {
+ Machine *machine;
+
+ assert(m);
+ assert(name);
+
+ machine = hashmap_get(m->machines, name);
+ if (!machine) {
+ machine = machine_new(m, name);
+ if (!machine)
+ return -ENOMEM;
+ }
+
+ if (_machine)
+ *_machine = machine;
+
+ return 0;
+}
diff --git a/src/machine/machined.c b/src/machine/machined.c
index a5f529384..d6dd984e7 100644
--- a/src/machine/machined.c
+++ b/src/machine/machined.c
@@ -80,47 +80,6 @@ void manager_free(Manager *m) {
free(m);
}
-int manager_add_machine(Manager *m, const char *name, Machine **_machine) {
- Machine *machine;
-
- assert(m);
- assert(name);
-
- machine = hashmap_get(m->machines, name);
- if (!machine) {
- machine = machine_new(m, name);
- if (!machine)
- return -ENOMEM;
- }
-
- if (_machine)
- *_machine = machine;
-
- return 0;
-}
-
-int manager_get_machine_by_pid(Manager *m, pid_t pid, Machine **machine) {
- _cleanup_free_ char *unit = NULL;
- Machine *mm;
- int r;
-
- assert(m);
- assert(pid >= 1);
- assert(machine);
-
- r = cg_pid_get_unit(pid, &unit);
- if (r < 0)
- mm = hashmap_get(m->machine_leaders, UINT_TO_PTR(pid));
- else
- mm = hashmap_get(m->machine_units, unit);
-
- if (!mm)
- return 0;
-
- *machine = mm;
- return 1;
-}
-
int manager_enumerate_machines(Manager *m) {
_cleanup_closedir_ DIR *d = NULL;
struct dirent *de;