source: mainline/uspace/srv/taskman/task.h@ 035d7d8

Last change on this file since 035d7d8 was 035d7d8, checked in by Matthieu Riolo <matthieu.riolo@…>, 6 years ago

taskman: Implement task event notifications

  • Property mode set to 100644
File size: 2.6 KB
Line 
1/*
2 * Copyright (c) 2009 Martin Decky
3 * Copyright (c) 2015 Michal Koutny
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * - Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * - Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * - The name of the author may not be used to endorse or promote products
16 * derived from this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30/** @addtogroup taskman
31 * @{
32 */
33
34#ifndef TASKMAN_TASK_H__
35#define TASKMAN_TASK_H__
36
37#include <abi/proc/task.h>
38#include <adt/hash_table.h>
39#include <adt/list.h>
40#include <fibril_synch.h>
41#include <ipc/common.h>
42
43/** What type of retval from the task we have */
44typedef enum {
45 RVAL_UNSET, /**< unset */
46 RVAL_SET, /**< retval set, e.g. by server */
47 RVAL_SET_EXIT /**< retval set, wait for expected task exit */
48} retval_t;
49
50/** Holds necessary information of each (registered) task. */
51typedef struct {
52 ht_link_t link;
53
54 task_id_t id; /**< Task id. */
55 task_exit_t exit; /**< Task's uspace exit status. */
56 bool failed; /**< Task failed (task can exit unexpectedly
57 even w/out failure). */
58 retval_t retval_type; /**< Task returned a value. */
59 int retval; /**< The return value. */
60
61 link_t listeners; /**< Link to listeners list. */
62 async_sess_t *sess; /**< Session for notifications to task. */
63} task_t;
64
65extern hash_table_t task_hash_table;
66extern fibril_rwlock_t task_hash_table_lock;
67
68extern int task_init(void);
69
70extern task_t *task_get_by_id(task_id_t);
71
72extern int task_intro(ipc_call_t *, bool);
73
74#endif
75
76/**
77 * @}
78 */
Note: See TracBrowser for help on using the repository browser.