Exemplo n.º 1
0
int main(int argc, char** argv) {

	g_task_register_id("init");

	// load spawner process
	g_ramdisk_spawn_status spawner_stat = g_ramdisk_spawn("applications/spawner.bin", G_SECURITY_LEVEL_KERNEL);
	if (spawner_stat != G_RAMDISK_SPAWN_STATUS_SUCCESSFUL) {
		g_logger::log("unable to load system spawner process");
		yield: asm("hlt");
		goto yield;
	}

	// wait for spawner to get ready
	g_tid spawner_id;
	while ((spawner_id = g_task_get_id(G_SPAWNER_IDENTIFIER)) == -1) {
		g_yield();
	}

	// let the spawner load the launch service
	g_pid ls_pid;
	std::string launch_srv_path = "/applications/launch.bin";

	g_spawn_status stat = g_spawn_p(launch_srv_path.c_str(), "/system/launch/init", "/", G_SECURITY_LEVEL_KERNEL, &ls_pid);
	if (stat == G_SPAWN_STATUS_SUCCESSFUL) {
		g_logger::log("launch service executed in process %i", ls_pid);
	} else {
		g_logger::log("failed to load launch service from '" + launch_srv_path + "' with code %i", stat);
	}

}
Exemplo n.º 2
0
g_pid launch_via_spawner(std::string path, std::string args, g_security_level sec_lvl) {

	g_pid pid = -1;
	g_spawn_status stat = g_spawn_p(path.c_str(), args.c_str(), "/", sec_lvl, &pid);
	if (stat != G_SPAWN_STATUS_SUCCESSFUL) {
		g_logger::log("failed to spawn '" + path + "' with code %i", stat);
	}
	return pid;
}