History log of /haiku/headers/private/kernel/team.h
Revision Date Author Comments
# b809279c 15-May-2023 Trung Nguyen <trungnt282910@gmail.com>

kernel/team: Allow retrieving more attributes

- Stored the additional start time of each team, expressed by
milliseconds since boot.
- Added more fields to the `team_info` structure. These field
include those provided by the `get_extended_team_info` syscall as
well as the newly introduced `start_time`.
- Extended the `_kern_get_team_info` system call to receive an
additional `size_t` argument. If this size is smaller than or
equal to the size of the old `team_info` structure, the newly
added attributes will not be retrieved.

Change-Id: I22ee6b91ad2ee3b66a7f770036c79a718c5f115c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6390
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jessica Hamilton <jessica.l.hamilton@gmail.com>


# 0c2a5bb5 09-May-2023 Augustin Cavalier <waddlesplash@gmail.com>

Replace the "tty" driver with a "pty" driver.

This new driver uses the "generic" TTY layer, unlike the old driver
which had its own implementation (which the generic module was derived
from, originally.)

The remaining bits of support for controlling TTYs is added to the kernel &
generic layer at the same time, which should allow for serial interfaces
to be controlling terminals now, as well.

Tested with bash, nano, vim; all seems to still be working as expected.


# 2f6dc2bb 08-Jul-2019 Augustin Cavalier <waddlesplash@gmail.com>

kernel: Commit missing change to team.h.

If the buildbots were working, I would have been informed of this
about an hour after I committed it last night. But it seems they aren't.
Maybe kallisti5 will have some more incentive to work on that?


# a90e9ba7 04-Jul-2019 Augustin Cavalier <waddlesplash@gmail.com>

kernel/team: Create a team_get_team_struct() function and utilize it.

Cleans up some lock/get/unlock sequences, and makes it possible
for external consumers to get team structs (which will be necessary
for permissions checks.)


# a295d3f4 10-Oct-2017 Jérôme Duval <jerome.duval@gmail.com>

wait4(): retrieve dead team entries usage information.

* This adds a parameter to the wait_for_child syscall. I extended the test case
to show the actual retrieved information.
* fix #13546


# 03fb2d88 07-Nov-2013 Pawel Dziepak <pdziepak@quarnos.org>

kernel: Remove gSchedulerLock

* Thread::scheduler_lock protects thread state, priority, etc.
* sThreadCreationLock protects thread creation and removal and list of
threads in team.
* Team::signal_lock and Team::time_lock protect list of threads in team
as well.
* Scheduler uses its own internal locking.


