1 /* 2 * Copyright 2004-2009, 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 // Team notifications 13 #define TEAM_MONITOR '_Tm_' 14 #define TEAM_ADDED 1 15 #define TEAM_REMOVED 2 16 17 18 #ifdef __cplusplus 19 extern "C" { 20 #endif 21 22 status_t team_init(struct kernel_args *args); 23 status_t wait_for_team(team_id id, status_t *returnCode); 24 void team_remove_team(struct team *team); 25 void team_delete_team(struct team *team); 26 struct process_group *team_get_process_group_locked( 27 struct process_session *session, pid_t id); 28 void team_delete_process_group(struct process_group *group); 29 struct team *team_get_kernel_team(void); 30 team_id team_get_kernel_team_id(void); 31 team_id team_get_current_team_id(void); 32 status_t team_get_address_space(team_id id, 33 struct vm_address_space **_addressSpace); 34 char **user_team_get_arguments(void); 35 int user_team_get_arg_count(void); 36 struct job_control_entry* team_get_death_entry(struct team *team, 37 thread_id child, bool* _deleteEntry); 38 bool team_is_valid(team_id id); 39 struct team *team_get_team_struct_locked(team_id id); 40 int32 team_max_teams(void); 41 int32 team_used_teams(void); 42 43 thread_id load_image_etc(int32 argCount, const char* const* args, 44 const char* const* env, int32 priority, team_id parentID, uint32 flags); 45 46 void team_set_job_control_state(struct team* team, job_control_state newState, 47 int signal, bool threadsLocked); 48 void team_set_controlling_tty(int32 index); 49 int32 team_get_controlling_tty(); 50 status_t team_set_foreground_process_group(int32 ttyIndex, pid_t processGroup); 51 52 status_t start_watching_team(team_id team, void (*hook)(team_id, void *), 53 void *data); 54 status_t stop_watching_team(team_id team, void (*hook)(team_id, void *), 55 void *data); 56 57 struct user_thread* team_allocate_user_thread(struct team* team); 58 void team_free_user_thread(struct thread* thread); 59 60 // used in syscalls.c 61 thread_id _user_load_image(const char* const* flatArgs, size_t flatArgsSize, 62 int32 argCount, int32 envCount, int32 priority, uint32 flags, 63 port_id errorPort, uint32 errorToken); 64 status_t _user_wait_for_team(team_id id, status_t *_returnCode); 65 void _user_exit_team(status_t returnValue); 66 status_t _user_kill_team(thread_id thread); 67 thread_id _user_wait_for_child(thread_id child, uint32 flags, int32 *_reason, 68 status_t *_returnCode); 69 status_t _user_exec(const char *path, const char* const* flatArgs, 70 size_t flatArgsSize, int32 argCount, int32 envCount); 71 thread_id _user_fork(void); 72 team_id _user_get_current_team(void); 73 pid_t _user_process_info(pid_t process, int32 which); 74 pid_t _user_setpgid(pid_t process, pid_t group); 75 pid_t _user_setsid(void); 76 77 status_t _user_get_team_info(team_id id, team_info *info); 78 status_t _user_get_next_team_info(int32 *cookie, team_info *info); 79 status_t _user_get_team_usage_info(team_id team, int32 who, 80 team_usage_info *info, size_t size); 81 82 #ifdef __cplusplus 83 } 84 #endif 85 86 #endif /* _TEAM_H */ 87