Commit Graph

51 Commits

Author SHA1 Message Date
Axel Dörfler
e27751d3df Fixed a stupid bug in create_team_thread_start(): it copied the env variables
in the wrong direction for some time now, corrupting the argument area (user
apps would crash).
B_SYSTEM_TEAM is now reserved, so that no team can be created there.
Fixed some warnings when debug output is enabled.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9719 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-01 21:38:56 +00:00
Axel Dörfler
7605ddddf0 Replaced all remaining PAGE_SIZE with B_PAGE_SIZE and "addr" with addr_t.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9430 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-20 00:19:38 +00:00
Axel Dörfler
e1e5a66bc2 BeGeistert checkin: wait_for_child() does now work as expected for any
team and process group IDs as well.
Added a ToDo item that process groups do only work well as long as
their group leader is still active.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9394 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-18 15:16:00 +00:00
Axel Dörfler
2b6c3301f7 Forgot to put the forked team into its parent group in fork_team() - which
resulted in a nice crash on exit.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9371 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-15 16:14:51 +00:00
Axel Dörfler
a7fa05a54b Since arguments may on the stack even in the kernel, load_image() now
always copies the arguments and environment arrays.
No need for the "owns_arrays" in team_arg anymore - it now always owns
them.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9363 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-15 01:52:07 +00:00
Axel Dörfler
bd4b903e57 Switched from the old team_create_team() to a load_image() compatible mechanism.
The path name is now always taken from the provided argument list (except for
_user_exec() which now replaces args[0] with the path argument).
The team_arg structure know nows if it must delete its arguments or not - this
also fixes a memory leak in case team_create_team() failed when invoked from
userland.
load_image() is now also exported for the kernel.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9360 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-14 18:07:04 +00:00
Axel Dörfler
4711148ca9 wait_for_child() can now also wait on children in the current or any other
process ID (in the current session).
get_death_entry() could call free() with interrupts disabled; now follows
the same mechanism as chosen with the groups (ie. it returns a pointer
to a death_entry to be freed by the calling function).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9354 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-14 15:42:56 +00:00
Axel Dörfler
6a70123a9d Big update, but everything is related:
- we now have a working process group/session model. Implemented related syscalls
  and the kernel backend, some POSIX process functions are now available in the
  kernel as well.
- dying teams now monitor their exitus by leaving death_entry structures in
  their parent team.
- Implemented wait_for_child() for pid == -1 and pid > 0; IOW waiting for process
  groups is missing yet. Hasn't yet been tested intensively.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9350 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-14 14:46:12 +00:00
