2 * \brief Example spawn application
6 * Copyright (c) 2010, ETH Zurich.
9 * This file is distributed under the terms in the attached LICENSE file.
10 * If you do not find this file, copies can be found by writing to:
11 * ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group.
17 #include <barrelfish/barrelfish.h>
18 #include <barrelfish/proc_mgmt_client.h>
22 int main(int argc, char *argv[])
25 coreid_t mycore = disp_get_core_id();
27 debug_printf("This is xmpl-spawn on core %d\n", mycore);
32 num_spawns = atoi(argv[1]);
33 num_cores = atoi(argv[2]);
36 snprintf(path, MAXPATH, "examples/%s", argv[0]);
39 struct capref ret_domain_cap;
42 for (int i = 0; i < num_spawns; i++, core++) {
45 Signature for proc_mgmt_spawn_program is:
47 errval_t proc_mgmt_spawn_program(coreid_t coreid, const char *path,
48 char *const argv[], char *const envp[],
49 spawn_flags_t flags, struct capref *ret_domain_cap)
51 err = proc_mgmt_spawn_program(core, path, argv, NULL, 0,
53 if (err_is_fail(err)) {
54 DEBUG_ERR(err, "failed spawn %d on core %d", i, core);
56 debug_printf("program %d on core %"PRIuCOREID" spawned \n", i, core);
60 debug_printf("not spawning any programs\n");
63 debug_printf("Finished\n");