2004-03-16 02:40:03 +00:00
|
|
|
/*
|
2007-01-09 23:58:59 +00:00
|
|
|
* Copyright 2004-2007, Haiku Inc. All Rights Reserved.
|
2004-11-30 21:06:11 +00:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
2004-03-16 02:40:03 +00:00
|
|
|
#ifndef _TEAM_H
|
|
|
|
#define _TEAM_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <thread_types.h>
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2004-12-13 22:22:45 +00:00
|
|
|
status_t team_init(struct kernel_args *args);
|
2007-07-27 02:32:19 +00:00
|
|
|
team_id team_create_team(const char *path, const char *name, char **args,
|
|
|
|
int argc, char **envp, int envc, int priority);
|
2004-03-16 02:40:03 +00:00
|
|
|
status_t wait_for_team(team_id id, status_t *returnCode);
|
2004-10-14 14:34:30 +00:00
|
|
|
void team_remove_team(struct team *team, struct process_group **_freeGroup);
|
2004-03-16 02:40:03 +00:00
|
|
|
void team_delete_team(struct team *team);
|
2007-07-27 02:32:19 +00:00
|
|
|
struct process_group *team_get_process_group_locked(
|
|
|
|
struct process_session *session, pid_t id);
|
2004-10-14 14:34:30 +00:00
|
|
|
void team_delete_process_group(struct process_group *group);
|
2004-03-16 02:40:03 +00:00
|
|
|
struct team *team_get_kernel_team(void);
|
|
|
|
team_id team_get_kernel_team_id(void);
|
|
|
|
team_id team_get_current_team_id(void);
|
2007-07-27 02:32:19 +00:00
|
|
|
status_t team_get_address_space(team_id id,
|
|
|
|
struct vm_address_space **_addressSpace);
|
2004-03-16 02:40:03 +00:00
|
|
|
char **user_team_get_arguments(void);
|
|
|
|
int user_team_get_arg_count(void);
|
* Introduced new job_control_entry structure which, among other things,
is used instead of death_entry for team::dead_children.
* Added team::{stopped,continued}_children, which, analoguously to
dead_children, are used to track the state of stopped/continued
children.
* A team does have a job_control_entry, which is allocated at team
creation time. It will be inserted into the parent's
{stopped,continued}_children lists as the team's main thread is
stopped/continued and removed when waitpid() retrieves the child
state. When the team dies the entry is detached from the team and goes
into the parent's dead_children list.
* Removed the wait_for_any field from team_dead_children. It was solely
used to avoid deletion of the contained entries in certain situations.
wait_for_child() (the waitpid() backend) always deletes an entry now,
regardless of whether other threads are waiting; that's in
accordance with the waidpid() specification. wait_for_thread() removes
the entry only, if the caller is the parent of the respective team.
* Introduced team_set_job_control_state() which performes the job
control entry transitions between the respective lists and wakes up
threads waiting in wait_for_child(). It is invoked on team death and
when the team's main thread receives job control signals.
* Reorganized wait_for_child(). It handles WCONTINUED and WUNTRACED now,
too. Removed a block that interpreted the supplied ID as thread ID.
* Added missing parts in waitpid().
Job control starts to work, though it seems to have some glitches.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22088 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-08-28 03:29:14 +00:00
|
|
|
struct job_control_entry* team_get_death_entry(struct team *team,
|
|
|
|
thread_id child, bool* _deleteEntry);
|
2004-03-16 02:40:03 +00:00
|
|
|
bool team_is_valid(team_id id);
|
|
|
|
struct team *team_get_team_struct_locked(team_id id);
|
2004-11-30 21:06:11 +00:00
|
|
|
int32 team_max_teams(void);
|
|
|
|
int32 team_used_teams(void);
|
2004-03-16 02:40:03 +00:00
|
|
|
|
* Introduced new job_control_entry structure which, among other things,
is used instead of death_entry for team::dead_children.
* Added team::{stopped,continued}_children, which, analoguously to
dead_children, are used to track the state of stopped/continued
children.
* A team does have a job_control_entry, which is allocated at team
creation time. It will be inserted into the parent's
{stopped,continued}_children lists as the team's main thread is
stopped/continued and removed when waitpid() retrieves the child
state. When the team dies the entry is detached from the team and goes
into the parent's dead_children list.
* Removed the wait_for_any field from team_dead_children. It was solely
used to avoid deletion of the contained entries in certain situations.
wait_for_child() (the waitpid() backend) always deletes an entry now,
regardless of whether other threads are waiting; that's in
accordance with the waidpid() specification. wait_for_thread() removes
the entry only, if the caller is the parent of the respective team.
* Introduced team_set_job_control_state() which performes the job
control entry transitions between the respective lists and wakes up
threads waiting in wait_for_child(). It is invoked on team death and
when the team's main thread receives job control signals.
* Reorganized wait_for_child(). It handles WCONTINUED and WUNTRACED now,
too. Removed a block that interpreted the supplied ID as thread ID.
* Added missing parts in waitpid().
Job control starts to work, though it seems to have some glitches.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22088 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-08-28 03:29:14 +00:00
|
|
|
void team_set_job_control_state(struct team* team, job_control_state newState,
|
|
|
|
int signal, bool threadsLocked);
|
2007-09-06 02:16:25 +00:00
|
|
|
void team_set_controlling_tty(int32 index);
|
|
|
|
int32 team_get_controlling_tty();
|
|
|
|
status_t team_set_foreground_process_group(int32 ttyIndex, pid_t processGroup);
|
* Introduced new job_control_entry structure which, among other things,
is used instead of death_entry for team::dead_children.
* Added team::{stopped,continued}_children, which, analoguously to
dead_children, are used to track the state of stopped/continued
children.
* A team does have a job_control_entry, which is allocated at team
creation time. It will be inserted into the parent's
{stopped,continued}_children lists as the team's main thread is
stopped/continued and removed when waitpid() retrieves the child
state. When the team dies the entry is detached from the team and goes
into the parent's dead_children list.
* Removed the wait_for_any field from team_dead_children. It was solely
used to avoid deletion of the contained entries in certain situations.
wait_for_child() (the waitpid() backend) always deletes an entry now,
regardless of whether other threads are waiting; that's in
accordance with the waidpid() specification. wait_for_thread() removes
the entry only, if the caller is the parent of the respective team.
* Introduced team_set_job_control_state() which performes the job
control entry transitions between the respective lists and wakes up
threads waiting in wait_for_child(). It is invoked on team death and
when the team's main thread receives job control signals.
* Reorganized wait_for_child(). It handles WCONTINUED and WUNTRACED now,
too. Removed a block that interpreted the supplied ID as thread ID.
* Added missing parts in waitpid().
Job control starts to work, though it seems to have some glitches.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22088 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-08-28 03:29:14 +00:00
|
|
|
|
2007-07-27 02:32:19 +00:00
|
|
|
status_t start_watching_team(team_id team, void (*hook)(team_id, void *),
|
|
|
|
void *data);
|
|
|
|
status_t stop_watching_team(team_id team, void (*hook)(team_id, void *),
|
|
|
|
void *data);
|
2005-08-03 12:00:42 +00:00
|
|
|
|
2004-03-16 02:40:03 +00:00
|
|
|
// used in syscalls.c
|
2005-03-12 15:11:08 +00:00
|
|
|
thread_id _user_load_image(int32 argCount, const char **args, int32 envCount,
|
2007-07-27 02:32:19 +00:00
|
|
|
const char **env, int32 priority, uint32 flags,
|
|
|
|
port_id errorPort, uint32 errorToken);
|
2004-03-16 02:40:03 +00:00
|
|
|
status_t _user_wait_for_team(team_id id, status_t *_returnCode);
|
2004-12-01 04:14:55 +00:00
|
|
|
void _user_exit_team(status_t returnValue);
|
2004-03-16 02:40:03 +00:00
|
|
|
status_t _user_kill_team(thread_id thread);
|
2007-07-27 02:32:19 +00:00
|
|
|
thread_id _user_wait_for_child(thread_id child, uint32 flags, int32 *_reason,
|
|
|
|
status_t *_returnCode);
|
|
|
|
status_t _user_exec(const char *path, int32 argc, char * const *argv,
|
|
|
|
int32 envCount, char * const *environment);
|
2004-09-15 15:42:02 +00:00
|
|
|
thread_id _user_fork(void);
|
2004-03-16 02:40:03 +00:00
|
|
|
team_id _user_get_current_team(void);
|
2004-10-14 14:34:30 +00:00
|
|
|
pid_t _user_process_info(pid_t process, int32 which);
|
|
|
|
pid_t _user_setpgid(pid_t process, pid_t group);
|
|
|
|
pid_t _user_setsid(void);
|
2004-03-16 02:40:03 +00:00
|
|
|
|
|
|
|
status_t _user_get_team_info(team_id id, team_info *info);
|
|
|
|
status_t _user_get_next_team_info(int32 *cookie, team_info *info);
|
2007-07-27 02:32:19 +00:00
|
|
|
status_t _user_get_team_usage_info(team_id team, int32 who,
|
|
|
|
team_usage_info *info, size_t size);
|
2004-03-16 02:40:03 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2007-07-27 02:32:19 +00:00
|
|
|
#endif /* _TEAM_H */
|