proc_mgmt: implementation spawn_wait() with nohang flag
[barrelfish] / include / barrelfish / spawn_client.h
1 /*
2  * Copyright (c) 2010, 2011, 2012, ETH Zurich.
3  * All rights reserved.
4  *
5  * This file is distributed under the terms in the attached LICENSE file.
6  * If you do not find this file, copies can be found by writing to:
7  * ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group.
8  */
9
10 #ifndef BARRELFISH_SPAWN_CLIENT_H
11 #define BARRELFISH_SPAWN_CLIENT_H
12
13 #include <sys/cdefs.h>
14 #include <barrelfish_kpi/types.h>
15 #include <spawndomain/spawndomain.h>
16 __BEGIN_DECLS
17
18 struct spawn_ps_entry {
19     uint8_t status;
20 };
21
22
23
24 /* Inherit CNode, layout convention #spawn_program_with_caps expects */
25 #define INHERITCN_SLOT_FDSPAGE   1  ///< cap for inherited file descriptors
26 #define INHERITCN_SLOT_SESSIONID 2  ///< Session ID domain belongs to
27 #define INHERITCN_SLOT_KERNELCAP 3     ///< Kernel capability for core boot
28
29 struct proc_mgmt_lmp_binding;
30
31
32 /* XXX: duplicate of proc_mgmt_bind_continuation_fn in generated code */
33 typedef void proc_mgmt_bind_continuation_fn(void *st, errval_t err,
34                                             struct proc_mgmt_binding *_binding);
35
36 errval_t proc_mgmt_client_lmp_accept(struct proc_mgmt_lmp_binding *lmpb,
37                                      struct waitset *ws,
38                                      size_t lmp_buflen_words);
39 errval_t proc_mgmt_client_lmp_bind(struct proc_mgmt_lmp_binding *lmpb,
40                                    struct capref ep,
41                                    proc_mgmt_bind_continuation_fn *cont,
42                                    void *st,
43                                    struct waitset *ws,
44                                    size_t lmp_buflen_words);
45 errval_t proc_mgmt_bind_client(void);
46
47 errval_t proc_mgmt_add_spawnd(iref_t iref, coreid_t core_id);
48 errval_t spawn_program_with_caps(coreid_t coreid, const char *path,
49                                  char *const argv[], char *const envp[],
50                                  struct capref inheritcn_cap,
51                                  struct capref argcn_cap, spawn_flags_t flags,
52                                  struct capref *ret_domain_cap);
53 errval_t spawn_arrakis_program(coreid_t coreid, const char *path,
54                                  char *const argv[], char *const envp[],
55                                  struct capref inheritcn_cap,
56                                  struct capref argcn_cap, spawn_flags_t flags,
57                                  domainid_t* domainid);
58 errval_t spawn_program(coreid_t coreid, const char *path,
59                        char *const argv[], char *const envp[],
60                        spawn_flags_t flags, struct capref *ret_domain_cap);
61 errval_t spawn_program_on_all_cores(bool same_core, const char *path,
62                                     char *const argv[], char *const envp[],
63                                     spawn_flags_t flags, struct capref *ret_domain_cap,
64                                     coreid_t* spawn_count);
65 errval_t spawn_span(coreid_t core_id);
66 errval_t spawn_kill(struct capref domain_cap);
67 errval_t spawn_exit(uint8_t exitcode);
68 errval_t spawn_wait_coreid(coreid_t coreid, struct capref domain_cap, uint8_t *exitcode, bool nohang);
69 errval_t spawn_wait(struct capref domain_cap, uint8_t *exitcode, bool nohang);
70 errval_t spawn_wait_core(coreid_t coreid, struct capref domainid,
71                          uint8_t *exitcode, bool nohang);
72 errval_t spawn_binding(coreid_t coreid, struct spawn_binding **ret_client);
73 errval_t spawn_bind_iref(iref_t iref, struct spawn_binding **ret_client);
74 errval_t spawn_get_domain_list(uint8_t **domains, size_t *len);
75 errval_t spawn_get_status(domainid_t domain_id, struct spawn_ps_entry *pse,
76                           char **argbuf, size_t *arglen, errval_t *reterr);
77
78 errval_t alloc_inheritcn_with_caps(struct capref *inheritcn_capp,
79                                    struct capref fdcap,
80                                    struct capref sidcap,
81                                    struct capref kernelcap);
82
83 // definitions for compatibility reasons (_poxsixcompat and unimplemented in proc_mgmt)
84 errval_t spawn_wait_compat(uint8_t domaind, uint8_t *exitcode, bool nohang);
85 errval_t spawn_dump_capabilities_compat(domainid_t domainid);
86 __END_DECLS
87
88 #endif // BARRELFISH_SPAWN_CLIENT_H