Axel Dörfler
fdbd1b5d7b fork_team() is working now! It might not be 100% complete (signal handling),
but the kernel part seems to work good enough for now.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9296 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-12 04:03:52 +00:00
Axel Dörfler
71eeb427c3 Implemented team_get_address_space() which gets you a pointer to the
team's address space - for internal use, anyway.
Added a ToDo: item to exec_team() to remind me of alarms and signals.
Started implementing fork_team() based on team_create_team() - it's not
completed (or even works), though.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9279 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-10 17:30:42 +00:00
Axel Dörfler
da504d877d Removed team::_aspace_id since it already has a direct pointer to it.
Changed the way a vm_address_space is deleted: instead of having to explicitly
call vm_delete_aspace(), the last vm_put_aspace() will remove it.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9255 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-07 17:17:04 +00:00
Axel Dörfler
acfca1a3f5 We now have a working exec_team() function (the backend of the exec() function family)!
Should be tested and verified more intensively, though.
Moved the creation, initialization, and deletion of the team_arg structure out of
team_create_team(); it's now also used by exec_team().
Renamed kfree_strings_array() to free_strings_array().
Renamed the fields of the team_arg structure to be more in sync with the names used
at other places.
Fixed the routine that copied the environment/arguments into the userland space.
Improved and fixed the user_copy_strings_array() function.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9250 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-07 15:34:17 +00:00
Axel Dörfler
0f5095f9f9 Now uses thread::user_stack_size instead of STACK_SIZE. This also fixes a
potential bug if MAIN_STACK_SIZE and STACK_SIZE would have been different.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9190 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-04 22:41:34 +00:00
Axel Dörfler
41f37da0fd Added empty and non-working syscalls for _user_fork(), _user_wait_for_child(),
and _user_exec().


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8973 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-09-15 15:45:37 +00:00
Axel Dörfler
05835518ae Added a function prototype and description on how the userland waitpid()
functionality could be supported.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8790 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-09-02 01:41:06 +00:00
Ingo Weinhold
f57dcf3200 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@8704 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-08-28 20:51:47 +00:00
Axel Dörfler
c06b6654f3 _user_wait_for_team() no longer tries to copy the return code if its storage location is NULL.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8561 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-08-13 19:08:35 +00:00
Axel Dörfler
6e0526544a Now cuts off the path when it gives a team's main thread its name.
Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7896 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-06-11 01:36:29 +00:00
Axel Dörfler
6f09e38dea team_create_team2() no longer panics if it couldn't create the userland
stack - it just fails now (since create_area() currently panics when it
fails, this is a cosmetic change anyway :-)).
Now correctly cleans up in case elf_load_user_image() fails.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7883 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-06-10 01:43:16 +00:00
Axel Dörfler
9c642b6454 Adjusted paths.
The stack of the main thread is now called "{team name}_main_stack" instead
of primary stack.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7863 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-06-08 21:35:14 +00:00
Stefano Ceccherini
389b7216d6 Fixed "team" debugger command (should be the last one)
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7625 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-05-21 10:17:08 +00:00
Axel Dörfler
b918b5035f Bye, bye elf_lookup_symbol(), hello get_image_symbol().
Also renamed elf_load_kspace() to load_kernel_add_on(), and friends.
The new unload_kernel_add_on() now has an image_id as parameter, no longer
a path (like the former elf_unload_kspace()).
Fixed missign file system unload.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7527 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-05-11 19:52:38 +00:00
Axel Dörfler
0cec1c047b No longer calls thread_kill_thread_nowait() but sends the signal directly
(because the former function doesn't exist anymore).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7008 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-03-17 15:25:43 +00:00
Axel Dörfler
8e14887212 Moved some dprintf()s to use the TRACE() macro.
Also fixed compilation with tracing enabled.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6999 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-03-16 03:14:48 +00:00
Axel Dörfler
074af04cf2 Factored out two new functions (team_remove_team() and team_delete_team())
from thread_exit().
Removed team_remove_team_from_hash() as it's no longer necessary.
Also incorporated NewOS change 1930: maintain the parent/children lists.
Cleaned up the headers.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6996 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-03-16 02:46:28 +00:00
Axel Dörfler
98d68e7085 Renamed syscalls to new scheme.
Moved wait_for_team() into the exported kernel API region.
Added missing call for _user_get_current_team().
Made the team_kill_team() call to the BeOS compatible kill_team().


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6868 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-03-03 00:57:00 +00:00
Axel Dörfler
f4d747d77b No longer uses user_strcpy(), and it's even slightly faster.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6696 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-02-23 05:08:17 +00:00
Axel Dörfler
faeac94982 Removed <kerrors.h> and the last occurences of ERR_* codes.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6690 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-02-23 04:12:34 +00:00
Axel Dörfler
48f31b9581 Replaced team_get_team_struct() with its safer friend team_is_valid().
Replaced SYS_MAX_OS_NAME_LEN with B_OS_NAME_LENGTH.
Banned strncpy().
Some cleanup.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6689 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-02-23 04:08:09 +00:00
Axel Dörfler
38afe35e66 Renamed CHECK_USER_ADDRESS() to IS_USER_ADDRESS() to make its function more clear.
Added our license to the updated source files.
Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6672 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-02-22 14:52:59 +00:00
Axel Dörfler
f2eb00db1e Fixed and simplified the user_*() team syscalls.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5331 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-11-12 15:37:44 +00:00
Axel Dörfler
b5a05a72fa Fixed some warnings.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4596 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-09-09 02:36:52 +00:00
beveloper
40ac5c5195 cvs server: Up-to-date check failed for `src/kernel/core/vm/vm.c'
cvs [server aborted]: correct above errors first!
cvs commit: saving log message in /tmp/cvsFPtfaj


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4344 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-08-20 02:48:15 +00:00
Axel Dörfler
cbc1309c68 Replaced some more vm_create_anonymous_region() with create_area() and
create_area_etc().


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4323 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-08-19 17:38:13 +00:00
Axel Dörfler
08b73e5905 Added another argument parameter for the thread creation code. Helps
implementing a more efficient on_exit_thread().
Note, this extra parameter is currently only used for user space code,
not yet in the kernel; thus on_exit_thread() is not available in the kernel.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3075 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-04-18 09:38:28 +00:00
Axel Dörfler
6d8aafc66e Added comments to sys_(get|put)env() - please remove them from the kernel.
Renamed team_wait_on_team() to wait_for_team() (more BeOS-alike).
Adapted to other changes (new thread functions).
Cleanups.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2576 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-01-27 03:09:33 +00:00
Axel Dörfler
429578fb0b Team/image stuff now uses lists instead of kqueues.
The kernel_daemon now utilizes the updated list API.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2567 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-01-26 23:31:38 +00:00
Axel Dörfler
c8019cad42 Added support for the image queue in the team structure.
Adapted because of changing structure names (struct uspace_program_args).
Added comments, fill_team_info() now sets the team_info.image_count correctly.
Some cleanups and style changes.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2426 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-01-12 16:29:28 +00:00
Axel Dörfler
59cbb92fdf team_create_team2() now also allocates a region for TLS in the primary stack
area. It now also calls arch_thread_init_tls(). Cleaned it up to make it more
readable, added some comments.
Some other cleanups.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2381 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-01-07 09:40:59 +00:00
Axel Dörfler
722bf47f67 Added some ToDo items.
Smaller cleanup.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2365 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-01-06 08:10:54 +00:00
Axel Dörfler
744761bf27 Removed the team->path variable. Renamed ioctx to io_context.
Some cleanups, moved user_*() functions to the end of the file.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2144 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-12-03 14:17:53 +00:00
Axel Dörfler
3ae9bebe33 Fixes for the khash changes.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2117 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-29 08:38:52 +00:00
Axel Dörfler
41691b996a Replaced kmalloc(), kfree(), and kstrdup() with the POSIX equivalents.
Implemented realloc().
Adapted all other sources, some minor cleanups in some files as well.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1773 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-10-29 23:07:06 +00:00
lillo
5cdacbaabb *LOTS* of small changes to make the kernel compatible with Be's KernelExport.h
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1683 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-10-26 16:13:36 +00:00
lillo
8fe70e8212 beos compatibility fixes: exit_thread now issues a signal; wait_for_thread returns B_INTERRUPTED if target thread gets killed
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1674 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-10-26 01:11:15 +00:00
Daniel Reinhold
4123d76182 bug fix: addr is an unsigned long, not a pointer type
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1645 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-10-25 11:08:39 +00:00
Axel Dörfler
e58fbc960b Adapted the VFS and internal file systems with respect to changes made
in fs_interface.h.
Fixed many warnings due to the int/int32/status_t changes.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1137 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-09-23 23:24:12 +00:00
Axel Dörfler
fbc9a56c28 Added a missing return value.
Some code cleanups.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@590 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-08-05 05:26:52 +00:00
lillo
91363a4278 Converted thread states to BeOS equivalents (excluding THREAD_STATE_FREE_ON_RESCHED, which will probably go away once the slab allocator is in). Converted priorities to BeOS equivalents; we now have 60 priority queues to map the 120 BeOS priority levels (which have a granularity of 2, thanks Axel) plus the idle queue. Fixed PS.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@573 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-08-04 20:10:06 +00:00
lillo
854c31f835 finished implementing get_thread_info, get_next_thread_info, get_team_info, get_next_team_info. New ps command behaving like the BeOS one is here, but doesn't work as libroot seems to crash when loaded at process startup... :/
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@570 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-08-04 02:04:37 +00:00