summaryrefslogtreecommitdiff
path: root/Kernel/ProcessGroup.h
AgeCommit message (Collapse)Author
2023-06-04Kernel: Move all tasks-related code to the Tasks subdirectoryLiav A
2023-04-05Kernel: Make ProcessGroup a ListedRefCounted and fix two racesAndreas Kling
This closes two race windows: - ProcessGroup removed itself from the "all process groups" list in its destructor. It was possible to walk the list between the last unref() and the destructor invocation, and grab a pointer to a ProcessGroup that was about to get deleted. - sys$setsid() could end up creating a process group that already existed, as there was a race window between checking if the PGID is used, and actually creating a ProcessGroup with that PGID.
2023-04-04Kernel: Stop using *LockRefPtr for ProcessGroupAndreas Kling
Had to wrap Process::m_pg in a SpinlockProtected for this to be safe.
2023-01-02Kernel: Turn lock ranks into template parameterskleines Filmröllchen
This step would ideally not have been necessary (increases amount of refactoring and templates necessary, which in turn increases build times), but it gives us a couple of nice properties: - SpinlockProtected inside Singleton (a very common combination) can now obtain any lock rank just via the template parameter. It was not previously possible to do this with SingletonInstanceCreator magic. - SpinlockProtected's lock rank is now mandatory; this is the majority of cases and allows us to see where we're still missing proper ranks. - The type already informs us what lock rank a lock has, which aids code readability and (possibly, if gdb cooperates) lock mismatch debugging. - The rank of a lock can no longer be dynamic, which is not something we wanted in the first place (or made use of). Locks randomly changing their rank sounds like a disaster waiting to happen. - In some places, we might be able to statically check that locks are taken in the right order (with the right lock rank checking implementation) as rank information is fully statically known. This refactoring even more exposes the fact that Mutex has no lock rank capabilites, which is not fixed here.
2022-10-26Kernel: Include missing headers for various filesTimon Kruiper
With these missing header files, we can now build these files for aarch64.
2022-08-20Kernel: Make self-contained locking smart pointers their own classesAndreas Kling
Until now, our kernel has reimplemented a number of AK classes to provide automatic internal locking: - RefPtr - NonnullRefPtr - WeakPtr - Weakable This patch renames the Kernel classes so that they can coexist with the original AK classes: - RefPtr => LockRefPtr - NonnullRefPtr => NonnullLockRefPtr - WeakPtr => LockWeakPtr - Weakable => LockWeakable The goal here is to eventually get rid of the Lock* classes in favor of using external locking.
2022-08-20AK+Kernel: Add AK::AtomicRefCounted and use everywhere in the kernelAndreas Kling
Instead of having two separate implementations of AK::RefCounted, one for userspace and one for kernelspace, there is now RefCounted and AtomicRefCounted.
2022-04-01Everywhere: Run clang-formatIdan Horowitz
2021-11-08Kernel: Replace KResult and KResultOr<T> with Error and ErrorOr<T>Andreas Kling
We now use AK::Error and AK::ErrorOr<T> in both kernel and userspace! This was a slightly tedious refactoring that took a long time, so it's not unlikely that some bugs crept in. Nevertheless, it does pass basic functionality testing, and it's just real nice to finally see the same pattern in all contexts. :^)
2021-09-10AK+Everywhere: Reduce the number of template parameters of IntrusiveListAli Mohammad Pur
This makes the user-facing type only take the node member pointer, and lets the compiler figure out the other needed types from that.
2021-09-06Kernel: Use KResultOr better in ProcessGroup constructionAndreas Kling
This allows us to use TRY() more.
2021-09-04Kernel: Handle ProcessGroup allocation failures betterAndreas Kling
- Rename create* => try_create* - Don't null out existing process group on allocation failure
2021-08-22Kernel: Rename SpinLock => SpinlockAndreas Kling
2021-08-22Kernel: Rename SpinLockProtectedValue<T> => SpinLockProtected<T>Andreas Kling
2021-08-07Kernel: Port process groups to SpinLockProtectedValueAndreas Kling
2021-08-07Kernel: Move SpinLock.h into Locking/Jean-Baptiste Boric
2021-08-01Kernel: Remove unused header includesBrian Gianforcaro
2021-07-17Kernel: Rename Lock to MutexAndreas Kling
Let's be explicit about what kind of lock this is meant to be.
2021-06-03Kernel: Switch ProcessGroup to IntrusiveList from InlineLinkedListBrian Gianforcaro
2021-05-21Revert "Kernel: Avoid allocating under spinlock in ProcessGroup::find_or_create"Brian Gianforcaro
This reverts commit e95eb7a51d8295c96cddf20f116139deecbb69d4. This is causing some sort of list corruption, as evident by #7313 I haven't been able to figure it out yet, so lets revert this change until I can figure out what's going on.
2021-05-20Kernel: Avoid allocating under spinlock in ProcessGroup::find_or_createBrian Gianforcaro
Avoid allocating while holding the g_process_groups_lock spinlock, it's a pattern that has a negative effect on performance and scalability, especially given that it is a global lock, reachable by all processes.
2021-05-20Kernel: Make ProcessGroup::find_or_create API OOM safeBrian Gianforcaro
Make ProcessGroup::find_or_create & ProcessGroup::create OOM safe, by moving to adopt_ref_if_nonnull.
2021-04-22Everything: Move to SPDX license identifiers in all files.Brian Gianforcaro
SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2020-11-30Kernel: Move block condition evaluation out of the SchedulerTom
This makes the Scheduler a lot leaner by not having to evaluate block conditions every time it is invoked. Instead evaluate them as the states change, and unblock threads at that point. This also implements some more waitid/waitpid/wait features and behavior. For example, WUNTRACED and WNOWAIT are now supported. And wait will now not return EINTR when SIGCHLD is delivered at the same time.
2020-08-19Kernel: Distinguish between new and old process groups with equal pgidsAnotherTest
This does not add any behaviour change to the processes, but it ties a TTY to an active process group via TIOCSPGRP, and returns the TTY to the kernel when all processes in the process group die. Also makes the TTY keep a link to the original controlling process' parent (for SIGCHLD) instead of the process itself.