static Machine * machines_new_machine (Machines *machines) { gs_free gchar *id = g_strdup_printf ("%d", machines->machines->len); Machine *machine = MACHINE (machine_new (machines, id)); g_ptr_array_add (machines->machines, machine); return machine; }
static int manager_add_host_machine(Manager *m) { _cleanup_free_ char *rd = NULL, *unit = NULL; sd_id128_t mid; Machine *t; int r; if (m->host_machine) return 0; r = sd_id128_get_machine(&mid); if (r < 0) return log_error_errno(r, "Failed to get machine ID: %m"); rd = strdup("/"); if (!rd) return log_oom(); unit = strdup("-.slice"); if (!unit) return log_oom(); t = machine_new(m, MACHINE_HOST, ".host"); if (!t) return log_oom(); t->leader = 1; t->id = mid; t->root_directory = rd; t->unit = unit; rd = unit = NULL; dual_timestamp_from_boottime_or_monotonic(&t->timestamp, 0); m->host_machine = t; return 0; }
int main(int argc, char **argv) { environment e; machine m; char *archive; environment_at_startup(); e = environment_new(); m = machine_new(e); environment_setup_thread(e, m); machine_setup_normal(m, argc, argv); /* We build up the environment information by looking around * the filesystem now. */ /* Find the platform config */ e->platform_config = search_for("RBX_PLATFORM_CONF", "platform.conf"); /* Find the bootstrap. */ archive = search_for("RBX_BOOTSTRAP", "bootstrap"); if(!archive) { printf("Unable to find a bootstrap to load!\n"); return 1; } e->bootstrap_path = archive; /* Find the platform. */ archive = search_for("RBX_PLATFORM", "platform"); if(!archive) { printf("Unable to find a platform to load!\n"); return 1; } e->platform_path = archive; /* Find the core. */ archive = search_for("RBX_CORE", "core"); if(!archive) { printf("Unable to find a core to load!\n"); return 1; } e->core_path = archive; /* Load the loader.rbc */ archive = search_for("RBX_LOADER", "loader.rbc"); if(!archive) { printf("Unable to find loader.rbc to load!\n"); return 1; } e->loader_path = archive; environment_load_machine(e, m); /* Done! */ if(m->s->gc_stats) { printf("[GC M %6dK total]\n", m->s->om->ms->allocated_bytes); } return 0; }
void machmgr_add(const char *machname) { if (!*machname) return; if (machcount >= MACHINE_MAX) return; machs[machcount++] = machine_new(machname, vtrows, vtcols); machmgr_selmach_validate(); }