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