# 9437559d 14-Jun-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added function team_init_exit_info_on_error() which initializes the team's
exit info with some generic status.
* team_create_thread_start(), common_thread_entry(): Initializes the team's
exit info (if that's the main thread) before calling thread_exit(). Fixes
#7686.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42183 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 24df6592 11-Jun-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Merged signals-merge branch into trunk with the following changes:
* Reorganized the kernel locking related to threads and teams.
* We now discriminate correctly between process and thread signals. Signal
handlers have been moved to teams. Fixes #5679.
* Implemented real-time signal support, including signal queuing, SA_SIGINFO
support, sigqueue(), sigwaitinfo(), sigtimedwait(), waitid(), and the addition
of the real-time signal range. Closes #1935 and #2695.
* Gave SIGBUS a separate signal number. Fixes #6704.
* Implemented <time.h> clock and timer support, and fixed/completed alarm() and
[set]itimer(). Closes #5682.
* Implemented support for thread cancellation. Closes #5686.
* Moved send_signal() from <signal.h> to <OS.h>. Fixes #7554.
* Lots over smaller more or less related changes.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42116 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4535495d 10-Jan-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Merged the signals branch into trunk, with these changes:
* The team and thread kernel structures have been renamed to Team and Thread
respectively and moved into the new BKernel namespace.
* Several (kernel add-on) sources have been converted from C to C++ since
private kernel headers are included that are no longer C compatible.

Changes after merging:
* Fixed gcc 2 build (warnings mainly in the scary firewire bus manager).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40196 a95241bf-73f2-0310-859d-f6bbb57e9c96


# db033113 02-Jan-2011 Oliver Tappe <zooey@hirschkaefer.de>

Closing #7056:
* inherit umask of calling process to images loaded via exec...()

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40071 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2d8d1cdb 15-Dec-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Implemented a generic way to associate data with a team which is
automatically cleaned up when the team is deleted: Class AssociatedData is
the base class for a data item, AssociatedDataOwner a container for them
(struct team derives from it). Functions team_associate_data() and
team_dissociate_data() add/remove data.
* Turned sTeamHash into a BOpenHashTable (necessary since struct team is no
longer a POD).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39860 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 56d734a1 16-Nov-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Added new private API to get more information on a team:
* Userland interface: get_extended_team_info().
* Syscall: _kern_get_extended_team_info.

Only partially implemented yet.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39453 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5662ae45 20-Jan-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Changed the team shutdown process a bit:
* The threads beside the main thread are killed earlier now (in the new
team_shutdown_team()), before removing the team from the team hash and from
its process group. This fixes #5296.
* Use a condition variable instead of a semaphore to wait for the non-main
threads to die. We notify the condition right after a thread has left the
team. The semaphore was released by the undertaker.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35196 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b0db552c 01-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Renamed vm_address_space to VMAddressSpace.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34422 a95241bf-73f2-0310-859d-f6bbb57e9c96


# efd536ff 11-Apr-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Cleared up a misconception in the notification mechanism. We already had
methods that used an "event mask" field. There was no need to introduce
a "flags" field for the same purpose.
* Renamed protected DefaultNotificationService methods (removed "_" prefix).
* Adjusted the code providing a notification service accordingly.
* Changed the event message several notification services generated by renaming
the "opcode" field to "event".
* Implemented the TEAM_ADDED event and also added a TEAM_EXEC event.
* Added notifications for threads and images.
* Added visitor-like iteration functions for teams, threads, and images.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30126 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 51755cf8 15-Mar-2009 Axel Dörfler <axeld@pinc-software.de>

* Added DefaultNotificationService and DefaultUserNotificationService
implementations that can be used by subsystems that want to have a pretty
standard service. Only the latter is really complete, though.
* The notification manager is now available earlier in the boot process.
* Added notifications to teams/ports (only add/remove).
* The network notification implementation is now using the
DefaultUserNotificationService.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29543 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5ecc4b37 01-Mar-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Introduced ref-counting for the I/O contexts.
* The I/O context related vfs_*() functions have io_context* instead of void*
parameters/return values, now.
* vfs_new_io_context(): Lock the parent I/O context before getting its table
size. Otherwise the table size could change until we do.
* vfs_resize_fd_table(): Fixed use of MutexLocker. We created only a temporary
object, not one with function scope.
* Renamed load_image_etc() to load_image_internal() and added a parameter for
specifying the parent team of the one to create.
* Introduced a kernel private load_image_etc() with a few more arguments than
load_image().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29375 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2965c99f 23-Jun-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Changed the _kern_exec() and _kern_load_image() syscalls. They expect
a flattened argument/environment buffer now. This simplifies the work
for the kernel a bit, since it can just copy the buffer and check
whether it looks OK instead of messing around with individual strings.
The runtime loader also gets a flattened array.
* Set the maximum size of the arguments/environment buffer to 128 KB.
When more arguments are passed, we fail with a proper error code
(instead of just truncating the arguments as before).
* On exec*() the first argument was silently replaced by the given path
name, which is not correct.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26119 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d648afb8 11-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* For each userland team the kernel creates an area in the userland
address space that is fully locked and marked B_KERNEL_AREA. It can
thus be accessed by the kernel without additional checks.
* For each userland thread we do create a user_thread structure in that
area. The structure is accessible from userland via TLS, using the
private get_user_thread() function.
* Introduced private userland functions [un]defer_signals(). They can be
used to cheaply disable/re-enable signal delivery. They use the
user_thread::defer_signals/pending_signals fields which are
checked/updated by the kernel.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25451 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4a7f236b 09-Mar-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Process groups are now reference-counted. Processes in a group as well
as the death entries of a deceased processes that were in this group
and have not yet been reaped hold references to the group, so that it
won't be deleted until the group is empty and all gone group members
have been reaped. This fixes #1799 at last.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24335 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 923efaa8 05-Sep-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

* We store the ID of the controlling terminal and the foreground process
group ID with the session and let the terminal update them.
* Added an "orphaned" flag to the process_group structure and code to
maintain it.
* Handle the death of a controlling process correctly: The
foreground process group gets a SIGHUP and all newly-orphaned process
groups containing at least one stopped processes are sent
SIGHUP+SIGCONT.
* The tty handles the O_NOCTTY flag correctly, now.
* The tty handles reads/writes from processes from other sessions
correctly, now.
* Handle tcsetpgrp() from background processes correctly.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22187 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 24bcf559 27-Aug-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

* 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


# 74c0424a 26-Jul-2007 Axel Dörfler <axeld@pinc-software.de>

* Added a mechanism to retrieve a BMessage with eventual error descriptions
for _kern_load_image().
* Added KMessage to the runtime_loader (a bit hacky, though) - it will use
it to deliver the above mentioned functionality.
* load_dependencies() did return the wrong status code in case a library
was missing; now it returns B_MISSING_LIBRARY.
* load_dependencies() will now try to load all dependencies when a report
message is requested; therefore, all missing libraries are listed.
* Renamed uspace_program_args to user_space_program_args.
* The kernel filled in various members of the user_space_program_args structure
unsafely, ie. was not using user_memcpy().
* Renamed some local variables in team.c to better fit our style guide (ie.
uargs to userArgs).
* Changed Tracker to use the new _kern_load_image() variant on Haiku to retrieve
and report all missing libraries. This fixes bug #1324.
* Adapted kernel_cpp.cpp to the runtime loader as well; the latter will now
compile with _LOADER_MODE defined.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21715 a95241bf-73f2-0310-859d-f6bbb57e9c96


# cdcb0595 09-Jan-2007 Axel Dörfler <axeld@pinc-software.de>

* Renamed get_team_death_entry() to team_get_death_entry() and make it available
to other kernel components.
* wait_for_thread_etc() will now search the team's death entries in case the
thread is already gone; also resume_thread() is now done later, and its return
code will no longer matter (as we already have our death entry, no matter if
the thread is gone now or not).
* The fibo_load_image test now works as expected (only tested with low numbers
yet, though - the mean testing comes later (first comes functionality) :-))


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19758 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d9766fe3 25-Sep-2006 Axel Dörfler <axeld@pinc-software.de>

