xref: /haiku/headers/private/kernel/team.h (revision be3db2942c0e8dda63cdd226ec3c99309d3eab0c)
1 /*
2  * Copyright 2004-2007, Haiku Inc. All Rights Reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _TEAM_H
6 #define _TEAM_H
7 
8 
9 #include <OS.h>
10 #include <thread_types.h>
11 
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
17 status_t team_init(struct kernel_args *args);
18 team_id team_create_team(const char *path, const char *name, char **args, int argc,
19 			char **envp, int envc, int priority);
20 status_t wait_for_team(team_id id, status_t *returnCode);
21 void team_remove_team(struct team *team, struct process_group **_freeGroup);
22 void team_delete_team(struct team *team);
23 struct process_group *team_get_process_group_locked(struct process_session *session, pid_t id);
24 void team_delete_process_group(struct process_group *group);
25 struct team *team_get_kernel_team(void);
26 team_id team_get_kernel_team_id(void);
27 team_id team_get_current_team_id(void);
28 status_t team_get_address_space(team_id id, struct vm_address_space **_addressSpace);
29 char **user_team_get_arguments(void);
30 int user_team_get_arg_count(void);
31 status_t team_get_death_entry(struct team *team, thread_id child,
32 	struct death_entry *death, struct death_entry **_freeDeath);
33 bool team_is_valid(team_id id);
34 struct team *team_get_team_struct_locked(team_id id);
35 int32 team_max_teams(void);
36 int32 team_used_teams(void);
37 
38 status_t start_watching_team(team_id team, void (*hook)(team_id, void *), void *data);
39 status_t stop_watching_team(team_id team, void (*hook)(team_id, void *), void *data);
40 
41 // used in syscalls.c
42 thread_id _user_load_image(int32 argCount, const char **args, int32 envCount,
43 				const char **envp, int32 priority, uint32 flags);
44 status_t _user_wait_for_team(team_id id, status_t *_returnCode);
45 void _user_exit_team(status_t returnValue);
46 status_t _user_kill_team(thread_id thread);
47 thread_id _user_wait_for_child(thread_id child, uint32 flags, int32 *_reason, status_t *_returnCode);
48 status_t _user_exec(const char *path, int32 argc, char * const *argv, int32 envCount, char * const *environment);
49 thread_id _user_fork(void);
50 team_id _user_get_current_team(void);
51 pid_t _user_process_info(pid_t process, int32 which);
52 pid_t _user_setpgid(pid_t process, pid_t group);
53 pid_t _user_setsid(void);
54 
55 status_t _user_get_team_info(team_id id, team_info *info);
56 status_t _user_get_next_team_info(int32 *cookie, team_info *info);
57 status_t _user_get_team_usage_info(team_id team, int32 who, team_usage_info *info, size_t size);
58 
59 #ifdef __cplusplus
60 }
61 #endif
62 
63 #endif /* _TIME_H */
64