#
1f2e9ca2 |
|
24-Jun-2023 |
Niels Sascha Reedijk <niels.reedijk@gmail.com> |
kernel: ignore overflow warnings in teams.cpp and threads.cpp GCC's overflow checker gives a warning about the potential that the atomic functions called in teams.cpp and threads.cpp will write to a null-pointer. In this case, it is safe to assume that the values will never be null, therefore these warnings can be safely ignored. Relates to/fixes #17734 Change-Id: I777ff96f2812ed7d3ba57a46cad89ef6994cb08f Reviewed-on: https://review.haiku-os.org/c/haiku/+/6643 Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org> Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
|
#
93d7d1c5 |
|
12-Jun-2023 |
Augustin Cavalier <waddlesplash@gmail.com> |
user_mutex: Per-team contexts. This requires the introduction of the flag B_USER_MUTEX_SHARED, and then actually using the SHARED flags in pthread structures to determine when it should be passed through. This commit still uses wired memory even for per-team contexts. That will change in the next commit. GLTeapot FPS seems about the same. Change-Id: I749a00dcea1531e113a65299b6d6610f57511fcc Reviewed-on: https://review.haiku-os.org/c/haiku/+/6602 Reviewed-by: waddlesplash <waddlesplash@gmail.com> Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
|
#
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.
|
#
33dd436f |
|
08-Apr-2023 |
Augustin Cavalier <waddlesplash@gmail.com> |
kernel/team: Fix race condition in team loading wait. The condition variable that the load_image'ing thread is waiting on is also owned by that same thread, so as soon as it wakes up, it will soon return, thus destroying it. Under high load or other unlucky scheduling conditions, it seems this could occur before the other thread had even returned from the condition variable's NotifyAll. Since team->loading_info is protected by the team lock, simply acquire the team lock once more after being awoken and returning, to synchronize and prevent this race. Should fix #18352.
|
#
589b419c |
|
18-Feb-2022 |
Augustin Cavalier <waddlesplash@gmail.com> |
kernel/team: Handle setpigd() being invoked for exiting teams. In the case the team has already been removed from its process group, this means we are far enough into teardown that we cannot change it. Simply check for NULL and then return an error if so. Fixes #17448.
|
#
e51f545c |
|
09-Feb-2022 |
Augustin Cavalier <waddlesplash@gmail.com> |
kernel/team: Clear group_id when removing a team from a group. And remove a redundant clear of the group pointer.
|
#
b396a5b2 |
|
09-Feb-2022 |
Augustin Cavalier <waddlesplash@gmail.com> |
kernel/team: Clean up and reorder Team initializer. * Put all fields in the same order they are in the header. * Add missing initializers for various fields to NULL or -1; while these should be initialized by later routines, for consistency's sake we should also clear them here.
|
#
e372ec1e |
|
09-Feb-2022 |
Augustin Cavalier <waddlesplash@gmail.com> |
kernel: Use KernelReferenceable for the supplementary_groups array. Instead of the malloc_referenced system. Makes for some cleaner code, and the malloc_referenced system was only used here, so it can now be dropped altogether.
|
#
057fe191 |
|
01-Sep-2021 |
Augustin Cavalier <waddlesplash@gmail.com> |
kernel: Break thread-related AutoLockers into a separate header. Including thread.h brings a massive array of things with it from the kernel thread arch headers, team and thread definitions, hash tables, linked lists, Referenceable, etc. that the vast majority of AutoLock.h consumers neither want nor need. So, put these in a separate header, and adjust all consumers of these lockers to include the new file. This change exposes the fact that a lot of files were inadvertently making use of headers included indirectly through thread.h. Those will be fixed in the next commit.
|
#
3ca830e3 |
|
27-Aug-2021 |
Augustin Cavalier <waddlesplash@gmail.com> |
kernel/team: Adjust address_space assignment slightly. For the kernel team, we now assign it in team_init instead of having a special case in Team::Team(), making things more similar to the userland team creation. Should not change any real functionality as Team::Create calls almost nothing outside of this file.
|
#
a267f17c |
|
13-Aug-2021 |
X512 <danger_mail@list.ru> |
kernel/vm: fix several vm bugs in riscv64 team.cpp address_space change is needed in arch_thread_init_kthread_stack to set initial thread page translation map. It also allows to simplify some debugger code. DEBUG_PAGE_ACCESS check is currently incorrectly implemented in RISCV64VMTranslationMap and disabled to avoid panic. gHtifRegs = 0 change is needed to avoid using HTIF when it is not available. gHtifRegs != NULL check is used to detect that HTIF is present. 0x40008000 is TinyEMU HTIF address. HTIF is emulator specific device that provide serial IO and shutdown capability (and maybe something else depending on virtual machine). Change-Id: Ic4d567b28c49799ae0f55223dd983a752823bab4 Reviewed-on: https://review.haiku-os.org/c/haiku/+/4328 Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com> Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
|
#
03ee0e55 |
|
16-Nov-2020 |
X512 <danger_mail@list.ru> |
kernel/team: add ability to get parent PID of arbitrary process Fixes #16607. Change-Id: Ia20bbde2cf078b6b99904f4e868730cbc70889c5 Reviewed-on: https://review.haiku-os.org/c/haiku/+/3400 Reviewed-by: X512 <danger_mail@list.ru> Reviewed-by: Axel Dörfler <axeld@pinc-software.de> Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
|
#
36aafa56 |
|
04-Dec-2020 |
X512 <danger_mail@list.ru> |
fix build after CObjectDeleter interface change Change-Id: I76e217abcd13c22c4d68170e07333cdde4d7a891 Reviewed-on: https://review.haiku-os.org/c/haiku/+/3461 Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
|
#
331889d0 |
|
28-Aug-2020 |
Niels Sascha Reedijk <niels.reedijk@gmail.com> |
Kernel/Threads: remove limit on number of dead threads in a team When a thread is created, it is expected that some other thread (usually the creating thread) will want to make sure it completes. This is done using the pthread_join() or wait_for_thread() calls. It is possible that threads end before another thread waits for its completion. That's why there is a dead thread list for each team, which holds thread ids and their exit status so that a call to pthread_join() or wait_for_thread() in the future can complete succesfully. The dead thread list was limited to 32 threads per team. If there would be more, the oldest thread would be kicked off. This could cause issues in situations where a team would create more than 32 threads, and would start waiting for their result after they have finished. Some of the calls would fail because the threads would no longer be in the dead list. This specifically caused problems for cargo (the Rust package manager), which could depending on the number of dependencies, could create more than 32 threads. See: https://github.com/nielx/rust/issues/3 This change removes the limit of dead threads within a team. Note that there is a risk that a badly written program that does not detach or joins its threads can make this an endless list, but the impact is relatively small (dead threads only occupy a bit of kernel memory). Change-Id: I0135dd54e10ee48a529f23228d21237d4f1a74e2 Reviewed-on: https://review.haiku-os.org/c/haiku/+/3178 Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
|
#
75a10a74 |
|
22-Aug-2020 |
Michael Lotz <mmlr@mlotz.ch> |
kernel/vm: Make vm_copy_area take page protections into account. When copying an area with vm_copy_area only the new protection would be applied and any possibly existing page protections on the source area were ignored. For areas with stricter area protection than page protection, this lead to faults when accessing the copy. In the opposite case it lead to too relaxed protection. The currently only user of vm_copy_area is fork_team which goes through all areas of the parent and copies them to the new team. Hence page protections were ignored on all forked teams. Remove the protection argument and instead always carry over the source area protection and duplicate the page protections when present. Also make sure to take the page protections into account for deciding whether or not the copy is writable and therefore needs to have copy on write semantics. Change-Id: I52f295f2aaa66e31b4900b754343b3be9a19ba30 Reviewed-on: https://review.haiku-os.org/c/haiku/+/3166 Reviewed-by: waddlesplash <waddlesplash@gmail.com>
|
#
4986a9a3 |
|
24-May-2020 |
Michael Lotz <mmlr@mlotz.ch> |
Revert "kernel: Remove the B_KERNEL_AREA protection flag." This reverts parts of hrev52546 that removed the B_KERNEL_AREA protection flag and replaced it with an address space comparison. Checking for areas in the kernel address space inside a user address space does not work, as areas can only ever belong to one address space. This rendered these checks ineffective and allowed to unmap, delete or resize kernel managed areas from their respective userland teams. That protection was meant to be applied to the team user data area which was introduced to reduce the kernel to userland overhead by directly sharing some data between the two. It was intended to be set up in such a manner that this is safe on the kernel side and the B_KERNEL_AREA flag was introduced specifically for this purpose. Incidentally the actual application of the B_KERNEL_AREA flag on the team user data area was apparently forgotten in the original commit. The absence of that protection allowed applications to induce KDLs by modifying the user area and generating a signal for example. This change restores the B_KERNEL_AREA flag and also applies it to the team user data area. Change-Id: I993bb1cf7c6ae10085100db7df7cc23fe66f4edd Reviewed-on: https://review.haiku-os.org/c/haiku/+/2836 Reviewed-by: waddlesplash <waddlesplash@gmail.com>
|
#
f4e3bb1c |
|
10-Jul-2019 |
Augustin Cavalier <waddlesplash@gmail.com> |
kernel/team: Avoid allocating memory in _user_get_extended_team_info. Terminal calls this multiple times a second per open tab, so it was spamming up my malloc logs. I don't see any reason this 60-byte structure needs to be on the heap; so, leave it on the stack instead. Change-Id: I3f1ac14fe9bfec39cd0d5668c68f84467450b0c0 Reviewed-on: https://review.haiku-os.org/c/1580 Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
|
#
5c97129c |
|
07-Jul-2019 |
Augustin Cavalier <waddlesplash@gmail.com> |
kernel/team: Remove team_get_team_struct, add team_geteuid. Thanks to Axel for the review.
|
#
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.)
|
#
33f7f287 |
|
13-May-2019 |
Augustin Cavalier <waddlesplash@gmail.com> |
kernel & runtime_loader: Don't load from non-packaged when "Disable user add-ons" is set. Confirmed to fix #14361. It is finally possible to un-brick an install with a bad system library in non-packaged without having to use another install to do so. Change-Id: Iafea7821f02cb34e77c766b1f97d1c19206b1081 Reviewed-on: https://review.haiku-os.org/c/1452 Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
|
#
47517233 |
|
01-Feb-2019 |
Augustin Cavalier <waddlesplash@gmail.com> |
headers/kernel: Move B_WAIT_TILL_LOADED to a syscall header. It is only used as an argument to _kern_load_image directly, not to any of the load_image functions in image.h, so it belongs in a syscall- specific header like other such constants. No functional change intended.
|
#
32d42741 |
|
31-Jan-2019 |
Augustin Cavalier <waddlesplash@gmail.com> |
kernel/team: Use a rw_spinlock to guard the sTeamsHash. Virtually identical to my prior change to sThreadsHash.
|
#
13beda00 |
|
26-Dec-2018 |
Michael Lotz <mmlr@mlotz.ch> |
kernel: Fix race condition when waiting for load of new team. There was no synchronization of the check of the done flag and the waiting thread suspending to wait for it. It was therefore possible that the new team both set the flag and triggered the wakeup of the waiting thread in that time window, causing it to miss both the set flag and the thread resumption. Use a condition variable instead. Fixes #13081. Change-Id: I93c45db8dd773fe42b45c4b67153bcd39e200d3b Reviewed-on: https://review.haiku-os.org/803 Reviewed-by: waddlesplash <waddlesplash@gmail.com>
|
#
513403d4 |
|
14-Jun-2018 |
Augustin Cavalier <waddlesplash@gmail.com> |
Revert team and thread changes for COMPAT_MODE (hrev52010 & hrev52011). This reverts commit c558f9c8fe54bc14515aa62bac7826271289f0e4. This reverts commit 44f24718b1505e8d9c75e00e59f2f471a79b5f56. This reverts commit a69cb330301c4d697daae57e6019a307f285043e. This reverts commit 951182620e297d10af7fdcfe32f2b04d56086ae9. There have been multiple reports that these changes break mounting NTFS partitions (on all systems, see #14204), and shutting down (on certain systems, see #12405.) Until they can be fixed, they are being backed out.
|
#
95118262 |
|
20-May-2018 |
Jérôme Duval <jerome.duval@gmail.com> |
kernel/x86_64: setup a new team in compatibility mode. * in load_image_internal(), elf32_load_user_image checks whether the binary format requires the compatibility mode. * we then set up the flag THREAD_FLAGS_COMPAT_MODE and the address space size. * the compatibility mode runtime_loader is hardcoded with x86/runtime_loader. * if needed, the 64-bit flat_args structure is converted in-place to its 32-bit layout. * a 32-bit flat_args isn't handled yet (a 32-bit team execs a 64-bit binary). Change-Id: Ia6a066bde8d1774d85de29b48dc500e27ae9668f
|
#
bec80c1c |
|
10-Feb-2018 |
Jérôme Duval <jerome.duval@gmail.com> |
white space cleanup
|
#
36ef138c |
|
02-Jan-2018 |
Michael Lotz <mmlr@mlotz.ch> |
kernel: Implement WEXITED for waitid. Previously dead teams were always returned (as needed for wait/waitpid). Using waitid it should however be possible to omit the WEXITED flag to only get stopped (WUNTRACED | WSTOPPED) or continued (WCONTINUED) teams. Adjust the other caller of the _kern_wait_for_child syscall, used by the various less specific wait* functions, to always include WEXITED. This avoids having to special case waitid in the syscall interface or with an extra flag. Add a check to ensure that any of these flags is set to avoid the now possible case of nothing being specified. This fails with B_BAD_VALUE (EINVAL) as on other systems.
|
#
63e2d201 |
|
02-Jan-2018 |
Michael Lotz <mmlr@mlotz.ch> |
kernel: Treat WSTOPPED synonymous to WUNTRACED. On other systems their values are usually aliased. We defined them as two different values, but didn't handle WSTOPPED anywhere. The check is now simply extended to cover both bits.
|
#
afe8d662 |
|
02-Jan-2018 |
Michael Lotz <mmlr@mlotz.ch> |
kernel: Avoid double lock in wait_for_child with child == team. When wait_for_child was called with a child argument equal to the current team, the team was locked again to check if it was a child of itself. This is now handled the same way as on other systems, where this case results in ECHILD (and not EINVAL).
|
#
04c3bd6c |
|
19-Dec-2017 |
Augustin Cavalier <waddlesplash@gmail.com> |
Team: Defer adding the team to parent and hash until just before starting. Previously I had intended to take the simpler route and just lock the already-inserted team before setting the io_context (as in prior commits), but after hearing some reports from users that some other seemingly unrelated KDLs had possibly cleared up after the first iteration of that fix, I decided to go with this route instead. Now we do not insert the team into the parent and hash and send the notification until just before the team's main thread is actually started; i.e. we now initialize not only io_context but also the team's args, VM address space, and user data (and if creation of any of these fails we do not inset the team into the hash at all.) Since the team structure was not locked at all while this initialization was taking place, any number of race-dependent bugs could have been caused by this on multicore systems.
|
#
4ecdf1e1 |
|
19-Dec-2017 |
Augustin Cavalier <waddlesplash@gmail.com> |
team: Only lock while actually setting io_context, not while creating it. Thanks Ingo for the review!
|
#
11b65332 |
|
17-Dec-2017 |
Augustin Cavalier <waddlesplash@gmail.com> |
kernel/team: Lock the team while modifying the io_context. Second part of the fix for #13861. Thanks Ingo for the review!
|
#
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
|
#
9969137c |
|
18-Dec-2016 |
Jérôme Duval <jerome.duval@gmail.com> |
fork(): Follow-up fix to 17b2a3cfc. * Ingo rightly noticed that the defer_signals counter is reinitialized on thread's user area creation. Setting the flag THREAD_CREATION_FLAG_DEFER_SIGNALS indeed gives the expected behavior, deferring signals until undefer_signals() is called in the child thread. Thanks for the review and fix suggestion. * Added a simple test showing the values of the defer_signals counter after fork().
|
#
a689b8f2 |
|
22-May-2016 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
kernel: team_create_thread_start_internal(): Set text_delta The commpage's symbol table entries are commpage start relative.
|
#
9266cd66 |
|
29-Apr-2016 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
extended_image_info: Add text_delta field Needed to offset a symbol address read from the symbol table to the actual load address.
|
#
8c6cb8af |
|
26-Apr-2016 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
runtime loader: Register extended image info with kernel Add structure extended_image_info which extends image_info by the fields symbol_table, symbol_hash, string_table.
|
#
467fe4ca |
|
24-Apr-2016 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
kernel: Add core dump facility * Add function core_dump_write_core_file(). It writes a core file for the current thread's team. The file format is similar to that of other OSs (i.e. ELF with PT_LOAD segments and a PT_NOTE segment), but most of the notes are Haiku specific (infos for team, areas, images, threads). More data will probably need to be added. * Add team flag TEAM_FLAG_DUMP_CORE, thread flag THREAD_FLAGS_TRAP_FOR_CORE_DUMP, and Team property coreDumpCondition, a condition variable available while a core dump is progress. A thread that finds its flag THREAD_FLAGS_TRAP_FOR_CORE_DUMP set before exiting the kernel to userland calls core_dump_trap_thread(), which blocks on the condition variable until the core dump has finished. We need the team's threads to stop so we can get their CPU state (and have a generally unchanging team state while writing the core file). * Add user debugger message B_DEBUG_WRITE_CORE_FILE. It causes core_dump_write_core_file() to be called for the team. * Dumping core as an immediate effect of a terminal signal has not been implemented yet, but that should be fairly straight forward.
|
#
5df5223b |
|
07-Oct-2015 |
Simon South <ssouth@simonsouth.com> |
kernel: Don't send SIGTTOU if calling thread is blocking it POSIX requires SIGTTOU to be sent to a process in a background process group that tries to change the foreground process group ID associated with its controlling terminal, unless the process is ignoring SIGTTOU or the calling thread is blocking it. Previously the code checked the former condition but not the latter, making it possible for calls to tcsetpgrp() to get stuck in a loop and never return. Should fix #3417. Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>
|
#
dfb13a87 |
|
29-Oct-2014 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Increase the size of the kernel FD table With packagefs potentially opening quite a few packages the default of 256 slots is a bit tight. It's 4096 now, which should be safe for a while, but we might want to consider resizing the table dynamically and probably even switching to another algorithm for allocating the slots. Should fix #11328.
|
#
52d500e5 |
|
28-Oct-2014 |
Michael Lotz <mmlr@mlotz.ch> |
kernel: Workaround for double lock of spinlock in user timers. The thread that is being [un]scheduled already has its time_lock locked in {stop|continue}_cpu_timers(). When updating the TeamTimeUserTimer, the team is asked for its cpu time. Team::CPUTime() then iterates the threads of the team and locks the time_lock of the thread again. This workaround passes a possibly locked thread through the relevant functions so Team::CPUTime() can decide whether or not a thread it iterates needs to be locked or not. This works around #11032 and its duplicates #11314 and #11344.
|
#
b1673075 |
|
16-Mar-2014 |
Pawel Dziepak <pdziepak@quarnos.org> |
kernel: Properly synchronize suspending new thread After load_image() the child thread is suspended and the parent is expected to resume it later. However, it is possible that the parent attempts to resume its child after it has been notified that the image had been loaded but before the child managed to suspend itself. In such case the child would suspends itself after that wake up attempt and, consequently will not be ever resumed. To mitigate that problem flag Thread::going_to_suspend has been added which helps synchronizing thread suspension and continuation in a similar way that "traditional" thread blocking is performed. This means that the child should behave in a following manner: set its going_to_suspend flag, notify the parent (i.e. any thread that may want to resume it), acquire its scheduler_lock and suspend itself if the going_to_suspend flag is set. The parent should follow pattern: clear going_to_suspend flag of the thread that is about to be resumed, acquire that thread scheduler_lock and enqueue it in a run queue if it is suspended. Thanks Oliver for reporting the bug and identifying what causes it.
|
#
73db12ab |
|
19-Jan-2014 |
Pawel Dziepak <pdziepak@quarnos.org> |
kernel: Align user_thread objects to CACHE_LINE_SIZE
|
#
dac7b7c9 |
|
06-Dec-2013 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Fix various 64 bit related warnings Mostly printf() format strings and signed-unsigned comparisons. Fixes the x86_64 build.
|
#
7bf85edf |
|
30-Nov-2013 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Allow disabling ASLR via DISABLE_ASLR environment variable * VMAddressSpace: Add randomizingEnabled property. * VMUserAddressSpace: Randomize addresses only when randomizingEnabled property is set. * create_team_arg(): Check, if the team's environment contains "DISABLE_ASLR=1". Set the team's address space property randomizingEnabled accordingly in load_image_internal() and exec_team().
|
#
2b7ea4cd |
|
29-Nov-2013 |
Pawel Dziepak <pdziepak@quarnos.org> |
kernel: Remove Thread::next_state
|
#
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.
|
#
72addc62 |
|
07-Nov-2013 |
Pawel Dziepak <pdziepak@quarnos.org> |
kernel: Introduce Thread::time_lock and Team::time_lock
|
#
aa4aca02 |
|
06-Nov-2013 |
Pawel Dziepak <pdziepak@quarnos.org> |
kernel: Protect signal data with Team::signal_lock
|
#
7f64b301 |
|
26-Oct-2013 |
Julian Harnath <julian.harnath@rwth-aachen.de> |
Reduce lock contention in kernel port subsystem. * Replace ports list mutex with R/W-lock. * Move team port list protection to separate array of mutexes. Relieve contention on sPortsLock by removing Team::port_list from its protected items. With this, set_port_owner() only needs to acquire the sPortsLock for reading. * Add another hash table holding the ports by name. Used by find_port() so it doesn't have to iterate over the list anymore. * Use slab-based memory allocator for port messages. sPortQuotaLock was acquired on every message send or receive and was thus another point of contention. The lock is not necessary anymore. * Lock for port hashes and Port::lock are no longer locked in a nested fashion to reduce chances of blocking other threads. * Make operations concurrency-safe by adding an atomically accessed Port::state which provides linearization points to port creation and deletion. Both operations are now divided into logical and physical parts, the logical part just updating the state and the physical part adding/remove it to/from the port hash and team port list. * set_port_owner() is the only remaining function which still locks Port::lock and one or two of sTeamListLock[] in a nested fashion. Since it needs to move the port from one team list to another and change Port::owner, there's no way around. * Ports are now reference counted to make accesses to already-deleted ports safe. * Should fix #8007.
|
#
de49e349 |
|
04-Oct-2013 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Add symbol versioning for find_directory() Should already have been done back when the semantics for the B_COMMON_*DIRECTORY constants was changed. Currently old and new version behave the same. So this is just a contingency measure ATM.
|
#
2eb2b522 |
|
01-Jul-2013 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Enforce team and thread limits Also fixes incorrect team accounting in case of error when creating a team. The previously incremented sUsedTeams wasn't decremented again.
|
#
cbcde3ba |
|
01-Jul-2013 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
kernel team.cpp: fix unbalanced io_context ref management ... in case of team creation error. Once assigned to Team::io_context the Team object takes responsibility of the I/O context object and releases the reference on destruction. load_image_internal() and fork_team() were thus releasing one reference too many. Fixes #9851.
|
#
c24adb29 |
|
19-Apr-2013 |
Rene Gollent <anevilyak@gmail.com> |
Rework DefaultNotificationService registration. - Instead of implicitly registering and unregistering a service instance on construction/destruction, DefaultNotificationService now exports explicit Register()/Unregister() calls, which subclasses are expected to call when they're ready. - Adjust all implementing subclasses. Resolves an issue with deadlocks when booting a DEBUG=1 build.
|
#
f697412f |
|
03-Apr-2013 |
Pawel Dziepak <pdziepak@quarnos.org> |
vm: place commpage and team data near the top of user address space Placing commpage and team user data somewhere at the top of the user accessible virtual address space prevents these areas from conflicting with elf images that require to be mapped at exact address (in most cases: runtime_loader).
|
#
e85e399f |
|
17-Mar-2013 |
Pawel Dziepak <pdziepak@quarnos.org> |
commpage: randomize position of commpage This patch introduces randomization of commpage position. From now on commpage table contains offsets from begining to of the commpage to the particular commpage entry. Similary addresses of symbols in ELF memory image "commpage" are just offsets from the begining of the commpage. This patch also updates KDL so that commpage entries are recognized and shown correctly in stack trace. An update of Debugger is yet to be done.
|
#
02cceebe |
|
04-Mar-2013 |
Pawel Dziepak <pdziepak@quarnos.org> |
team: randomize position of team user data When forking a process team user data area is not cloned but a new one is created instead. However, the new one has to be at exactly the same address parent's team user data area is. When process is exec then team user data area may be recreated at random position. This patch also make sure that instances of struct user_thread in team user data are each in separate cache line in order to prevent false sharing since these data are very likely to be accessed simultaneously from threads executing on different CPUs. This change however reduces the number of threads process can create. It is fixed by reserving 512kB of address space in case team user data area needs to grow.
|
#
d1f280c8 |
|
01-Apr-2012 |
Hamish Morrison <hamishm53@gmail.com> |
Add support for pthread_attr_get/setguardsize() * Added the aforementioned functions. * create_area_etc() now takes a guard size parameter. * The thread_info::stack_base/end range now refers to the usable range only.
|
#
45132e2b |
|
17-Sep-2012 |
Prasad Joshi <prasadjoshi.linux@gmail.com> |
ps: fix uid and gid in the ps output The function fill_team_info() completely ignored the user id and the group id of the process (fields info->uid and info->gid respectively). Since the info structure was zeroed earlier, the ps output showed uid and gid of each process equal to zero. The patch fixes the problem by properly initializing the members with effective uid and gid. Now the output is correct. Fixes #8995. Signed-off-by: Ryan Leavengood <leavengood@gmail.com>
|
#
6e2f6d1a |
|
29-Jul-2012 |
Alex Smith <alex@alex-smith.me.uk> |
Changed cookie type for get_next_area_info() to ssize_t. The cookie is used to store the base address of the area that was just visited. On 64-bit systems, int32 is not sufficient. Therefore, changed to ssize_t which retains compatibility on x86 while expanding to a sufficient size on x86_64.
|
#
07c6bd65 |
|
23-Jul-2012 |
Alex Smith <alex@alex-smith.me.uk> |
Format string fixes for TRACE_{THREAD,TEAM}.
|
#
c3f0fd28 |
|
12-Jul-2012 |
Alex Smith <alex@alex-smith.me.uk> |
Fixed formatting of output in some debugger commands. Currently all debugger commands assume 32-bit pointers when formatting their output. This means that on x86_64 the output is incorrectly formatted. Fixed this by adding a B_PRINTF_POINTER_WIDTH definition (16 on 64-bit, 8 on 32-bit), and using this to correctly format the output. Not all commands have been fixed yet, but all VM, slab, VFS, team, thread and image commands should be correct.
|
#
4be4fc6b |
|
15-Jun-2012 |
Alex Smith <alex@alex-smith.me.uk> |
More 64-bit compilation/safety fixes.
|
#
e339322a |
|
10-Dec-2011 |
Michael Lotz <mmlr@mlotz.ch> |
Fix hrev43405 by moving the reference above the autolocker. The change in hrev43405 wasn't correct, as it put the reference object definition after the one of the corresponding locker, causing the reference to be released before the unlock would happen. Finally fixes #8187. Thanks Ingo for pointing that out.
|
#
2872aba0 |
|
04-Dec-2011 |
Michael Lotz <mmlr@mlotz.ch> |
Fix missing reference to the old group with lock still held. Removing the team from the group may have released the last reference to the group and freed it. Since we still have a locker on that group it would later crash on unlock, therefore we need a reference to the old group before removing the team from it.
|
#
e62d9911 |
|
03-Dec-2011 |
Michael Lotz <mmlr@mlotz.ch> |
Allocate as much as is later read, didn't do harm though. Further in the process the flat argument size is rounded up, but the actual allocation was done with the unaligned size causing an access beyond the allocation when later copying the flat arguments. It didn't do any actual harm as the block sizes of our allocator(s) use elements that have at least such an alignment.
|
#
323b6546 |
|
21-Nov-2011 |
Oliver Tappe <zooey@hirschkaefer.de> |
Filtered flat import of Oliver's svn package management branch Bring the changes that aren't package management related and the ones that are but don't take effect as long as they are ignored by the build system into the master. Summary of changes: * Introduce private header <directories.h> with constants for a good deal of paths that should usually be retrieved via find_directory(). * Replace hard-coded paths by using find_directory() or the <directories.h> constants (e.g. in drivers and the kernel). * Add find_directory() constants needed for package management. * Add __HAIKU_ABI_NAME and B_HAIKU_ABI_NAME macros. * src/apps/deskbar: BeMenu.* -> DeskbarMenu.*, DeskBarUtils.* -> DeskbarUtils.* * Change deskbar menu settings directory from ~/config/be to ~/config/settings/deskbar. * Other smaller cleanups, changes, and fixes.
|
#
3dfd9cb9 |
|
16-Jun-2011 |
Oliver Tappe <zooey@hirschkaefer.de> |
Flat commit of all changes from package-management branch in svn
|
#
38c1f44d |
|
14-Jun-2011 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
load_image_internal(): Forgot to reserve room on the stack for the program arguments and environment. Fixes failures to start programs in case the space available through rounding to full page sizes wasn't sufficient. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42184 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
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
|
#
03a4f3af |
|
15-Dec-2010 |
Rene Gollent <anevilyak@gmail.com> |
Fix gcc2 kernel build. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39864 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
|
#
adc92cde |
|
18-Aug-2010 |
Axel Dörfler <axeld@pinc-software.de> |
* Fixed CID 1750: the team args could be leaked in exec_team() on error. * Also fixed a leak of the same object in team_create_thread_start() I spotted while looking into it. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38227 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
a8ad734f |
|
14-Jun-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Introduced structures {virtual,physical}_address_restrictions, which specify restrictions for virtual/physical addresses. * vm_page_allocate_page_run(): - Fixed conversion of base/limit to array indexes. sPhysicalPageOffset was not taken into account. - Takes a physical_address_restrictions instead of base/limit and also supports alignment and boundary restrictions, now. * map_backing_store(), VM[User,Kernel]AddressSpace::InsertArea()/ ReserveAddressRange() take a virtual_address_restrictions parameter, now. They also support an alignment independent from the range size. * create_area_etc(), vm_create_anonymous_area(): Take {virtual,physical}_address_restrictions parameters, now. * Removed no longer needed B_PHYSICAL_BASE_ADDRESS. * DMAResources: - Fixed potential overflows of uint32 when initializing from device node attributes. - Fixed bounce buffer creation TODOs: By using create_area_etc() with the new restrictions parameters we can directly support physical high address, boundary, and alignment. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37131 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
a608485f |
|
14-Apr-2010 |
Axel Dörfler <axeld@pinc-software.de> |
* Added new team flag B_TEAM_DEBUG_PREVENT_EXIT that prevents teams from exiting via exit() (the calling thread will drop into the debugger instead). * The DebugServer now uses this flag by default. * Added TODO comment: the default debugger should already be able to set a flag like this in order to close a race condition between dropping a thread into the debugger and setting the flag. * Cleaned up the debug_server sources a bit. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36265 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
fefe246c |
|
13-Apr-2010 |
Axel Dörfler <axeld@pinc-software.de> |
* Set the exit status for the main thread as well in _user_exit_team(). * This closes bug #5713. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36215 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
|
#
f082f7f0 |
|
15-Jan-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Added vm_page::accessed flag. Works analogously to vm_page::modified. * Reorganized the code for [un]mapping pages: - Added new VMTranslationMap::Unmap{Area,Page[s]}() which essentially do what vm_unmap_page[s]() did before, just in the architecture specific code, which allows for specific optimizations. UnmapArea() is for the special case that the complete area is unmapped. Particularly in case the address space is deleted, some work can be saved. Several TODOs could be slain. - Since they are only used within vm.cpp vm_map_page() and vm_unmap_page[s]() are now static and have lost their prefix (and the "preserveModified" parameter). * Added VMTranslationMap::Protect{Page,Area}(). They are just inline wrappers for Protect(). * X86VMTranslationMap::Protect(): Make sure not to accidentally clear the accessed/dirty flags. * X86VMTranslationMap::Unmap()/Protect(): Make page table skipping actually work. It was only skipping to the next page. * Adjusted the PPC code to at least compile. No measurable effect for the -j8 Haiku image build time, though the kernel time drops minimally. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35089 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
a195cce7 |
|
12-Dec-2009 |
Axel Dörfler <axeld@pinc-software.de> |
* Added a bit more missing info about user_threads. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34647 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
e50cf876 |
|
02-Dec-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Moved the VM headers into subdirectory vm/. * Renamed vm_cache.h/vm_address_space.h to VMCache.h/VMAddressSpace. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34449 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
90d870c1 |
|
02-Dec-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Moved VMAddressSpace definition to vm_address_space.h. * "Classified" VMAddressSpace, i.e. turned the vm_address_space_*() functions into methods, made all attributes (but "areas") private, and added accessors. * Also turned the vm.cpp functions vm_area_lookup() and remove_area_from_address_space() into VMAddressSpace methods. The rest of the area management functionality will follow soon. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34447 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
|
#
dec91a97 |
|
27-Nov-2009 |
Axel Dörfler <axeld@pinc-software.de> |
* Cleanup, no functional change. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34321 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
1ba04177 |
|
25-Nov-2009 |
Axel Dörfler <axeld@pinc-software.de> |
* load_image() now has exec() semantics wrt file descriptors; before each team would always inherit them all, causing quite a number of open files. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34247 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
86a999ad |
|
26-Oct-2009 |
Axel Dörfler <axeld@pinc-software.de> |
* delete_owned_ports() no longer scans the whole port array for ports belonging to the owning team. * Instead, the team now maintains a list containing the ports it owns. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33771 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
ddbe1200 |
|
22-Oct-2009 |
Axel Dörfler <axeld@pinc-software.de> |
* Semaphores are now put into the team struct in a doubly linked list. * This makes sem_delete_owned_sems() a lot more efficient; before it would need to scan the entire semaphore table. * This speeds up the test build of the kernel by another 2 seconds (with KDEBUG=2) on my laptop. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33743 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
ac106be5 |
|
27-Sep-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Inherit the disable_debugger() flag to a fork()ed child. load_image() doesn't -- I'm undecided whether it should, too. Fixes #4642. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33330 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
f1a7a375 |
|
21-Aug-2009 |
Michael Lotz <mmlr@mlotz.ch> |
* Use the locked version of inherit_parent_user_and_group() by moving the call into the scope of the lock. Saves an InterruptsSpinLocker. * Use an InterruptsSpinLocker() as in other places. * When creating/forking a team fails because the kernel thread cannot be spawned balance the already sent TEAM_ADDED notification by sending a TEAM_REMOVED one. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32595 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
d3b44ccb |
|
29-Jul-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Added explicit physical address parameter to vm_create_anonymous_area() and create_area_etc(). 0 for the default behavior. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31941 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
b327a1bc |
|
20-May-2009 |
Oliver Tappe <zooey@hirschkaefer.de> |
* when forking a team, not only the signal mask, but also the sig_actions and the signal stack must be copied into the new thread (at least that's what I could make of IEEE Std 1003.1-2001 regarding the expected behaviour of fork) This brings down the failures of the rsync test suite from 24 to 18 ... git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30807 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
|
#
9e83cc17 |
|
17-Mar-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
team_free_user_thread(): Unset the thread's user thread before putting it in the free list. Do that with the threads lock held. This allows other threads to freely access a thread's user thread structure while holding the threads lock. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29577 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
|
#
e18bafbd |
|
01-Oct-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Print the error code. Supposedly B_NO_MEMORY, but one never knows. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27835 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
4ed8088f |
|
20-Sep-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Added new debugger message B_DEBUGGER_MESSAGE_TEAM_EXEC, sent when exec*() has been called. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27650 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
1e906305 |
|
21-Aug-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Added a "flags" parameter to vm_create_anonymous_area() and create_area_etc(). * When the new flag CREATE_AREA_DONT_WAIT is specified, the functions don't wait for memory or pages to become available. They fail immediately instead. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27117 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
6ae7f687 |
|
16-Aug-2008 |
Salvatore Benedetto <salvatore.benedetto@gmail.com> |
* Reworked the way sem_undo requests are processed by following Ingo suggestions: instead of having one global sem_undo list, we now have two local list, one per semaphore set and one per team which is held in its xsi_sem_context structure, along with a mutex. A mutex has also been added to the semaphore set class in order to protect the local list, but also in order to (hopefully) improve concurrency. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26993 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
5409ef46 |
|
10-Aug-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Squashed TODO: Clone the image list on fork(). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26927 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
57f2b5a0 |
|
05-Aug-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Changed the meaning of the {KERNEL,USER}_STACK_SIZE macros to not include the guard pages. Adjusted the kernel and boot loader code accordingly -- the guard pages size is added/not removed respectively. The stack size passed to _kern_spawn_thread() is now the actually usable size, and it is no longer possible to specify a size smaller than or equal to the guard pages size. * vm_create_anonymous_area(): Precommit two pages maximum -- a stack with only one page usable size obviously doesn't need two pages. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26819 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
cc0b3107 |
|
04-Aug-2008 |
Axel Dörfler <axeld@pinc-software.de> |
* We're now using an anonymous condition variable for the team's dead children instead of publishing it. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26789 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
771491be |
|
02-Aug-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
The command line args can easily exceed the maximal tracing buffer allocation size, which caused the Exec traced entry to crash when printed. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26745 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
15374c5d |
|
02-Aug-2008 |
Axel Dörfler <axeld@pinc-software.de> |
* Renamed thread_spinlock and team_spinlock to gThreadSpinlock and gTeamSpinlock. * Renamed the static global variables in smp.c to match our style guide. * Minor other cleanup. * Removed superfluous white space. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26730 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
47ca7595 |
|
28-Jul-2008 |
Axel Dörfler <axeld@pinc-software.de> |
First patch by Salvatore to implement XSI semaphores with a few changes by myself: * renamed xsi_do_undo() to xsi_sem_undo() (there is more to XSI than sems). * Fixed coding style issues in sys/sem.h and xsi_sem.cpp. * Added _kern_*() syscall prototypes to syscalls.h. * Added a TODO in xsi_sem.cpp and xsi_semaphore.h about moving union semun to a shared header. * Made the team::xsi_sem_undo_requests int32 - due to padding, it would have needed 4 bytes anyway; please always use specific types over int/short/long. * xsi_sem_undo() now checks if it needs to do anything - the calls in team.cpp no longer needs to do this. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26676 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
cdc6ad72 |
|
24-Jul-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Don't clone the user thread area on fork(), just create a new one for the new team. Otherwise it would lose it's properties (full lock, B_KERNEL_AREA). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26622 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
736352dc |
|
16-Jul-2008 |
Axel Dörfler <axeld@pinc-software.de> |
* Added [un]lock_memory_etc() versions that accept a team_id as first argument. This allows drivers to lock the memory outside of the original team context. * create_area_etc() got a struct team as first argument, but that should have been a team_id. * Removed delete_area_etc() - there is already vm_delete_area() doing the same thing. * Renamed vm_get_address_space_by_id() to vm_get_address_space(), as there is no other method of getting an address space. * Removed erroneous white space. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26455 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
74d5c1e4 |
|
08-Jul-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Fixed serious memory leak in team_create_thread_start(). The destructor of the automatic KPath variable was never invoked, since normally arch_thread_enter_userspace() would not return and thus the function scope never be left. After a standard "jam @image" almost 42 MB of kernel heap were lost this way. * Added a few warning comments in functions that shouldn't use automatic variables with a destructor in the function scope either. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26336 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
|
#
1c8de858 |
|
01-Jun-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Added optional spinlock contention measurement feature. Enabled when B_DEBUG_SPINLOCK_CONTENTION is defined to 1. It typedefs spinlock to a structure (thus breaking BeOS binary compatibility), containing a counter which is incremented whenever a thread has to wait for the spinlock. * Added macros for spinlock initialization and access and changed code using spinlocks accordingly. This breaks compilation for BeOS -- the macros should be defined in the respective compatibility wrappers. * Added generic syscall to get the spinlock counters for the thread and the team spinlocks. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25752 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
a1e3759f |
|
24-May-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Memory leak in error cases. CID 808. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25644 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
0a89fae9 |
|
19-May-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
wait_for_child() does now wait for the main thread of a dead child to be gone. Fixes bug #1639. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25568 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
fbe0c27a |
|
17-May-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
axeld + bonefish: Changed condition variables so that it is allowed to block (e.g. lock mutexes etc.) between Add() and Wait(). This fixes #2059, since the block writer used them this way and could thusly fail to wait for a condition variable, causing a temporary stack object to be used past its lifetime. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25525 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
5dc81824 |
|
15-May-2008 |
Stephan Aßmus <superstippi@gmx.de> |
Another patch by Vasilis Kaoutsis: Use find_directory() to find the runtime_loader when starting teams. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25506 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
|
#
98e67131 |
|
06-May-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Moved realtime_sem.{cpp,h} into new posix subdirectory. * Renamed the old kernel_posix[_arch...].o to kernel_lib_posix... git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25336 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
5142c2ac |
|
05-May-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Added support for POSIX semaphores (the ones from the XSI extension Realtime option group). The implementation should be complete, but is totally untested yet. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25326 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
9e518ee9 |
|
01-May-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Also hold the threads lock when removing a team from the team hash table. This is not necessary, but allows for a better solution fo how to lock the IO context of another team. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25281 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
873f6659 |
|
28-Apr-2008 |
Jérôme Duval <korli@users.berlios.de> |
reverted r25227. Thanks for the hint Ingo :) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25228 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
615ffc60 |
|
28-Apr-2008 |
Jérôme Duval <korli@users.berlios.de> |
build fix (with no tracing conf) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25227 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
6bf15ffc |
|
27-Apr-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Changed macros that enable tracing for individual components from defined/undefined to numeric values (0 for undefined). This allows for trace levels. * Set SYSCALL_TRACING_IGNORE_KTRACE_OUTPUT default to 1, since this is what one usually wants. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25213 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
3152304e |
|
25-Apr-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Moved creation of the kernel tracing entry for exec_team() to a later point where the argument vector has already been copied to the kernel. Before it was crashing when the syscall provided a bad address. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25167 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
6cef245e |
|
22-Apr-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Detemplatized ConditionVariable{Entry}. Merged them with their respective Private* base class. * Changed sigwait() and sigsuspend() to use thread_block() instead of a condition variable. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25100 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
b95f6d47 |
|
22-Apr-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Introduced a set of functions (thread_prepare_to_block(), thread_block(), thread_unblock(),...) that allow a thread to wait for something without needing a semaphore or condition variable. It can simply block and another thread can unblock it. Supports timeouts and interrupting. Both semaphores and condition variables use this common mechanism, now. * Semaphores: - Some simplifications due to the thread blocking mechanism. - Changed locking order to sem -> thread. It was the other way around before and when introducing the wait_for_objects() support I had also introduced a situation where the locking was reverse, which could potentially cause a dead lock on SMP systems. - Instead of queueing thread structures, a semaphore queues queued_thread entries now, which are created on the stack. The thread::sem structure could thus be removed. - Added sem_entry::net_count, which is sem_entry::count plus the acquisition count of all waiting threads. This number is needed in remove_thread_from_sem() and instead of computing it there we maintain it. - Fixed remove_thread_from_sem(). It would not unblock threads, if the sem count was <= 0. - Made sem::last_acquirer unconditional. It is actually needed for sem_info::latest_holder. Fixed fill_sem_info() accordingly. - Added some optional tracing output, though only via ktrace_printf(). * Condition variables: - Could be simplified significantly through the use of the thread blocking mechanism. Removed a good deal of unnecessary code. - Moved the ConditionVariableEntry "flags" parameter from Wait() to Add(), and adjusted all places where condition variables are used accordingly. * snooze() uses thread_block_with_timeout() instead of a semaphore. * Simplified thread interrupting in the signal and user debugger code. Instead of separate functions for threads waiting on a semaphore or condititon variable, we only have a single thread_interrupt(), now. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25099 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
66aac81e |
|
20-Apr-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
We use only a single condition variable (instead of thread different ones) for wait_for_child(), which is notified when any job control condition (child dead, stopped, continued) occurs. These events are relatively rare anyway, and it simplifies the code. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25079 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
290946ce |
|
29-Mar-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Implemented some basics for supplementary groups support: - The kernel stores the group IDs in the team structure. They are correctly inherited on fork() and load_image_etc(). - Implemented getgroups() for real, i.e. it retrieves the groups associated with the process. - Implemented setgroups(), initgroups() and (the BSDish) getgrouplist(). The latter two read the group information from the "group database" /etc/group (if existing). - Change the BIND port config, since we do have getgrouplist() now. * The set-uid feature was broken when the path to the executable was relative, since we used stat(), which, in the kernel, uses the kernel IO context. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24669 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
4eb35609 |
|
11-Mar-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Added real, effective and saved set- user and group IDs to the team structure. They are properly inherited and updated on fork(), load_image(), and exec(). * Implemented the get[e]{u,g}id(), set[[r]e]{u,g}id() family for real. * getgroups() also calls the kernel now, but only returns the effective group ID. Supplementary groups support is still missing. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24359 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
|
#
8327c809 |
|
21-Feb-2008 |
Axel Dörfler <axeld@pinc-software.de> |
team::parent is NULL in case of the kernel - Expander crashed reliably when expanding something with it. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24047 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
562e2f20 |
|
20-Feb-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Removed unused team::pending_signals. * Added team::flags. Currently only used for setting a flag when a team has exec()ed. * Some improvements of _user_setpgid(): - It failed incorrectly when the target process was a process group leader. According to the standard it shall fail when the process is a session leader. Moving a process group leader to another process group is fine, even if that leaves the group leaderless. - Fixed race conditions. We need to recheck the error conditions when we hold the team spinlock. Otherwise the situation could change while we allocated the new process group. This was one of the reasons for bug #1799 -- after the shell fork()'s both parent and child invoke setpgid() for the child. - Fixed behavior for pid == pgid. It doesn't necessarily mean that a new group has to be created. - Fixed update of target process group orphaned state. - Squashed TODO: setpgid() on a child is supposed to fail after the child has exec()ed. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24041 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
4048494c |
|
17-Feb-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
axeld + bonefish: * Implemented automatic syscall restarts: - A syscall can indicate that it has been interrupted and can be restarted by setting a respective bit in thread::flags. It can store parameters it wants to be preserved for the restart in thread::syscall_restart::parameters. Another thread::flags bit indicates whether it has been restarted. - handle_signals() clears the restart flag, if the handled signal has a handler function installed and SA_RESTART is not set. Another thread flag (THREAD_FLAGS_DONT_RESTART_SYSCALL) can prevent syscalls from being restarted, even if they could be (not used yet, but we might want to use it in resume_thread(), so that we stay behaviorally compatible with BeOS). - The architecture specific syscall handler restarts the syscall, if the restart flag is set. Implemented for x86 only. - Added some support functions in the private <syscall_restart.h> to simplify the syscall restart code in the syscalls. - Adjusted all syscalls that can potentially be restarted accordingly. - _user_ioctl() sets new thread flag THREAD_FLAGS_IOCTL_SYSCALL while calling the underlying FS's/driver's hook, so that syscall restarts can also be supported there. * thread_at_kernel_exit() invokes handle_signals() in a loop now, as long as the latter indicates that the thread shall be suspended, so that after waking up signals received in the meantime will be handled before the thread returns to userland. Adjusted handle_signals() accordingly -- when encountering a suspending signal we don't check for further signals. * Fixed sigsuspend(): Suspending the thread and rescheduling doesn't result in the correct behavior. Instead we employ a temporary condition variable and interruptably wait on it. The POSIX test suite test passes, now. * Made the switch_sem[_etc]() behavior on interruption consistent. Depending on when the signal arrived (before the call or when already waiting) the first semaphore would or wouldn't be released. Now we consistently release it. * Refactored _user_{read,write}[v]() syscalls. Use a common function for either pair. The iovec version doesn't fail anymore, if anything could be read/written at all. It also checks whether a complete vector could be read/written, so that we won't skip data, if the underlying FS/driver couldn't read/write more ATM. * Some refactoring in the x86 syscall handler: The int 99 and sysenter handlers use a common subroutine to avoid code duplication. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23983 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
803a3643 |
|
26-Jan-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Used add_debugger_command_etc() and added a usage text for "team" and "teams". * "team" without arg prints info about the current team. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23746 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
e03ff020 |
|
26-Jan-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Set team::name to the last path component instead of to the truncated path. Makes the "teams" output prettier and "team <name>" becomes usable. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23745 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
6761f5a6 |
|
25-Jan-2008 |
Michael Lotz <mmlr@mlotz.ch> |
Move the handling of still running threads into scheduler_enqueue_in_run_queue(). This should be in line with all uses of scheduler_enqueue_in_run_queue() and simplifies a few places where it is used. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23738 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
f7a5d9c5 |
|
19-Jan-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Changed TraceEntry::Dump() to take a TraceOutput& and removed AbstractTraceEntry::AddDump(char*, size_t). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23655 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
ab23dfa7 |
|
19-Jan-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Moved tracing macro definitions into separate tracing_config.h header. So now there's a central place to enable tracing in general and for individual components. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23645 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
21e73322 |
|
17-Jan-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Also trace set_job_control_entry() and wait_for_child(). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23597 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
72fa2c51 |
|
16-Jan-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Added tracing for fork() and exec(). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23577 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
0fc976d9 |
|
12-Jan-2008 |
Ithamar R. Adema <ithamar.adema@team-embedded.nl> |
Fix problem with CLOEXEC also being handled on fork(). For details on expected (BeOS) behaviour, see http://www.freelists.org/archives/openbeos/12-2001/msg00280.html git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23456 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
92ab20b3 |
|
27-Nov-2007 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Added a list of death_entry's to the teams structure. It stores the exit status of (non-main) threads of a team. Fixes bug #1644. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23009 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
79939c8d |
|
18-Nov-2007 |
Axel Dörfler <axeld@pinc-software.de> |
The KDL command "teams" now also prints the team ID in decimal rather than hex. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22944 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
7861bd3c |
|
11-Oct-2007 |
Axel Dörfler <axeld@pinc-software.de> |
* IDs are now generally printed as decimal values. * Removed old port test code, it doesn't belong there. * Cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22507 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
d45ce8b1 |
|
03-Oct-2007 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Move the job control entries of a dying team's children to the kernel team as well. Otherwise the children would later try to remove them from a list they weren't in. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22429 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
8eacd105 |
|
08-Sep-2007 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Fixed check I messed up recently. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22206 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
|
#
35e78b56 |
|
05-Sep-2007 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Some cleanup in _user_setpgid() (use of autolocking, don't use shadowing variables). * Resolved TODO: We wake up the parent if waiting in wait_for_child() now, if the process group changes. * Added another TODO: setpgid() is supposed to fail on a child after it has executed exec*(). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22185 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
33f0dbe4 |
|
03-Sep-2007 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Resolved TODO: waitpid() clears pending SIGCHLD, if the signal is blocked and no other child status is available. * Respect SA_NOCLDWAIT and ignored SIGCHLD in waitpid(): Unless a child status is available immediately, the thread shall block until all children are gone. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22161 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
22e95c59 |
|
31-Aug-2007 |
Axel Dörfler <axeld@pinc-software.de> |
* creating (or dividing) reserved areas did not acquire a ref to an address space - but they were released upon deletion. It's probably not really needed, but now all reserved areas also grab a reference to their address space. * Rearranged team tear down to be a bit more sane: the I/O context is removed first (where semaphores/areas/ports/whatever might still be used), and the address space is deleted last. * delete_area() can now remove its address space reference again (due to the two changes above), and therefore fixes bug #1374. * cleaned up vm_address_space.c a bit (no functional change there, though). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22130 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
9774b66a |
|
29-Aug-2007 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Fixed incorrect check. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22116 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
f8ae4fe2 |
|
28-Aug-2007 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Added TODO. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22094 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
|
#
ff895459 |
|
27-Aug-2007 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Replaced the team::dead_children::sem semaphore by a condition variable. Due to C code including the header I had to turn it from and aggregated member to a pointer. I'm very close to starting to convert all remaining .c to .cpp files. :-/ * Got rid of the "waiters" field. It was only written, never read. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22084 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
ebe6d106 |
|
26-Aug-2007 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Turned the files I intend to devastate to C++. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22074 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
dfb13a87166f6802fa7949f13e73e292034b6672 |
|
29-Oct-2014 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Increase the size of the kernel FD table With packagefs potentially opening quite a few packages the default of 256 slots is a bit tight. It's 4096 now, which should be safe for a while, but we might want to consider resizing the table dynamically and probably even switching to another algorithm for allocating the slots. Should fix #11328.
|
#
52d500e5b4abc36a9c2106de52412da5324ca9ee |
|
28-Oct-2014 |
Michael Lotz <mmlr@mlotz.ch> |
kernel: Workaround for double lock of spinlock in user timers. The thread that is being [un]scheduled already has its time_lock locked in {stop|continue}_cpu_timers(). When updating the TeamTimeUserTimer, the team is asked for its cpu time. Team::CPUTime() then iterates the threads of the team and locks the time_lock of the thread again. This workaround passes a possibly locked thread through the relevant functions so Team::CPUTime() can decide whether or not a thread it iterates needs to be locked or not. This works around #11032 and its duplicates #11314 and #11344.
|
#
b167307526897db52743daa0aeffe2a0041abaa8 |
|
16-Mar-2014 |
Pawel Dziepak <pdziepak@quarnos.org> |
kernel: Properly synchronize suspending new thread After load_image() the child thread is suspended and the parent is expected to resume it later. However, it is possible that the parent attempts to resume its child after it has been notified that the image had been loaded but before the child managed to suspend itself. In such case the child would suspends itself after that wake up attempt and, consequently will not be ever resumed. To mitigate that problem flag Thread::going_to_suspend has been added which helps synchronizing thread suspension and continuation in a similar way that "traditional" thread blocking is performed. This means that the child should behave in a following manner: set its going_to_suspend flag, notify the parent (i.e. any thread that may want to resume it), acquire its scheduler_lock and suspend itself if the going_to_suspend flag is set. The parent should follow pattern: clear going_to_suspend flag of the thread that is about to be resumed, acquire that thread scheduler_lock and enqueue it in a run queue if it is suspended. Thanks Oliver for reporting the bug and identifying what causes it.
|
#
73db12ab31449c0589284bccabc39dfa8d218309 |
|
19-Jan-2014 |
Pawel Dziepak <pdziepak@quarnos.org> |
kernel: Align user_thread objects to CACHE_LINE_SIZE
|
#
dac7b7c9805cb3c1291a98ceacb4dea94b0cfd65 |
|
06-Dec-2013 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Fix various 64 bit related warnings Mostly printf() format strings and signed-unsigned comparisons. Fixes the x86_64 build.
|
#
7bf85edf58b140433802e19e992d32f0a824b702 |
|
30-Nov-2013 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Allow disabling ASLR via DISABLE_ASLR environment variable * VMAddressSpace: Add randomizingEnabled property. * VMUserAddressSpace: Randomize addresses only when randomizingEnabled property is set. * create_team_arg(): Check, if the team's environment contains "DISABLE_ASLR=1". Set the team's address space property randomizingEnabled accordingly in load_image_internal() and exec_team().
|
#
2b7ea4cddf362859cd3089e3cb95481cda4adc5f |
|
29-Nov-2013 |
Pawel Dziepak <pdziepak@quarnos.org> |
kernel: Remove Thread::next_state
|
#
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.
|
#
72addc62e042d2a39fba1f04e2cc8dadc155adfe |
|
07-Nov-2013 |
Pawel Dziepak <pdziepak@quarnos.org> |
kernel: Introduce Thread::time_lock and Team::time_lock
|
#
aa4aca0264aa285e07c0b8e43112ac06803fcd2e |
|
06-Nov-2013 |
Pawel Dziepak <pdziepak@quarnos.org> |
kernel: Protect signal data with Team::signal_lock
|
#
7f64b301b1e78fb5a50c44a0cb2bb94a91e31d00 |
|
26-Oct-2013 |
Julian Harnath <julian.harnath@rwth-aachen.de> |
Reduce lock contention in kernel port subsystem. * Replace ports list mutex with R/W-lock. * Move team port list protection to separate array of mutexes. Relieve contention on sPortsLock by removing Team::port_list from its protected items. With this, set_port_owner() only needs to acquire the sPortsLock for reading. * Add another hash table holding the ports by name. Used by find_port() so it doesn't have to iterate over the list anymore. * Use slab-based memory allocator for port messages. sPortQuotaLock was acquired on every message send or receive and was thus another point of contention. The lock is not necessary anymore. * Lock for port hashes and Port::lock are no longer locked in a nested fashion to reduce chances of blocking other threads. * Make operations concurrency-safe by adding an atomically accessed Port::state which provides linearization points to port creation and deletion. Both operations are now divided into logical and physical parts, the logical part just updating the state and the physical part adding/remove it to/from the port hash and team port list. * set_port_owner() is the only remaining function which still locks Port::lock and one or two of sTeamListLock[] in a nested fashion. Since it needs to move the port from one team list to another and change Port::owner, there's no way around. * Ports are now reference counted to make accesses to already-deleted ports safe. * Should fix #8007.
|
#
de49e34927ea27d282f6e85c866db5073df379af |
|
04-Oct-2013 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Add symbol versioning for find_directory() Should already have been done back when the semantics for the B_COMMON_*DIRECTORY constants was changed. Currently old and new version behave the same. So this is just a contingency measure ATM.
|
#
2eb2b522bf0b3533a7a35bc5fa8d1caa0d2573d2 |
|
01-Jul-2013 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Enforce team and thread limits Also fixes incorrect team accounting in case of error when creating a team. The previously incremented sUsedTeams wasn't decremented again.
|
#
cbcde3ba8058d84d86d3a36b1ebbec37ed1f35ea |
|
01-Jul-2013 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
kernel team.cpp: fix unbalanced io_context ref management ... in case of team creation error. Once assigned to Team::io_context the Team object takes responsibility of the I/O context object and releases the reference on destruction. load_image_internal() and fork_team() were thus releasing one reference too many. Fixes #9851.
|
#
c24adb29503ec78c6d076801e1d82d16140e3413 |
|
19-Apr-2013 |
Rene Gollent <anevilyak@gmail.com> |
Rework DefaultNotificationService registration. - Instead of implicitly registering and unregistering a service instance on construction/destruction, DefaultNotificationService now exports explicit Register()/Unregister() calls, which subclasses are expected to call when they're ready. - Adjust all implementing subclasses. Resolves an issue with deadlocks when booting a DEBUG=1 build.
|
#
f697412ff81a6d6a4a9866abce93f1f20a68330f |
|
03-Apr-2013 |
Pawel Dziepak <pdziepak@quarnos.org> |
vm: place commpage and team data near the top of user address space Placing commpage and team user data somewhere at the top of the user accessible virtual address space prevents these areas from conflicting with elf images that require to be mapped at exact address (in most cases: runtime_loader).
|
#
e85e399fd7b229b8bc92f28928a059876d7216d3 |
|
17-Mar-2013 |
Pawel Dziepak <pdziepak@quarnos.org> |
commpage: randomize position of commpage This patch introduces randomization of commpage position. From now on commpage table contains offsets from begining to of the commpage to the particular commpage entry. Similary addresses of symbols in ELF memory image "commpage" are just offsets from the begining of the commpage. This patch also updates KDL so that commpage entries are recognized and shown correctly in stack trace. An update of Debugger is yet to be done.
|
#
02cceebe403215977ae406355ba882ba94ae1151 |
|
04-Mar-2013 |
Pawel Dziepak <pdziepak@quarnos.org> |
team: randomize position of team user data When forking a process team user data area is not cloned but a new one is created instead. However, the new one has to be at exactly the same address parent's team user data area is. When process is exec then team user data area may be recreated at random position. This patch also make sure that instances of struct user_thread in team user data are each in separate cache line in order to prevent false sharing since these data are very likely to be accessed simultaneously from threads executing on different CPUs. This change however reduces the number of threads process can create. It is fixed by reserving 512kB of address space in case team user data area needs to grow.
|
#
d1f280c80529d5f0bc55030c2934f9255bc7f6a2 |
|
01-Apr-2012 |
Hamish Morrison <hamishm53@gmail.com> |
Add support for pthread_attr_get/setguardsize() * Added the aforementioned functions. * create_area_etc() now takes a guard size parameter. * The thread_info::stack_base/end range now refers to the usable range only.
|
#
45132e2b226dd9a957e6f5446bd7a2603d4c0701 |
|
17-Sep-2012 |
Prasad Joshi <prasadjoshi.linux@gmail.com> |
ps: fix uid and gid in the ps output The function fill_team_info() completely ignored the user id and the group id of the process (fields info->uid and info->gid respectively). Since the info structure was zeroed earlier, the ps output showed uid and gid of each process equal to zero. The patch fixes the problem by properly initializing the members with effective uid and gid. Now the output is correct. Fixes #8995. Signed-off-by: Ryan Leavengood <leavengood@gmail.com>
|
#
6e2f6d1ace7490a200dcff70c52acf2af59c5bc3 |
|
29-Jul-2012 |
Alex Smith <alex@alex-smith.me.uk> |
Changed cookie type for get_next_area_info() to ssize_t. The cookie is used to store the base address of the area that was just visited. On 64-bit systems, int32 is not sufficient. Therefore, changed to ssize_t which retains compatibility on x86 while expanding to a sufficient size on x86_64.
|
#
07c6bd65b8aa82eae10c036e674799c1c5d16be9 |
|
23-Jul-2012 |
Alex Smith <alex@alex-smith.me.uk> |
Format string fixes for TRACE_{THREAD,TEAM}.
|
#
c3f0fd28cda13d70a8c092003609442e4e29cf78 |
|
12-Jul-2012 |
Alex Smith <alex@alex-smith.me.uk> |
Fixed formatting of output in some debugger commands. Currently all debugger commands assume 32-bit pointers when formatting their output. This means that on x86_64 the output is incorrectly formatted. Fixed this by adding a B_PRINTF_POINTER_WIDTH definition (16 on 64-bit, 8 on 32-bit), and using this to correctly format the output. Not all commands have been fixed yet, but all VM, slab, VFS, team, thread and image commands should be correct.
|
#
4be4fc6b1faddbd037146214a0011d320842b4f3 |
|
15-Jun-2012 |
Alex Smith <alex@alex-smith.me.uk> |
More 64-bit compilation/safety fixes.
|
#
e339322a8832789595ce9747116157f9a0d18b68 |
|
10-Dec-2011 |
Michael Lotz <mmlr@mlotz.ch> |
Fix hrev43405 by moving the reference above the autolocker. The change in hrev43405 wasn't correct, as it put the reference object definition after the one of the corresponding locker, causing the reference to be released before the unlock would happen. Finally fixes #8187. Thanks Ingo for pointing that out.
|
#
2872aba0a779d4b4fceeaaa34c45be58a5b70e66 |
|
04-Dec-2011 |
Michael Lotz <mmlr@mlotz.ch> |
Fix missing reference to the old group with lock still held. Removing the team from the group may have released the last reference to the group and freed it. Since we still have a locker on that group it would later crash on unlock, therefore we need a reference to the old group before removing the team from it.
|
#
e62d9911eac981cb93a1f972adf4305c7edf07ad |
|
03-Dec-2011 |
Michael Lotz <mmlr@mlotz.ch> |
Allocate as much as is later read, didn't do harm though. Further in the process the flat argument size is rounded up, but the actual allocation was done with the unaligned size causing an access beyond the allocation when later copying the flat arguments. It didn't do any actual harm as the block sizes of our allocator(s) use elements that have at least such an alignment.
|
#
323b65468e5836bb27a5e373b14027d902349437 |
|
21-Nov-2011 |
Oliver Tappe <zooey@hirschkaefer.de> |
Filtered flat import of Oliver's svn package management branch Bring the changes that aren't package management related and the ones that are but don't take effect as long as they are ignored by the build system into the master. Summary of changes: * Introduce private header <directories.h> with constants for a good deal of paths that should usually be retrieved via find_directory(). * Replace hard-coded paths by using find_directory() or the <directories.h> constants (e.g. in drivers and the kernel). * Add find_directory() constants needed for package management. * Add __HAIKU_ABI_NAME and B_HAIKU_ABI_NAME macros. * src/apps/deskbar: BeMenu.* -> DeskbarMenu.*, DeskBarUtils.* -> DeskbarUtils.* * Change deskbar menu settings directory from ~/config/be to ~/config/settings/deskbar. * Other smaller cleanups, changes, and fixes.
|
#
3dfd9cb95ce45f59160d50975210bc55e3fc0709 |
|
16-Jun-2011 |
Oliver Tappe <zooey@hirschkaefer.de> |
Flat commit of all changes from package-management branch in svn
|
#
38c1f44d703ab30dd09d23d863e4c8a9f6742742 |
|
14-Jun-2011 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
load_image_internal(): Forgot to reserve room on the stack for the program arguments and environment. Fixes failures to start programs in case the space available through rounding to full page sizes wasn't sufficient. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42184 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
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
|
#
03a4f3aff3d9d434a078d4be28a40b7600082c8b |
|
15-Dec-2010 |
Rene Gollent <anevilyak@gmail.com> |
Fix gcc2 kernel build. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39864 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
|
#
adc92cdef7df96b1e13ce7b4061dc760cc453e5e |
|
18-Aug-2010 |
Axel Dörfler <axeld@pinc-software.de> |
* Fixed CID 1750: the team args could be leaked in exec_team() on error. * Also fixed a leak of the same object in team_create_thread_start() I spotted while looking into it. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38227 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
a8ad734f1c698917badb15e1641e0f38b3e9a013 |
|
14-Jun-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Introduced structures {virtual,physical}_address_restrictions, which specify restrictions for virtual/physical addresses. * vm_page_allocate_page_run(): - Fixed conversion of base/limit to array indexes. sPhysicalPageOffset was not taken into account. - Takes a physical_address_restrictions instead of base/limit and also supports alignment and boundary restrictions, now. * map_backing_store(), VM[User,Kernel]AddressSpace::InsertArea()/ ReserveAddressRange() take a virtual_address_restrictions parameter, now. They also support an alignment independent from the range size. * create_area_etc(), vm_create_anonymous_area(): Take {virtual,physical}_address_restrictions parameters, now. * Removed no longer needed B_PHYSICAL_BASE_ADDRESS. * DMAResources: - Fixed potential overflows of uint32 when initializing from device node attributes. - Fixed bounce buffer creation TODOs: By using create_area_etc() with the new restrictions parameters we can directly support physical high address, boundary, and alignment. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37131 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
a608485f26d1e806f7e4d595a8a6eeafad36bd43 |
|
14-Apr-2010 |
Axel Dörfler <axeld@pinc-software.de> |
* Added new team flag B_TEAM_DEBUG_PREVENT_EXIT that prevents teams from exiting via exit() (the calling thread will drop into the debugger instead). * The DebugServer now uses this flag by default. * Added TODO comment: the default debugger should already be able to set a flag like this in order to close a race condition between dropping a thread into the debugger and setting the flag. * Cleaned up the debug_server sources a bit. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36265 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
fefe246c70050f3bac9585a2c0875a508c33a0c3 |
|
13-Apr-2010 |
Axel Dörfler <axeld@pinc-software.de> |
* Set the exit status for the main thread as well in _user_exit_team(). * This closes bug #5713. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36215 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
|
#
f082f7f019941732f1d2b99f627fbeeeec3746af |
|
15-Jan-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Added vm_page::accessed flag. Works analogously to vm_page::modified. * Reorganized the code for [un]mapping pages: - Added new VMTranslationMap::Unmap{Area,Page[s]}() which essentially do what vm_unmap_page[s]() did before, just in the architecture specific code, which allows for specific optimizations. UnmapArea() is for the special case that the complete area is unmapped. Particularly in case the address space is deleted, some work can be saved. Several TODOs could be slain. - Since they are only used within vm.cpp vm_map_page() and vm_unmap_page[s]() are now static and have lost their prefix (and the "preserveModified" parameter). * Added VMTranslationMap::Protect{Page,Area}(). They are just inline wrappers for Protect(). * X86VMTranslationMap::Protect(): Make sure not to accidentally clear the accessed/dirty flags. * X86VMTranslationMap::Unmap()/Protect(): Make page table skipping actually work. It was only skipping to the next page. * Adjusted the PPC code to at least compile. No measurable effect for the -j8 Haiku image build time, though the kernel time drops minimally. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35089 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
a195cce7b5776cc64518b70687d336e54b895ab7 |
|
12-Dec-2009 |
Axel Dörfler <axeld@pinc-software.de> |
* Added a bit more missing info about user_threads. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34647 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
e50cf8765be50a7454c9488db38b638cf90805af |
|
02-Dec-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Moved the VM headers into subdirectory vm/. * Renamed vm_cache.h/vm_address_space.h to VMCache.h/VMAddressSpace. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34449 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
90d870c1556bdc415c7f41de5474ebebb0ceebdd |
|
02-Dec-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Moved VMAddressSpace definition to vm_address_space.h. * "Classified" VMAddressSpace, i.e. turned the vm_address_space_*() functions into methods, made all attributes (but "areas") private, and added accessors. * Also turned the vm.cpp functions vm_area_lookup() and remove_area_from_address_space() into VMAddressSpace methods. The rest of the area management functionality will follow soon. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34447 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
|
#
dec91a975458f7c5fdf314241e660ec825afc094 |
|
27-Nov-2009 |
Axel Dörfler <axeld@pinc-software.de> |
* Cleanup, no functional change. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34321 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
1ba04177d3f10173d03433e9a7d37e46c2161428 |
|
25-Nov-2009 |
Axel Dörfler <axeld@pinc-software.de> |
* load_image() now has exec() semantics wrt file descriptors; before each team would always inherit them all, causing quite a number of open files. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34247 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
86a999adfb7b2ef2261c913a6f91880175c736ec |
|
26-Oct-2009 |
Axel Dörfler <axeld@pinc-software.de> |
* delete_owned_ports() no longer scans the whole port array for ports belonging to the owning team. * Instead, the team now maintains a list containing the ports it owns. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33771 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
ddbe12007a455315c7904deeea339dc8827c66ad |
|
22-Oct-2009 |
Axel Dörfler <axeld@pinc-software.de> |
* Semaphores are now put into the team struct in a doubly linked list. * This makes sem_delete_owned_sems() a lot more efficient; before it would need to scan the entire semaphore table. * This speeds up the test build of the kernel by another 2 seconds (with KDEBUG=2) on my laptop. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33743 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
ac106be5344ddb120fe45c16b1d198001e8f96f7 |
|
27-Sep-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Inherit the disable_debugger() flag to a fork()ed child. load_image() doesn't -- I'm undecided whether it should, too. Fixes #4642. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33330 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
f1a7a3752fda65e71edcfbb15de67e0cd0859fcb |
|
21-Aug-2009 |
Michael Lotz <mmlr@mlotz.ch> |
* Use the locked version of inherit_parent_user_and_group() by moving the call into the scope of the lock. Saves an InterruptsSpinLocker. * Use an InterruptsSpinLocker() as in other places. * When creating/forking a team fails because the kernel thread cannot be spawned balance the already sent TEAM_ADDED notification by sending a TEAM_REMOVED one. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32595 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
d3b44ccb1470db823a443d0f9b32e09bfa0d0a9c |
|
29-Jul-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Added explicit physical address parameter to vm_create_anonymous_area() and create_area_etc(). 0 for the default behavior. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31941 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
b327a1bc7d56170c7ee42b86a3c0e0b2739bdf75 |
|
20-May-2009 |
Oliver Tappe <zooey@hirschkaefer.de> |
* when forking a team, not only the signal mask, but also the sig_actions and the signal stack must be copied into the new thread (at least that's what I could make of IEEE Std 1003.1-2001 regarding the expected behaviour of fork) This brings down the failures of the rsync test suite from 24 to 18 ... git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30807 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
|
#
9e83cc1768934f9b2ca42f283487eff0b592c82b |
|
17-Mar-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
team_free_user_thread(): Unset the thread's user thread before putting it in the free list. Do that with the threads lock held. This allows other threads to freely access a thread's user thread structure while holding the threads lock. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29577 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
|
#
e18bafbdb5e50c4b76280fb5d18982d938d51688 |
|
01-Oct-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Print the error code. Supposedly B_NO_MEMORY, but one never knows. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27835 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
4ed8088f9a98fa69526c08721087a942becc7545 |
|
20-Sep-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Added new debugger message B_DEBUGGER_MESSAGE_TEAM_EXEC, sent when exec*() has been called. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27650 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
1e90630527225143d9321738152bba9194f5ef3f |
|
21-Aug-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Added a "flags" parameter to vm_create_anonymous_area() and create_area_etc(). * When the new flag CREATE_AREA_DONT_WAIT is specified, the functions don't wait for memory or pages to become available. They fail immediately instead. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27117 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
6ae7f6879ff2131f94b47b14764f65115d9bfdbc |
|
16-Aug-2008 |
Salvatore Benedetto <salvatore.benedetto@gmail.com> |
* Reworked the way sem_undo requests are processed by following Ingo suggestions: instead of having one global sem_undo list, we now have two local list, one per semaphore set and one per team which is held in its xsi_sem_context structure, along with a mutex. A mutex has also been added to the semaphore set class in order to protect the local list, but also in order to (hopefully) improve concurrency. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26993 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
5409ef46f6eebc7c25be98ff6b7b734b08e6c0cb |
|
10-Aug-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Squashed TODO: Clone the image list on fork(). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26927 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
57f2b5a0137be29081ab719ae33ebabddc95b78b |
|
05-Aug-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Changed the meaning of the {KERNEL,USER}_STACK_SIZE macros to not include the guard pages. Adjusted the kernel and boot loader code accordingly -- the guard pages size is added/not removed respectively. The stack size passed to _kern_spawn_thread() is now the actually usable size, and it is no longer possible to specify a size smaller than or equal to the guard pages size. * vm_create_anonymous_area(): Precommit two pages maximum -- a stack with only one page usable size obviously doesn't need two pages. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26819 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
cc0b310748d59cd8e62729e745087eb7d5b83594 |
|
04-Aug-2008 |
Axel Dörfler <axeld@pinc-software.de> |
* We're now using an anonymous condition variable for the team's dead children instead of publishing it. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26789 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
771491bec812eeb31ff45c77dfa0fa7989515801 |
|
02-Aug-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
The command line args can easily exceed the maximal tracing buffer allocation size, which caused the Exec traced entry to crash when printed. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26745 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
15374c5dbdb2c6b700bb2191887cadad7ef9eb73 |
|
02-Aug-2008 |
Axel Dörfler <axeld@pinc-software.de> |
* Renamed thread_spinlock and team_spinlock to gThreadSpinlock and gTeamSpinlock. * Renamed the static global variables in smp.c to match our style guide. * Minor other cleanup. * Removed superfluous white space. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26730 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
47ca7595ca54e08dac7482950a35b045e6ad8801 |
|
28-Jul-2008 |
Axel Dörfler <axeld@pinc-software.de> |
First patch by Salvatore to implement XSI semaphores with a few changes by myself: * renamed xsi_do_undo() to xsi_sem_undo() (there is more to XSI than sems). * Fixed coding style issues in sys/sem.h and xsi_sem.cpp. * Added _kern_*() syscall prototypes to syscalls.h. * Added a TODO in xsi_sem.cpp and xsi_semaphore.h about moving union semun to a shared header. * Made the team::xsi_sem_undo_requests int32 - due to padding, it would have needed 4 bytes anyway; please always use specific types over int/short/long. * xsi_sem_undo() now checks if it needs to do anything - the calls in team.cpp no longer needs to do this. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26676 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
cdc6ad72bbcb54caaa838c88be4d0e576d4d3b03 |
|
24-Jul-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Don't clone the user thread area on fork(), just create a new one for the new team. Otherwise it would lose it's properties (full lock, B_KERNEL_AREA). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26622 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
736352dcf58f1855db8dc09c456d420ca91596ef |
|
16-Jul-2008 |
Axel Dörfler <axeld@pinc-software.de> |
* Added [un]lock_memory_etc() versions that accept a team_id as first argument. This allows drivers to lock the memory outside of the original team context. * create_area_etc() got a struct team as first argument, but that should have been a team_id. * Removed delete_area_etc() - there is already vm_delete_area() doing the same thing. * Renamed vm_get_address_space_by_id() to vm_get_address_space(), as there is no other method of getting an address space. * Removed erroneous white space. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26455 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
74d5c1e499d87b5d16562ab3e6ae398ed3b2e386 |
|
08-Jul-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Fixed serious memory leak in team_create_thread_start(). The destructor of the automatic KPath variable was never invoked, since normally arch_thread_enter_userspace() would not return and thus the function scope never be left. After a standard "jam @image" almost 42 MB of kernel heap were lost this way. * Added a few warning comments in functions that shouldn't use automatic variables with a destructor in the function scope either. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26336 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
|
#
1c8de8581b66c14ea94bccd7ddcea99291955796 |
|
01-Jun-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Added optional spinlock contention measurement feature. Enabled when B_DEBUG_SPINLOCK_CONTENTION is defined to 1. It typedefs spinlock to a structure (thus breaking BeOS binary compatibility), containing a counter which is incremented whenever a thread has to wait for the spinlock. * Added macros for spinlock initialization and access and changed code using spinlocks accordingly. This breaks compilation for BeOS -- the macros should be defined in the respective compatibility wrappers. * Added generic syscall to get the spinlock counters for the thread and the team spinlocks. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25752 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
a1e3759f698070d9e76c96f102c4097435ab1083 |
|
24-May-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Memory leak in error cases. CID 808. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25644 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
0a89fae916a5a6ff5182ccfff2afb7dd7111afd3 |
|
19-May-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
wait_for_child() does now wait for the main thread of a dead child to be gone. Fixes bug #1639. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25568 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
fbe0c27a94fff9dff7c42e12ee96f789b314c746 |
|
17-May-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
axeld + bonefish: Changed condition variables so that it is allowed to block (e.g. lock mutexes etc.) between Add() and Wait(). This fixes #2059, since the block writer used them this way and could thusly fail to wait for a condition variable, causing a temporary stack object to be used past its lifetime. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25525 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
5dc81824d625a215b2494818afee782119dd7975 |
|
15-May-2008 |
Stephan Aßmus <superstippi@gmx.de> |
Another patch by Vasilis Kaoutsis: Use find_directory() to find the runtime_loader when starting teams. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25506 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
|
#
98e67131727de15752bc87a530612040c6955d17 |
|
06-May-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Moved realtime_sem.{cpp,h} into new posix subdirectory. * Renamed the old kernel_posix[_arch...].o to kernel_lib_posix... git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25336 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
5142c2ac86c0f020ffa3fc31cea9f1f2f1b6ef91 |
|
05-May-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Added support for POSIX semaphores (the ones from the XSI extension Realtime option group). The implementation should be complete, but is totally untested yet. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25326 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
9e518ee91d7d78dec4d33aeff67f63ee721c34da |
|
01-May-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Also hold the threads lock when removing a team from the team hash table. This is not necessary, but allows for a better solution fo how to lock the IO context of another team. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25281 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
873f6659eb778776900c54ad9cc2a85455f5a6ca |
|
28-Apr-2008 |
Jérôme Duval <korli@users.berlios.de> |
reverted r25227. Thanks for the hint Ingo :) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25228 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
615ffc60ccb5f0c68e5020a80ea559a560d65101 |
|
28-Apr-2008 |
Jérôme Duval <korli@users.berlios.de> |
build fix (with no tracing conf) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25227 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
6bf15ffcdcfc62c39948e0e9449064e65b7f13bd |
|
27-Apr-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Changed macros that enable tracing for individual components from defined/undefined to numeric values (0 for undefined). This allows for trace levels. * Set SYSCALL_TRACING_IGNORE_KTRACE_OUTPUT default to 1, since this is what one usually wants. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25213 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
3152304e53f502750aaefcfb5144ac80bb09c06c |
|
25-Apr-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Moved creation of the kernel tracing entry for exec_team() to a later point where the argument vector has already been copied to the kernel. Before it was crashing when the syscall provided a bad address. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25167 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
6cef245eca821584f07f5a13558f51ec586852e8 |
|
22-Apr-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Detemplatized ConditionVariable{Entry}. Merged them with their respective Private* base class. * Changed sigwait() and sigsuspend() to use thread_block() instead of a condition variable. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25100 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
b95f6d4710855a27bec41b6fae2b064347780173 |
|
22-Apr-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Introduced a set of functions (thread_prepare_to_block(), thread_block(), thread_unblock(),...) that allow a thread to wait for something without needing a semaphore or condition variable. It can simply block and another thread can unblock it. Supports timeouts and interrupting. Both semaphores and condition variables use this common mechanism, now. * Semaphores: - Some simplifications due to the thread blocking mechanism. - Changed locking order to sem -> thread. It was the other way around before and when introducing the wait_for_objects() support I had also introduced a situation where the locking was reverse, which could potentially cause a dead lock on SMP systems. - Instead of queueing thread structures, a semaphore queues queued_thread entries now, which are created on the stack. The thread::sem structure could thus be removed. - Added sem_entry::net_count, which is sem_entry::count plus the acquisition count of all waiting threads. This number is needed in remove_thread_from_sem() and instead of computing it there we maintain it. - Fixed remove_thread_from_sem(). It would not unblock threads, if the sem count was <= 0. - Made sem::last_acquirer unconditional. It is actually needed for sem_info::latest_holder. Fixed fill_sem_info() accordingly. - Added some optional tracing output, though only via ktrace_printf(). * Condition variables: - Could be simplified significantly through the use of the thread blocking mechanism. Removed a good deal of unnecessary code. - Moved the ConditionVariableEntry "flags" parameter from Wait() to Add(), and adjusted all places where condition variables are used accordingly. * snooze() uses thread_block_with_timeout() instead of a semaphore. * Simplified thread interrupting in the signal and user debugger code. Instead of separate functions for threads waiting on a semaphore or condititon variable, we only have a single thread_interrupt(), now. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25099 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
66aac81e98b1cf8720817d87a7f1973dc976fb3e |
|
20-Apr-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
We use only a single condition variable (instead of thread different ones) for wait_for_child(), which is notified when any job control condition (child dead, stopped, continued) occurs. These events are relatively rare anyway, and it simplifies the code. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25079 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
290946ce80e8bf8e7a8e8a8593ea88f3465f5a3f |
|
29-Mar-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Implemented some basics for supplementary groups support: - The kernel stores the group IDs in the team structure. They are correctly inherited on fork() and load_image_etc(). - Implemented getgroups() for real, i.e. it retrieves the groups associated with the process. - Implemented setgroups(), initgroups() and (the BSDish) getgrouplist(). The latter two read the group information from the "group database" /etc/group (if existing). - Change the BIND port config, since we do have getgrouplist() now. * The set-uid feature was broken when the path to the executable was relative, since we used stat(), which, in the kernel, uses the kernel IO context. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24669 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
4eb3560949b15e7492c8055eb512e5dd68b2da32 |
|
11-Mar-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Added real, effective and saved set- user and group IDs to the team structure. They are properly inherited and updated on fork(), load_image(), and exec(). * Implemented the get[e]{u,g}id(), set[[r]e]{u,g}id() family for real. * getgroups() also calls the kernel now, but only returns the effective group ID. Supplementary groups support is still missing. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24359 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
|
#
8327c8091f33f245f3d1a45b21f9b2b8243a141d |
|
21-Feb-2008 |
Axel Dörfler <axeld@pinc-software.de> |
team::parent is NULL in case of the kernel - Expander crashed reliably when expanding something with it. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24047 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
562e2f204a2de3fd3ae59c846e371c08594e7a57 |
|
20-Feb-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Removed unused team::pending_signals. * Added team::flags. Currently only used for setting a flag when a team has exec()ed. * Some improvements of _user_setpgid(): - It failed incorrectly when the target process was a process group leader. According to the standard it shall fail when the process is a session leader. Moving a process group leader to another process group is fine, even if that leaves the group leaderless. - Fixed race conditions. We need to recheck the error conditions when we hold the team spinlock. Otherwise the situation could change while we allocated the new process group. This was one of the reasons for bug #1799 -- after the shell fork()'s both parent and child invoke setpgid() for the child. - Fixed behavior for pid == pgid. It doesn't necessarily mean that a new group has to be created. - Fixed update of target process group orphaned state. - Squashed TODO: setpgid() on a child is supposed to fail after the child has exec()ed. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24041 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
4048494ce44a925d3d1e40e4ffb9abe670b4b827 |
|
17-Feb-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
axeld + bonefish: * Implemented automatic syscall restarts: - A syscall can indicate that it has been interrupted and can be restarted by setting a respective bit in thread::flags. It can store parameters it wants to be preserved for the restart in thread::syscall_restart::parameters. Another thread::flags bit indicates whether it has been restarted. - handle_signals() clears the restart flag, if the handled signal has a handler function installed and SA_RESTART is not set. Another thread flag (THREAD_FLAGS_DONT_RESTART_SYSCALL) can prevent syscalls from being restarted, even if they could be (not used yet, but we might want to use it in resume_thread(), so that we stay behaviorally compatible with BeOS). - The architecture specific syscall handler restarts the syscall, if the restart flag is set. Implemented for x86 only. - Added some support functions in the private <syscall_restart.h> to simplify the syscall restart code in the syscalls. - Adjusted all syscalls that can potentially be restarted accordingly. - _user_ioctl() sets new thread flag THREAD_FLAGS_IOCTL_SYSCALL while calling the underlying FS's/driver's hook, so that syscall restarts can also be supported there. * thread_at_kernel_exit() invokes handle_signals() in a loop now, as long as the latter indicates that the thread shall be suspended, so that after waking up signals received in the meantime will be handled before the thread returns to userland. Adjusted handle_signals() accordingly -- when encountering a suspending signal we don't check for further signals. * Fixed sigsuspend(): Suspending the thread and rescheduling doesn't result in the correct behavior. Instead we employ a temporary condition variable and interruptably wait on it. The POSIX test suite test passes, now. * Made the switch_sem[_etc]() behavior on interruption consistent. Depending on when the signal arrived (before the call or when already waiting) the first semaphore would or wouldn't be released. Now we consistently release it. * Refactored _user_{read,write}[v]() syscalls. Use a common function for either pair. The iovec version doesn't fail anymore, if anything could be read/written at all. It also checks whether a complete vector could be read/written, so that we won't skip data, if the underlying FS/driver couldn't read/write more ATM. * Some refactoring in the x86 syscall handler: The int 99 and sysenter handlers use a common subroutine to avoid code duplication. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23983 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
803a36434d4d66a1ff305c16f7d7fa67e6f616f4 |
|
26-Jan-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Used add_debugger_command_etc() and added a usage text for "team" and "teams". * "team" without arg prints info about the current team. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23746 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
e03ff0203372d221b207b7b9b1b536f51d8252c5 |
|
26-Jan-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Set team::name to the last path component instead of to the truncated path. Makes the "teams" output prettier and "team <name>" becomes usable. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23745 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
6761f5a660bcba247e0967e09ac58f2f4488bd55 |
|
25-Jan-2008 |
Michael Lotz <mmlr@mlotz.ch> |
Move the handling of still running threads into scheduler_enqueue_in_run_queue(). This should be in line with all uses of scheduler_enqueue_in_run_queue() and simplifies a few places where it is used. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23738 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
f7a5d9c5831397de59dc37ad27f5b4cd17a35db1 |
|
19-Jan-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Changed TraceEntry::Dump() to take a TraceOutput& and removed AbstractTraceEntry::AddDump(char*, size_t). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23655 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
ab23dfa7f7621e7ca1e1bc8d99f0a1a55bc299ad |
|
19-Jan-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Moved tracing macro definitions into separate tracing_config.h header. So now there's a central place to enable tracing in general and for individual components. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23645 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
21e73322d8ebb8ffa330da95473b5baa26380541 |
|
17-Jan-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Also trace set_job_control_entry() and wait_for_child(). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23597 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
72fa2c51ebde69d705a231943b55e5b4b79adbcf |
|
16-Jan-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Added tracing for fork() and exec(). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23577 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
0fc976d9003f9e61913cf2eb648dfd59bc1e9b41 |
|
12-Jan-2008 |
Ithamar R. Adema <ithamar.adema@team-embedded.nl> |
Fix problem with CLOEXEC also being handled on fork(). For details on expected (BeOS) behaviour, see http://www.freelists.org/archives/openbeos/12-2001/msg00280.html git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23456 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
92ab20b3a4994eca38234479d344e80519019652 |
|
27-Nov-2007 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Added a list of death_entry's to the teams structure. It stores the exit status of (non-main) threads of a team. Fixes bug #1644. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23009 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
79939c8d1ef6eb6d3004ad2b5a41d4abbde15fcd |
|
18-Nov-2007 |
Axel Dörfler <axeld@pinc-software.de> |
The KDL command "teams" now also prints the team ID in decimal rather than hex. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22944 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
7861bd3cfb424c45a23ef3f3b06bf7bd82afd600 |
|
11-Oct-2007 |
Axel Dörfler <axeld@pinc-software.de> |
* IDs are now generally printed as decimal values. * Removed old port test code, it doesn't belong there. * Cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22507 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
d45ce8b1dcbf25f8b0be713dcfabac2af192861d |
|
03-Oct-2007 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Move the job control entries of a dying team's children to the kernel team as well. Otherwise the children would later try to remove them from a list they weren't in. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22429 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
8eacd105eb884f0c0bc7ebf7e38728fd515f1bc1 |
|
08-Sep-2007 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Fixed check I messed up recently. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22206 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
|
#
35e78b56745e8c1913a9a6bca08fe902ffd67943 |
|
05-Sep-2007 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Some cleanup in _user_setpgid() (use of autolocking, don't use shadowing variables). * Resolved TODO: We wake up the parent if waiting in wait_for_child() now, if the process group changes. * Added another TODO: setpgid() is supposed to fail on a child after it has executed exec*(). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22185 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
33f0dbe40a37eee0ead3a4522d78197ff1d1e747 |
|
03-Sep-2007 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Resolved TODO: waitpid() clears pending SIGCHLD, if the signal is blocked and no other child status is available. * Respect SA_NOCLDWAIT and ignored SIGCHLD in waitpid(): Unless a child status is available immediately, the thread shall block until all children are gone. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22161 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
22e95c5911749774324862ec6ba06fbc3f4bb777 |
|
31-Aug-2007 |
Axel Dörfler <axeld@pinc-software.de> |
* creating (or dividing) reserved areas did not acquire a ref to an address space - but they were released upon deletion. It's probably not really needed, but now all reserved areas also grab a reference to their address space. * Rearranged team tear down to be a bit more sane: the I/O context is removed first (where semaphores/areas/ports/whatever might still be used), and the address space is deleted last. * delete_area() can now remove its address space reference again (due to the two changes above), and therefore fixes bug #1374. * cleaned up vm_address_space.c a bit (no functional change there, though). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22130 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
9774b66a7db00d095f2fdd0feaa700906a513edb |
|
29-Aug-2007 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Fixed incorrect check. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22116 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
f8ae4fe2c2d0e3bec751c4b70de61599ab94b924 |
|
28-Aug-2007 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Added TODO. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22094 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
|
#
ff895459b795520dddd83f77c7460ba7810e3c87 |
|
27-Aug-2007 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Replaced the team::dead_children::sem semaphore by a condition variable. Due to C code including the header I had to turn it from and aggregated member to a pointer. I'm very close to starting to convert all remaining .c to .cpp files. :-/ * Got rid of the "waiters" field. It was only written, never read. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22084 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
ebe6d106843e4280c58c87eaa1eab9b71ece8c2a |
|
26-Aug-2007 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Turned the files I intend to devastate to C++. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22074 a95241bf-73f2-0310-859d-f6bbb57e9c96
|