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