#
bfd3d337 |
|
29-May-2023 |
Trung Nguyen <trungnt282910@gmail.com> |
strace: Print detailed signal information - Add support for retrieving the `siginfo_t` structure of a signal event from the Debugger API. - Add code to `strace` to display this information every time a signal event occurs, similar to the Linux `strace` tool. Change-Id: If4e92bbae049ee0b52efaf9fc911d66511da62f4 Reviewed-on: https://review.haiku-os.org/c/haiku/+/6393 Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org> Reviewed-by: waddlesplash <waddlesplash@gmail.com>
|
#
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.
|
#
4f7b9506 |
|
14-Jun-2018 |
Augustin Cavalier <waddlesplash@gmail.com> |
Revert the rest of the COMPAT_MODE changes (back to hrev52003.) This reverts commit 458e758f3792ef11ca26d6ff7e24600c88326e83. This reverts commit ce5eb94a82b1b377ef5909e65411e031f54ceb15. This reverts commit aac8d4c317ca11a9a6e194e2c668e8183ec23dd6. This reverts commit c70cba914aa79c01bbc2da38085936f589899c8c. This reverts commit 2ffbe7aaca8668c5a68ac7488459bace7a0700f2 This reverts commit c6e120e2d2f909d95f95839fa99fccf811fdb3c5.
|
#
aac8d4c3 |
|
18-May-2018 |
Jérôme Duval <jerome.duval@gmail.com> |
kernel/x86_64: compatibility syscalls for signal.cpp. * handle 32-bit types in _user_send_signal(), _user_sigaction(), _user_sigwait(), _user_set_signal_stack(), _user_restore_signal_frame(), other syscalls are compatible as is. Change-Id: I4c8dc47bfa80f36e363d444d2a5a7be6c621606d
|
#
c6e120e2 |
|
15-May-2018 |
Jérôme Duval <jerome.duval@gmail.com> |
kernel/x86_64: add setup_compat_signal_frame. * add compatibility signal types. Change-Id: I665020234be0ba2ccbb33bdbc338c11a214ab6e8
|
#
9dd4d2dd |
|
03-Jan-2018 |
Jérôme Duval <jerome.duval@gmail.com> |
kernel: support for Intel SMAP and SMEP on x86_64. SMAP will generated page faults when the kernel tries to access user pages unless overriden. If SMAP is enabled, the override instructions are written where needed in memory with binary "altcodepatches". Support is enabled by default, might be disabled per safemode setting. Change-Id: Ife26cd765056aeaf65b2ffa3cadd0dcf4e273a96
|
#
9572fa73 |
|
06-Jan-2018 |
Jérôme Duval <jerome.duval@gmail.com> |
kernel: signal: check user buffer addresses... in _user_set_signal_mask(), _user_sigaction(), _user_sigsuspend(), _user_set_signal_stack().
|
#
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.
|
#
7a187cd6 |
|
09-Apr-2016 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
_user_debug_thread(): Use new signal SIGNAL_DEBUG_THREAD This resolves a TODO: We used thread_interrupt() to wake up the thread from an interruptable wait. However, if the thread was already in the kernel and about to start waiting, that would have no effect and the thread would wait anyway. Now there's the new non-blockable signal SIGNAL_DEBUG_THREAD, which is sent to the thread instead, making sure that thread doesn't start waiting.
|
#
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.
|
#
9d80738d |
|
19-Jan-2014 |
Pawel Dziepak <pdziepak@quarnos.org> |
kernel: Fix NULL dereference in has_permission_to_signal
|
#
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.
|
#
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.
|
#
3519eb33 |
|
06-Nov-2013 |
Pawel Dziepak <pdziepak@quarnos.org> |
kernel: Change Thread::team_lock to rw_spinlock
|
#
aa4aca02 |
|
06-Nov-2013 |
Pawel Dziepak <pdziepak@quarnos.org> |
kernel: Protect signal data with Team::signal_lock
|
#
11cacd0c |
|
04-Nov-2013 |
Pawel Dziepak <pdziepak@quarnos.org> |
kernel: Remove thread_block_with_timeout_locked()
|
#
d54a9e0a |
|
29-Oct-2013 |
Pawel Dziepak <pdziepak@quarnos.org> |
kernel: Do not use gSchedulerLock when accesing UID and GID Reads and writes to uid_t and gid_t are atomic anyway. The only real problem that may happen here is inconsistent state of triples effective_{u, g}id, saved_set_{u, g}id, real_{u, g}id, but team locks protect us against that.
|
#
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.
|
#
0e35d5d2 |
|
12-Dec-2011 |
John Scipione <jscipione@gmail.com> |
Change instances of wether in comments to whether. No functional change intended.
|
#
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
|
#
8cd3dac1 |
|
30-Apr-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Reintroduced sigwait(), sigsuspend(), and sigpending(). There are obviously drivers using those. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36548 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
2be99447 |
|
06-Apr-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Added some comments to the thread flags. * Added new thread flag THREAD_FLAGS_ALWAYS_RESTART_SYSCALL. If set, it forces syscall restart even when a signal handler without SA_RESTART was invoked. * Fixed sigwait(): If one of requested signals wasn't already pending it would never wake up. Also, the syscall always needs to be restarted, if interrupted by another signal. * Renamed a bunch of the POSIX signal function implementations which did return an error code directly (instead via errno). Added correct POSIX functions where needed. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36054 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
7778bccf |
|
13-Mar-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
sigsuspend() would previously wake up correctly when a matching signal was received, but if the signal was in the thread's signal block mask, it would not be handled. Added thread::sig_temp_enabled, an additional mask of not blocked signals, which is set by sigsuspend() and evaluated and reset by handle_signals(). Fixes #5567. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35836 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
f427f6af |
|
12-Mar-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Added some kernel tracing for sigsuspend(). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35834 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
0338371f |
|
13-Dec-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* All scheduler implementations: - enqueue_in_run_queue() no longer returns whether rescheduling is supposed to happen. Instead is sets cpu_ent::invoke_scheduler on the current CPU. - reschedule() does now handle cpu_ent::invoke_scheduler_if_idle(). No need to let all callers do that. * thread_unblock[_locked]() no longer return whether rescheduling is supposed to happen. * Got rid of the B_INVOKE_SCHEDULER handling. The interrupt hooks really can't know, when it makes sense to reschedule or not. * Introduced scheduler_reschedule_if_necessary[_locked]() functions for checking+invoking the scheduler. * Some semaphore functions (e.g. delete_sem()) invoke the scheduler now, if they wake up anything with greater priority. I've also tried to add scheduler invocations in the condition variable and mutex/rw_lock code, but that actually has a negative impact on performance, probably because it causes too much ping-ponging between threads when multiple locking primitives are involved. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34657 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
358b9335 |
|
15-Oct-2009 |
Axel Dörfler <axeld@pinc-software.de> |
* Moved SIGABRT to the signals that kill the process. Not sure if it's a good idea to always send SIGKILL to the main thread, though. I'm not really getting more insight by reading the POSIX specs. * Anyway, in the mean time, this fixes bug #4784. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33599 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
d18b0429 |
|
29-Aug-2009 |
Michael Lotz <mmlr@mlotz.ch> |
Cleanup, remove needless line-break and trailing space. Also switched that "& " to " &" as really the whole rest of the file uses that style. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32813 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
c3350a57 |
|
21-Aug-2009 |
Rene Gollent <anevilyak@gmail.com> |
Squashed a TODO: When delivering signals, check if a) any threads were in fact enqueued, and b) if the scheduler's preemption hint indicates that a reschedule is desired. This prevents unnecessarily invoking the scheduler every single time a signal is delivered, regardless of result. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32592 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
1c800aa1 |
|
22-Apr-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Updated TODO. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30344 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
f68892b9 |
|
19-Mar-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
deliver_signal() SIGKILL: * Use atomic_or() to update sig_pending of the main thread. * We didn't call update_thread_signals_flag() for the main thread, so its handle_signals() wouldn't be called, resulting in an infinite loop, if this signal interrupted a restartable syscall. Calling exit() from another thread than the main thread was likely to run into this problem. Should fix #3178. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29612 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
7805eb0c |
|
27-Sep-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Changed the handling for hardware-caused terminal signals: * No longer send a SIGKILL when a page fault occurred, there was no signal handler, and the debugger told us to continue as usual. Instead we send a SIGSEGV. Instead in handle_signal() when not in the main thread and there's no handler for the signal, we first send the main thread a SIGKILL before letting the thread die. So in cases where the main thread caused an unhandled page fault, the team will die from the SIGSEGV, now. This fixes bug #2773. * For the other hardware-caused signals we do now do the same as in case of page faults, i.e. we first check whether the thread has a handler for the signal in question. If so, we don't notify the debugger, but send the signal right away. * B_GENERAL_PROTECTION_FAULT is translated to SIGILL now. Seems better than SIGKILL. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27757 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
|
#
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
|
#
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
|
#
c2d96d45 |
|
22-Apr-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Added back accidentally removed check for B_THREAD_SUSPENDED when delivering a kill signal. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25102 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
|
#
037f7094 |
|
09-Apr-2008 |
Axel Dörfler <axeld@pinc-software.de> |
* Cleaned up KernelExport.h completely, removed deprecated and non implemented API, uses the _PRINTFLIKE macro where appropriate. * Got rid of the "qent" structure, struct timer now contains everything we need. This makes the affected code in sem.cpp, signal.cpp, and timer.c much cleaner, and resolves a few TODOs. * Minor cleanup in vfs.cpp. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24871 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
10f0fc8f |
|
31-Mar-2008 |
Axel Dörfler <axeld@pinc-software.de> |
* Implemented sigwait(). * Not sure if it works as intended, as the specs are a bit vague. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24717 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
4495cd43 |
|
20-Mar-2008 |
Axel Dörfler <axeld@pinc-software.de> |
* Fixed warnings, mostly due to NULL changes. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24487 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
6e4432bc |
|
09-Mar-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Add a tracing entry when executing a signal handler. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24333 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
bc2001bb |
|
22-Feb-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
We have to update the pending signals thread flag when restoring the signal block mask when returning from a signal handler. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24064 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
0dd3108c |
|
21-Feb-2008 |
Axel Dörfler <axeld@pinc-software.de> |
* Added SIGNAL_FLAG_DONT_RESTART_SYSCALL for send_signal_etc() which utilizes the THREAD_FLAG_DONT_RESTART_SYSCALL (but only in SIGCONT for now). * resume_thread() is now using that flag to be compatible with BeOS. * This fixes the Terminal hanging on close. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24045 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
306fe532 |
|
18-Feb-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
We forgot to unpublish our temporary condition variable. Since it was allocated on the stack, condition variable related structures would be trashed, causing all kinds of problems. Fixes #1811 and #1812. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24009 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
447c081f |
|
17-Feb-2008 |
Axel Dörfler <axeld@pinc-software.de> |
* sigsuspend() must only block blockable signals. * Minor comment cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24000 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
|
#
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
|
#
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
|
#
c964a2f2 |
|
18-Jan-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Use TraceOutput. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23624 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
2f1836da |
|
18-Jan-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Kernel tracing for signals. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23621 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
34b3b26b |
|
10-Jan-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Merged branch haiku/branches/developer/bonefish/optimization revision 23139 into trunk, with roughly the following changes (for details svn log the branch): * The int 99 syscall handler is now fully in assembly. * Added a sysenter/sysexit handler and use it on Pentiums that support it (via commpage). * Got rid of i386_handle_trap(). A bit of functionality was moved into the assembly handler which now uses a jump table to call C functions handling the respective interrupt. * Some optimizations to get user debugger support code out of the interrupt handling path. * Introduced a thread::flags fields which allows to skip handling of rare events (signals, user debug enabling/disabling) on the common interrupt handling path. * Got rid of the explicit iframe stack. The iframes can still be retrieved by iterating through the stack frames. * Made the commpage an architecture independent feature. It's used for the real time data stuff (instead of creating a separate area). * The x86 CPU modules can now provide processor optimized versions for common functions (currently memcpy() only). They are used in the kernel and are provided to the userland via commpage entries. * Introduced build system feature allowing easy use of C structure member offsets in assembly code. Changes after merging: * Fixed merge conflict in src/system/kernel/arch/x86/arch_debug.cpp (caused by refactoring and introduction of "call" debugger command). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23370 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
d0c2af77 |
|
01-Oct-2007 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Addressed a deadlock race condition: Acquiration of condition variable and thread spinlock was reverse in Wait() and Notify(). The thread lock is now the outer lock -- this way it is still possible to call Notify() with the thread lock being held. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22401 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
df716df5 |
|
05-Sep-2007 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Added is_signal_blocked() convenience function. * Defined flag SIGNAL_FLAG_TEAMS_LOCKED for send_signal_etc(), so it can be called with the team lock being held. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22186 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
|
#
eadeecc2 |
|
03-Sep-2007 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Updated TODO. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22159 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
1273dcaa |
|
28-Aug-2007 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Respect SA_NOCLDSTOP. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22101 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
e8b3ee81 |
|
28-Aug-2007 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
SIGCHLD also needs to be sent when a child is stopped. The shell now properly realized when a job has been stopped. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22093 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
|
#
ff308b0b |
|
26-Aug-2007 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Condition variables changes: * Removed left-over commented C implementation. * It is now possible for a thread to wait for more than one condition variable at a time. * Made waiting for condition variables optionally interruptable. * Renamed Notify() method to NotifyAll() and added a NotifyOne(), so that it is now possible to wake up only one of the waiting threads. Pretty much untested at the moment. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22081 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
|
#
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.
|
#
9d80738d95a602d0291169f918b962a648573843 |
|
19-Jan-2014 |
Pawel Dziepak <pdziepak@quarnos.org> |
kernel: Fix NULL dereference in has_permission_to_signal
|
#
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.
|
#
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.
|
#
3519eb334ac161e88fa56bcef287a2275a1c963e |
|
06-Nov-2013 |
Pawel Dziepak <pdziepak@quarnos.org> |
kernel: Change Thread::team_lock to rw_spinlock
|
#
aa4aca0264aa285e07c0b8e43112ac06803fcd2e |
|
06-Nov-2013 |
Pawel Dziepak <pdziepak@quarnos.org> |
kernel: Protect signal data with Team::signal_lock
|
#
11cacd0c1345cd3296f12e07d18996a2c7572a64 |
|
04-Nov-2013 |
Pawel Dziepak <pdziepak@quarnos.org> |
kernel: Remove thread_block_with_timeout_locked()
|
#
d54a9e0a4194f6843406bc67f68045f59f9a190d |
|
29-Oct-2013 |
Pawel Dziepak <pdziepak@quarnos.org> |
kernel: Do not use gSchedulerLock when accesing UID and GID Reads and writes to uid_t and gid_t are atomic anyway. The only real problem that may happen here is inconsistent state of triples effective_{u, g}id, saved_set_{u, g}id, real_{u, g}id, but team locks protect us against that.
|
#
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.
|
#
0e35d5d2e5ef3d288e056d60ef1b16dc399eaa0c |
|
12-Dec-2011 |
John Scipione <jscipione@gmail.com> |
Change instances of wether in comments to whether. No functional change intended.
|
#
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
|
#
8cd3dac13e7829697d15213aeab85b3d647eab5d |
|
30-Apr-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Reintroduced sigwait(), sigsuspend(), and sigpending(). There are obviously drivers using those. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36548 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
2be99447d8b1394699cbcbdb36549d9f802aafab |
|
06-Apr-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Added some comments to the thread flags. * Added new thread flag THREAD_FLAGS_ALWAYS_RESTART_SYSCALL. If set, it forces syscall restart even when a signal handler without SA_RESTART was invoked. * Fixed sigwait(): If one of requested signals wasn't already pending it would never wake up. Also, the syscall always needs to be restarted, if interrupted by another signal. * Renamed a bunch of the POSIX signal function implementations which did return an error code directly (instead via errno). Added correct POSIX functions where needed. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36054 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
7778bccf93001545b6e9e7a839d41146fa000700 |
|
13-Mar-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
sigsuspend() would previously wake up correctly when a matching signal was received, but if the signal was in the thread's signal block mask, it would not be handled. Added thread::sig_temp_enabled, an additional mask of not blocked signals, which is set by sigsuspend() and evaluated and reset by handle_signals(). Fixes #5567. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35836 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
f427f6af3f9732a8da2d7eeedfacfbe2d3455906 |
|
12-Mar-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Added some kernel tracing for sigsuspend(). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35834 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
0338371f26864c2a248b1ea53b9fe78c884af7f2 |
|
13-Dec-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* All scheduler implementations: - enqueue_in_run_queue() no longer returns whether rescheduling is supposed to happen. Instead is sets cpu_ent::invoke_scheduler on the current CPU. - reschedule() does now handle cpu_ent::invoke_scheduler_if_idle(). No need to let all callers do that. * thread_unblock[_locked]() no longer return whether rescheduling is supposed to happen. * Got rid of the B_INVOKE_SCHEDULER handling. The interrupt hooks really can't know, when it makes sense to reschedule or not. * Introduced scheduler_reschedule_if_necessary[_locked]() functions for checking+invoking the scheduler. * Some semaphore functions (e.g. delete_sem()) invoke the scheduler now, if they wake up anything with greater priority. I've also tried to add scheduler invocations in the condition variable and mutex/rw_lock code, but that actually has a negative impact on performance, probably because it causes too much ping-ponging between threads when multiple locking primitives are involved. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34657 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
358b93352e3c45163ec806a8dc95342ebc1b4f0b |
|
15-Oct-2009 |
Axel Dörfler <axeld@pinc-software.de> |
* Moved SIGABRT to the signals that kill the process. Not sure if it's a good idea to always send SIGKILL to the main thread, though. I'm not really getting more insight by reading the POSIX specs. * Anyway, in the mean time, this fixes bug #4784. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33599 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
d18b04298ab09f408e180bd1a0da5731abfc9f89 |
|
29-Aug-2009 |
Michael Lotz <mmlr@mlotz.ch> |
Cleanup, remove needless line-break and trailing space. Also switched that "& " to " &" as really the whole rest of the file uses that style. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32813 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
c3350a57ffa4a5a4eb6094814370b0bfc879b33d |
|
21-Aug-2009 |
Rene Gollent <anevilyak@gmail.com> |
Squashed a TODO: When delivering signals, check if a) any threads were in fact enqueued, and b) if the scheduler's preemption hint indicates that a reschedule is desired. This prevents unnecessarily invoking the scheduler every single time a signal is delivered, regardless of result. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32592 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
1c800aa1f9126fc8c07c29da3b3089112b15ecbe |
|
22-Apr-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Updated TODO. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30344 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
f68892b93ebd8bd0f05cac6ed20e21ffdf6e8719 |
|
19-Mar-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
deliver_signal() SIGKILL: * Use atomic_or() to update sig_pending of the main thread. * We didn't call update_thread_signals_flag() for the main thread, so its handle_signals() wouldn't be called, resulting in an infinite loop, if this signal interrupted a restartable syscall. Calling exit() from another thread than the main thread was likely to run into this problem. Should fix #3178. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29612 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
7805eb0cc29e1762d9c0bb207f5f9a910f292bf7 |
|
27-Sep-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Changed the handling for hardware-caused terminal signals: * No longer send a SIGKILL when a page fault occurred, there was no signal handler, and the debugger told us to continue as usual. Instead we send a SIGSEGV. Instead in handle_signal() when not in the main thread and there's no handler for the signal, we first send the main thread a SIGKILL before letting the thread die. So in cases where the main thread caused an unhandled page fault, the team will die from the SIGSEGV, now. This fixes bug #2773. * For the other hardware-caused signals we do now do the same as in case of page faults, i.e. we first check whether the thread has a handler for the signal in question. If so, we don't notify the debugger, but send the signal right away. * B_GENERAL_PROTECTION_FAULT is translated to SIGILL now. Seems better than SIGKILL. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27757 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
|
#
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
|
#
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
|
#
c2d96d4500c297227bcd7f95e82f9d2d44f9e79f |
|
22-Apr-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Added back accidentally removed check for B_THREAD_SUSPENDED when delivering a kill signal. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25102 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
|
#
037f70947f14b7e7d452543ad645f38d7c96f6eb |
|
09-Apr-2008 |
Axel Dörfler <axeld@pinc-software.de> |
* Cleaned up KernelExport.h completely, removed deprecated and non implemented API, uses the _PRINTFLIKE macro where appropriate. * Got rid of the "qent" structure, struct timer now contains everything we need. This makes the affected code in sem.cpp, signal.cpp, and timer.c much cleaner, and resolves a few TODOs. * Minor cleanup in vfs.cpp. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24871 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
10f0fc8f2063591b21f7fcd699cde574ec1c68ca |
|
31-Mar-2008 |
Axel Dörfler <axeld@pinc-software.de> |
* Implemented sigwait(). * Not sure if it works as intended, as the specs are a bit vague. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24717 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
4495cd43c19a4925102a20b4d4f8bedd2cfa923d |
|
20-Mar-2008 |
Axel Dörfler <axeld@pinc-software.de> |
* Fixed warnings, mostly due to NULL changes. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24487 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
6e4432bc6f75efe8221991e3eeee9647d8699fad |
|
09-Mar-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Add a tracing entry when executing a signal handler. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24333 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
bc2001bb3999da0cde5b83b5f448de628cdc5f08 |
|
22-Feb-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
We have to update the pending signals thread flag when restoring the signal block mask when returning from a signal handler. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24064 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
0dd3108ca08b4ebac77328b089f0c4394438bac8 |
|
21-Feb-2008 |
Axel Dörfler <axeld@pinc-software.de> |
* Added SIGNAL_FLAG_DONT_RESTART_SYSCALL for send_signal_etc() which utilizes the THREAD_FLAG_DONT_RESTART_SYSCALL (but only in SIGCONT for now). * resume_thread() is now using that flag to be compatible with BeOS. * This fixes the Terminal hanging on close. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24045 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
306fe5324845c15c54684bb49d0f6acc80b2da46 |
|
18-Feb-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
We forgot to unpublish our temporary condition variable. Since it was allocated on the stack, condition variable related structures would be trashed, causing all kinds of problems. Fixes #1811 and #1812. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24009 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
447c081fe41c755a130cfa8fd8c351c5e936685e |
|
17-Feb-2008 |
Axel Dörfler <axeld@pinc-software.de> |
* sigsuspend() must only block blockable signals. * Minor comment cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24000 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
|
#
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
|
#
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
|
#
c964a2f2287d3da7e01436f3facef54d3b5dd1c6 |
|
18-Jan-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Use TraceOutput. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23624 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
2f1836da5c2816712272d9f64eb75daca820a8aa |
|
18-Jan-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Kernel tracing for signals. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23621 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
34b3b26b3b8c46ba46ddde037b10dd173f4936d6 |
|
10-Jan-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Merged branch haiku/branches/developer/bonefish/optimization revision 23139 into trunk, with roughly the following changes (for details svn log the branch): * The int 99 syscall handler is now fully in assembly. * Added a sysenter/sysexit handler and use it on Pentiums that support it (via commpage). * Got rid of i386_handle_trap(). A bit of functionality was moved into the assembly handler which now uses a jump table to call C functions handling the respective interrupt. * Some optimizations to get user debugger support code out of the interrupt handling path. * Introduced a thread::flags fields which allows to skip handling of rare events (signals, user debug enabling/disabling) on the common interrupt handling path. * Got rid of the explicit iframe stack. The iframes can still be retrieved by iterating through the stack frames. * Made the commpage an architecture independent feature. It's used for the real time data stuff (instead of creating a separate area). * The x86 CPU modules can now provide processor optimized versions for common functions (currently memcpy() only). They are used in the kernel and are provided to the userland via commpage entries. * Introduced build system feature allowing easy use of C structure member offsets in assembly code. Changes after merging: * Fixed merge conflict in src/system/kernel/arch/x86/arch_debug.cpp (caused by refactoring and introduction of "call" debugger command). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23370 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
d0c2af771393d353dde1f0375d1edbf1f410be50 |
|
01-Oct-2007 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Addressed a deadlock race condition: Acquiration of condition variable and thread spinlock was reverse in Wait() and Notify(). The thread lock is now the outer lock -- this way it is still possible to call Notify() with the thread lock being held. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22401 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
df716df51dd01317209b9523c7230307d3531f3b |
|
05-Sep-2007 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Added is_signal_blocked() convenience function. * Defined flag SIGNAL_FLAG_TEAMS_LOCKED for send_signal_etc(), so it can be called with the team lock being held. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22186 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
|
#
eadeecc2ff3e3c63612a73d24834b1553ed54135 |
|
03-Sep-2007 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Updated TODO. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22159 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
1273dcaaae48f586addbd0e5715f1fe07360b7b5 |
|
28-Aug-2007 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Respect SA_NOCLDSTOP. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22101 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
e8b3ee81555c47ce5511363361493ccfc8884031 |
|
28-Aug-2007 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
SIGCHLD also needs to be sent when a child is stopped. The shell now properly realized when a job has been stopped. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22093 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
|
#
ff308b0b491531f2f3b5d22244d7ac5904133e61 |
|
26-Aug-2007 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Condition variables changes: * Removed left-over commented C implementation. * It is now possible for a thread to wait for more than one condition variable at a time. * Made waiting for condition variables optionally interruptable. * Renamed Notify() method to NotifyAll() and added a NotifyOne(), so that it is now possible to wake up only one of the waiting threads. Pretty much untested at the moment. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22081 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
|