xref: /haiku/headers/private/kernel/team.h (revision 1214ef1b2100f2b3299fc9d8d6142e46f70a4c3f)
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 <thread_types.h>
10 
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
16 status_t team_init(struct kernel_args *args);
17 team_id team_create_team(const char *path, const char *name, char **args,
18 			int argc, char **envp, int envc, int priority);
19 status_t wait_for_team(team_id id, status_t *returnCode);
20 void team_remove_team(struct team *team, struct process_group **_freeGroup);
21 void team_delete_team(struct team *team);
22 struct process_group *team_get_process_group_locked(
23 			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,
29 			struct vm_address_space **_addressSpace);
30 char **user_team_get_arguments(void);
31 int user_team_get_arg_count(void);
32 struct job_control_entry* team_get_death_entry(struct team *team,
33 			thread_id child, bool* _deleteEntry);
34 bool team_is_valid(team_id id);
35 struct team *team_get_team_struct_locked(team_id id);
36 int32 team_max_teams(void);
37 int32 team_used_teams(void);
38 
39 void team_set_job_control_state(struct team* team, job_control_state newState,
40 			int signal, bool threadsLocked);
41 void team_set_controlling_tty(int32 index);
42 int32 team_get_controlling_tty();
43 status_t team_set_foreground_process_group(int32 ttyIndex, pid_t processGroup);
44 
45 status_t start_watching_team(team_id team, void (*hook)(team_id, void *),
46 			void *data);
47 status_t stop_watching_team(team_id team, void (*hook)(team_id, void *),
48 			void *data);
49 
50 // used in syscalls.c
51 thread_id _user_load_image(int32 argCount, const char **args, int32 envCount,
52 			const char **env, int32 priority, uint32 flags,
53 			port_id errorPort, uint32 errorToken);
54 status_t _user_wait_for_team(team_id id, status_t *_returnCode);
55 void _user_exit_team(status_t returnValue);
56 status_t _user_kill_team(thread_id thread);
57 thread_id _user_wait_for_child(thread_id child, uint32 flags, int32 *_reason,
58 			status_t *_returnCode);
59 status_t _user_exec(const char *path, int32 argc, char * const *argv,
60 			int32 envCount, char * const *environment);
61 thread_id _user_fork(void);
62 team_id _user_get_current_team(void);
63 pid_t _user_process_info(pid_t process, int32 which);
64 pid_t _user_setpgid(pid_t process, pid_t group);
65 pid_t _user_setsid(void);
66 
67 status_t _user_get_team_info(team_id id, team_info *info);
68 status_t _user_get_next_team_info(int32 *cookie, team_info *info);
69 status_t _user_get_team_usage_info(team_id team, int32 who,
70 			team_usage_info *info, size_t size);
71 
72 #ifdef __cplusplus
73 }
74 #endif
75 
76 #endif /* _TEAM_H */
77