Commit Graph

20 Commits

Author SHA1 Message Date
Ingo Weinhold 4a7f236b07 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
2008-03-09 17:56:27 +00:00
Ingo Weinhold 923efaa872 * 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
2007-09-06 02:16:25 +00:00
Ingo Weinhold 24bcf55926 * 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
Axel Dörfler 74c0424a43 * 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
2007-07-27 02:32:19 +00:00
Axel Dörfler cdcb059571 * 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
2007-01-09 23:58:59 +00:00
Axel Dörfler d9766fe30b * 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
2006-09-26 12:51:59 +00:00
Axel Dörfler be0e738496 * 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
2006-08-29 01:41:16 +00:00
Axel Dörfler 99c566f6c9 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
2005-08-03 12:00:42 +00:00
Ingo Weinhold 0dd3a50bb3 _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
2005-03-12 15:11:08 +00:00
Axel Dörfler 8e6c95bcce 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
2005-03-10 23:04:48 +00:00
Axel Dörfler 97dda329ed 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
2004-12-13 22:22:45 +00:00
Axel Dörfler a32c8f261f 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
2004-12-01 04:14:55 +00:00
Axel Dörfler 545ecbe86d 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
2004-11-30 21:06:11 +00:00
Axel Dörfler 08f58535d9 Added syscalls for get_team_usage_info().
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10243 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-25 21:18:54 +00:00
Axel Dörfler e56c30d87d 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
2004-10-14 17:46:48 +00:00
Axel Dörfler 67c504a23a 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
2004-10-14 14:34:30 +00:00
Axel Dörfler f3c2082a3d 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
2004-10-10 17:26:34 +00:00
Axel Dörfler 367fa74ad9 Added needed syscalls for fork(), exec(), and waitpid().
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8971 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-09-15 15:42:02 +00:00
Ingo Weinhold 383cdedbd2 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
2004-08-28 20:45:00 +00:00
Axel Dörfler 14f5ad8ce4 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
2004-03-16 02:40:03 +00:00