* Changed team_get_process_group_locked() to have a session parameter instead
of a team to avoid confusion. It now also accepts a NULL session pointer in
which case the actual group's session doesn't matter.
* Fixed the race condition in send_signal_etc() that could allow accessing an
invalid team pointer.
* Jerome's earlier change already fixed bug #841, and this also fixed bug #855.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18941 a95241bf-73f2-0310-859d-f6bbb57e9c96


# be0e7384 28-Aug-2006 Axel Dörfler <axeld@pinc-software.de>

* send_signal_etc() now handles a pid_t of -1 specially, but not yet really correct
(that was part of the problem of bug #702).
* Fixed send_signal_etc() when you called it with a pid_t of zero: the signals should
go to all teams in the calling team's group, not only to the team (for -1, we do
the same for now).
* Made team_get_process_group_locked() public, and rewrote send_signal_etc() to use
it.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18684 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 99c566f6 02-Aug-2005 Axel Dörfler <axeld@pinc-software.de>

Added a team watching mechanism in the kernel, not yet tested (but at least doesn't cause any harm yet :-)).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13888 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0dd3a50b 12-Mar-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

_user_load_image() has a flags parameter now. Added a new structure team_loading_info, which is referenced by the team structure while the team is being loaded..


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11695 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8e6c95bc 10-Mar-2005 Axel Dörfler <axeld@pinc-software.de>

Removed setenv()/getenv() syscalls - env is now changed on the heap.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11671 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 97dda329 13-Dec-2004 Axel Dörfler <axeld@pinc-software.de>

Some header work to reduce dependencies. Also fixes the debug build.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10434 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a32c8f26 30-Nov-2004 Axel Dörfler <axeld@pinc-software.de>

Renamed _kern_exit() to _kern_exit_team(), just to avoid any confusion.
Added real _user_exit_team() syscall (it was previously incorrectly mapped
to _user_exit_thread()).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10325 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 545ecbe8 30-Nov-2004 Axel Dörfler <axeld@pinc-software.de>

Extended the get_system_info() mechanism; it now gets info about threads/teams
as well as architecture specific stuff.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10313 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 08f58535 25-Nov-2004 Axel Dörfler <axeld@pinc-software.de>

Added syscalls for get_team_usage_info().


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10243 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e56c30d8 14-Oct-2004 Axel Dörfler <axeld@pinc-software.de>

Replaced the old _kern_create_team() syscall with a BeOS style _kern_load_image().


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9356 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 67c504a2 14-Oct-2004 Axel Dörfler <axeld@pinc-software.de>

Added various session/group/process syscalls.
Changed team_remove_team() to support process groups.
Added new prototype for team_delete_process_group().


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9347 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f3c2082a 10-Oct-2004 Axel Dörfler <axeld@pinc-software.de>

Added prototype for new team_get_address_space() function.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9278 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 367fa74a 15-Sep-2004 Axel Dörfler <axeld@pinc-software.de>

Added needed syscalls for fork(), exec(), and waitpid().


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8971 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 383cdedb 28-Aug-2004 Ingo Weinhold <ingo_weinhold@gmx.de>

Several follow-up changes required by the changes either to the VFS
syscalls or to the syscall mechanism (which exposed naming and parameter
inconsistencies).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8703 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 14f5ad8c 15-Mar-2004 Axel Dörfler <axeld@pinc-software.de>

Separated the team functions from the thread.h header into the new team.h.
Fixed fd.h to include that file.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6995 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 03fb2d886830e4dd4b344c56725db59f96733216 07-Nov-2013 Pawel Dziepak <pdziepak@quarnos.org>

kernel: Remove gSchedulerLock

* Thread::scheduler_lock protects thread state, priority, etc.
* sThreadCreationLock protects thread creation and removal and list of
threads in team.
* Team::signal_lock and Team::time_lock protect list of threads in team
as well.
* Scheduler uses its own internal locking.


# 9437559db1ae72a12b0edec44d4c538a08ceac0f 14-Jun-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added function team_init_exit_info_on_error() which initializes the team's
exit info with some generic status.
* team_create_thread_start(), common_thread_entry(): Initializes the team's
exit info (if that's the main thread) before calling thread_exit(). Fixes
#7686.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42183 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 24df65921befcd0ad0c5c7866118f922da61cb96 11-Jun-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Merged signals-merge branch into trunk with the following changes:
* Reorganized the kernel locking related to threads and teams.
* We now discriminate correctly between process and thread signals. Signal
handlers have been moved to teams. Fixes #5679.
* Implemented real-time signal support, including signal queuing, SA_SIGINFO
support, sigqueue(), sigwaitinfo(), sigtimedwait(), waitid(), and the addition
of the real-time signal range. Closes #1935 and #2695.
* Gave SIGBUS a separate signal number. Fixes #6704.
* Implemented <time.h> clock and timer support, and fixed/completed alarm() and
[set]itimer(). Closes #5682.
* Implemented support for thread cancellation. Closes #5686.
* Moved send_signal() from <signal.h> to <OS.h>. Fixes #7554.
* Lots over smaller more or less related changes.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42116 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4535495d80c86e19e2610e7444a4fcefe3e0f8e6 10-Jan-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Merged the signals branch into trunk, with these changes:
* The team and thread kernel structures have been renamed to Team and Thread
respectively and moved into the new BKernel namespace.
* Several (kernel add-on) sources have been converted from C to C++ since
private kernel headers are included that are no longer C compatible.

Changes after merging:
* Fixed gcc 2 build (warnings mainly in the scary firewire bus manager).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40196 a95241bf-73f2-0310-859d-f6bbb57e9c96


# db0331134210bf63c82a298bb734f5fda4167a38 02-Jan-2011 Oliver Tappe <zooey@hirschkaefer.de>

Closing #7056:
* inherit umask of calling process to images loaded via exec...()

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40071 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2d8d1cdbaa4448aa12a6e516b34a2e2cda52533b 15-Dec-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Implemented a generic way to associate data with a team which is
automatically cleaned up when the team is deleted: Class AssociatedData is
the base class for a data item, AssociatedDataOwner a container for them
(struct team derives from it). Functions team_associate_data() and
team_dissociate_data() add/remove data.
* Turned sTeamHash into a BOpenHashTable (necessary since struct team is no
longer a POD).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39860 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 56d734a1aa601a8a5cfc5dbc79433f96f4e1731e 16-Nov-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Added new private API to get more information on a team:
* Userland interface: get_extended_team_info().
* Syscall: _kern_get_extended_team_info.

Only partially implemented yet.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39453 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5662ae45852e028a196015a0309d04a46ad657f3 20-Jan-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Changed the team shutdown process a bit:
* The threads beside the main thread are killed earlier now (in the new
team_shutdown_team()), before removing the team from the team hash and from
its process group. This fixes #5296.
* Use a condition variable instead of a semaphore to wait for the non-main
threads to die. We notify the condition right after a thread has left the
team. The semaphore was released by the undertaker.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35196 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b0db552cd921ff16d61400ee5a5f855f392e8b87 01-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Renamed vm_address_space to VMAddressSpace.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34422 a95241bf-73f2-0310-859d-f6bbb57e9c96


# efd536ff89954302f42c59e2c71fba45e5cb4c25 11-Apr-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Cleared up a misconception in the notification mechanism. We already had
methods that used an "event mask" field. There was no need to introduce
a "flags" field for the same purpose.
* Renamed protected DefaultNotificationService methods (removed "_" prefix).
* Adjusted the code providing a notification service accordingly.
* Changed the event message several notification services generated by renaming
the "opcode" field to "event".
* Implemented the TEAM_ADDED event and also added a TEAM_EXEC event.
* Added notifications for threads and images.
* Added visitor-like iteration functions for teams, threads, and images.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30126 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 51755cf83253c3ebc37694505611eb82189c3b4d 15-Mar-2009 Axel Dörfler <axeld@pinc-software.de>

* Added DefaultNotificationService and DefaultUserNotificationService
implementations that can be used by subsystems that want to have a pretty
standard service. Only the latter is really complete, though.
* The notification manager is now available earlier in the boot process.
* Added notifications to teams/ports (only add/remove).
* The network notification implementation is now using the
DefaultUserNotificationService.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29543 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5ecc4b37752beba35afeb7ef446f07c3c6d01971 01-Mar-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Introduced ref-counting for the I/O contexts.
* The I/O context related vfs_*() functions have io_context* instead of void*
parameters/return values, now.
* vfs_new_io_context(): Lock the parent I/O context before getting its table
size. Otherwise the table size could change until we do.
* vfs_resize_fd_table(): Fixed use of MutexLocker. We created only a temporary
object, not one with function scope.
* Renamed load_image_etc() to load_image_internal() and added a parameter for
specifying the parent team of the one to create.
* Introduced a kernel private load_image_etc() with a few more arguments than
load_image().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29375 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2965c99fea660b23b03b58a3c9955a16bed0e019 23-Jun-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Changed the _kern_exec() and _kern_load_image() syscalls. They expect
a flattened argument/environment buffer now. This simplifies the work
for the kernel a bit, since it can just copy the buffer and check
whether it looks OK instead of messing around with individual strings.
The runtime loader also gets a flattened array.
* Set the maximum size of the arguments/environment buffer to 128 KB.
When more arguments are passed, we fail with a proper error code
(instead of just truncating the arguments as before).
* On exec*() the first argument was silently replaced by the given path
name, which is not correct.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26119 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d648afb8d7852cc7ca9819315356ec605e2e0ee7 11-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* For each userland team the kernel creates an area in the userland
address space that is fully locked and marked B_KERNEL_AREA. It can
thus be accessed by the kernel without additional checks.
* For each userland thread we do create a user_thread structure in that
area. The structure is accessible from userland via TLS, using the
private get_user_thread() function.
* Introduced private userland functions [un]defer_signals(). They can be
used to cheaply disable/re-enable signal delivery. They use the
user_thread::defer_signals/pending_signals fields which are
checked/updated by the kernel.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25451 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4a7f236b07f4e59aef53a5427eebd01f50c99d00 09-Mar-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Process groups are now reference-counted. Processes in a group as well
as the death entries of a deceased processes that were in this group
and have not yet been reaped hold references to the group, so that it
won't be deleted until the group is empty and all gone group members
have been reaped. This fixes #1799 at last.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24335 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 923efaa872b9fe4e9e9cae87effe2af5c338b98a 05-Sep-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

* We store the ID of the controlling terminal and the foreground process
group ID with the session and let the terminal update them.
* Added an "orphaned" flag to the process_group structure and code to
maintain it.
* Handle the death of a controlling process correctly: The
foreground process group gets a SIGHUP and all newly-orphaned process
groups containing at least one stopped processes are sent
SIGHUP+SIGCONT.
* The tty handles the O_NOCTTY flag correctly, now.
* The tty handles reads/writes from processes from other sessions
correctly, now.
* Handle tcsetpgrp() from background processes correctly.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22187 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 24bcf55926212cfc26ffbed2cb71fe3ca2b99c68 27-Aug-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

* 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


# 74c0424a43b550536d4b55b8fc13631ca4edfcb0 26-Jul-2007 Axel Dörfler <axeld@pinc-software.de>

* Added a mechanism to retrieve a BMessage with eventual error descriptions
for _kern_load_image().
* Added KMessage to the runtime_loader (a bit hacky, though) - it will use
it to deliver the above mentioned functionality.
* load_dependencies() did return the wrong status code in case a library
was missing; now it returns B_MISSING_LIBRARY.
* load_dependencies() will now try to load all dependencies when a report
message is requested; therefore, all missing libraries are listed.
* Renamed uspace_program_args to user_space_program_args.
* The kernel filled in various members of the user_space_program_args structure
unsafely, ie. was not using user_memcpy().
* Renamed some local variables in team.c to better fit our style guide (ie.
uargs to userArgs).
* Changed Tracker to use the new _kern_load_image() variant on Haiku to retrieve
and report all missing libraries. This fixes bug #1324.
* Adapted kernel_cpp.cpp to the runtime loader as well; the latter will now
compile with _LOADER_MODE defined.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21715 a95241bf-73f2-0310-859d-f6bbb57e9c96


# cdcb0595719ee5316c80f3af3f9b10ba76cd1e5c 09-Jan-2007 Axel Dörfler <axeld@pinc-software.de>

* Renamed get_team_death_entry() to team_get_death_entry() and make it available
to other kernel components.
* wait_for_thread_etc() will now search the team's death entries in case the
thread is already gone; also resume_thread() is now done later, and its return
code will no longer matter (as we already have our death entry, no matter if
the thread is gone now or not).
* The fibo_load_image test now works as expected (only tested with low numbers
yet, though - the mean testing comes later (first comes functionality) :-))


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19758 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d9766fe30b6e70e8b818709e7819066d593db835 25-Sep-2006 Axel Dörfler <axeld@pinc-software.de>

* Changed team_get_process_group_locked() to have a session parameter instead
of a team to avoid confusion. It now also accepts a NULL session pointer in
which case the actual group's session doesn't matter.
* Fixed the race condition in send_signal_etc() that could allow accessing an
invalid team pointer.
* Jerome's earlier change already fixed bug #841, and this also fixed bug #855.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18941 a95241bf-73f2-0310-859d-f6bbb57e9c96


# be0e738496393647d66552c9ab5487455fd85a9f 28-Aug-2006 Axel Dörfler <axeld@pinc-software.de>

* send_signal_etc() now handles a pid_t of -1 specially, but not yet really correct
(that was part of the problem of bug #702).
* Fixed send_signal_etc() when you called it with a pid_t of zero: the signals should
go to all teams in the calling team's group, not only to the team (for -1, we do
the same for now).
* Made team_get_process_group_locked() public, and rewrote send_signal_etc() to use
it.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18684 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 99c566f6c9a2482245e93353eb99afa0ee5cc300 02-Aug-2005 Axel Dörfler <axeld@pinc-software.de>

Added a team watching mechanism in the kernel, not yet tested (but at least doesn't cause any harm yet :-)).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13888 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0dd3a50bb343b9df3a9716d1c07f7079eed546af 12-Mar-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

_user_load_image() has a flags parameter now. Added a new structure team_loading_info, which is referenced by the team structure while the team is being loaded..


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11695 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8e6c95bcce3a476fa48310c95b923d7218feac10 10-Mar-2005 Axel Dörfler <axeld@pinc-software.de>

Removed setenv()/getenv() syscalls - env is now changed on the heap.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11671 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 97dda329edce2caf11004390ff9dce1a5b1a86d1 13-Dec-2004 Axel Dörfler <axeld@pinc-software.de>

Some header work to reduce dependencies. Also fixes the debug build.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10434 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a32c8f261f8ffb26c0a8413e3ace8852ce80be8e 30-Nov-2004 Axel Dörfler <axeld@pinc-software.de>

Renamed _kern_exit() to _kern_exit_team(), just to avoid any confusion.
Added real _user_exit_team() syscall (it was previously incorrectly mapped
to _user_exit_thread()).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10325 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 545ecbe86d5ba2c3ca5c07e18c2d3208d1eea11b 30-Nov-2004 Axel Dörfler <axeld@pinc-software.de>

Extended the get_system_info() mechanism; it now gets info about threads/teams
as well as architecture specific stuff.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10313 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 08f58535d92a7b87bec18dc12d4c12281db527ad 25-Nov-2004 Axel Dörfler <axeld@pinc-software.de>

Added syscalls for get_team_usage_info().


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10243 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e56c30d87dce8af76f58bc1fdc094bf56957fdc8 14-Oct-2004 Axel Dörfler <axeld@pinc-software.de>

Replaced the old _kern_create_team() syscall with a BeOS style _kern_load_image().


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9356 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 67c504a23a08b295770644239ce9ee6616e3a817 14-Oct-2004 Axel Dörfler <axeld@pinc-software.de>

Added various session/group/process syscalls.
Changed team_remove_team() to support process groups.
Added new prototype for team_delete_process_group().


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9347 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f3c2082a3dfe76530e8364bbc1e93a7831e4ba72 10-Oct-2004 Axel Dörfler <axeld@pinc-software.de>

Added prototype for new team_get_address_space() function.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9278 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 367fa74ad9bc9524367d10bfd1a6fa87b7002426 15-Sep-2004 Axel Dörfler <axeld@pinc-software.de>

Added needed syscalls for fork(), exec(), and waitpid().


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8971 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 383cdedbd2f1de98851f38bf12d8edef67346ffd 28-Aug-2004 Ingo Weinhold <ingo_weinhold@gmx.de>

Several follow-up changes required by the changes either to the VFS
syscalls or to the syscall mechanism (which exposed naming and parameter
inconsistencies).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8703 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 14f5ad8ce4e1f9502f7defab977670e86eea0950 15-Mar-2004 Axel Dörfler <axeld@pinc-software.de>

Separated the team functions from the thread.h header into the new team.h.
Fixed fd.h to include that file.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6995 a95241bf-73f2-0310-859d-f6bbb57e9c96