summaryrefslogtreecommitdiff
path: root/Kernel/ProcessSpecificExposed.cpp
AgeCommit message (Collapse)Author
2022-05-06Kernel: Add /proc/{pid}/children to ProcFSMacDue
This exposes the child processes for a process as a directory of symlinks to the respective /proc entries for each child. This makes for an easier and possibly more efficient way to find and count a process's children. Previously the only method was to parse the entire /proc/all JSON file.
2022-04-03Kernel: Store AddressSpace memory regions in an IntrusiveRedBlackTreeAndreas Kling
This means we never need to allocate when inserting/removing regions from the address space.
2022-04-01Everywhere: Run clang-formatIdan Horowitz
2022-03-22Kernel: Don't assume paths of TTYs and pseudo terminals anymoreLiav A
The obsolete ttyname and ptsname syscalls are removed. LibC doesn't rely on these anymore, and it helps simplifying the Kernel in many places, so it's an overall an improvement. In addition to that, /proc/PID/tty node is removed too as it is not needed anymore by userspace to get the attached TTY of a process, as /dev/tty (which is already a character device) represents that as well.
2022-03-14Kernel: Bail out earlier from Process::lookup_stacks_directoryHendiadyoin1
2022-03-08Kernel: Put Process unveil state in a SpinlockProtected containerAndreas Kling
This makes path resolution safe to perform without holding the big lock.
2022-03-08Kernel: Put Process's current directory in a SpinlockProtectedAndreas Kling
Also let's call it "current_directory" instead of "cwd" everywhere.
2022-02-27Everywhere: Make JSON serialization fallibleIdan Horowitz
This allows us to eliminate a major source of infallible allocation in the Kernel, as well as lay down the groundwork for OOM fallibility in userland.
2022-02-16Kernel: Make Process::procfs_get_pledge_stats OOM-fallibleIdan Horowitz
We can completely avoid the string allocation by using string_view().
2022-02-15AK+Kernel: OOM-harden most parts of TrieAli Mohammad Pur
The only part of Unveil that can't handle OOM gracefully is the String::formatted() use in the node metadata.
2022-01-29Kernel: Switch process file descriptor table from spinlock to mutexAndreas Kling
There's no reason for this to use a spinlock. Instead, let's allow threads to block if someone else is using the descriptor table.
2022-01-29Kernel: Convert process file descriptor table to a SpinlockProtectedAndreas Kling
Instead of manually locking in the various member functions of Process::OpenFileDescriptions, simply wrap it in a SpinlockProtected.
2022-01-16Kernel: Make Processor::capture_stack_trace fallible using ErrorOrIdan Horowitz
2022-01-16Kernel: Remove useless return value from procfs_get_thread_stackIdan Horowitz
2022-01-12Kernel: Convert ProcFS Process getters to try_serialize_absolute_pathIdan Horowitz
2022-01-12Kernel: Replace all usages of String::number with KString::numberIdan Horowitz
2021-12-30Kernel: Add some implied auto qualifiersHendiadyoin1
2021-12-30Kernel: Remove redundant (K)String::characters() callsDaniel Bertalan
2021-12-30Kernel+AK: Eliminate a couple of temporary String allocationsDaniel Bertalan
2021-12-12Kernel+SystemServer: Add /dev/ttyDaniel Bertalan
This file refers to the controlling terminal associated with the current process. It's specified by POSIX, and is used by ports like openssh to interface with the terminal even if the standard input/output is redirected to somewhere else. Our implementation leverages ProcFS's existing facilities to create process-specific symbolic links. In our setup, `/dev/tty` is a symbolic link to `/proc/self/tty`, which itself is a symlink to the appropriate `/dev/pts` entry. If no TTY is attached, `/dev/tty` is left dangling.
2021-11-18Kernel: Use DistinctNumeric for filesystem ID'sAndreas Kling
This patch adds the FileSystemID type, which is a distinct u32. This prevents accidental conversion from arbitrary integers.
2021-11-10Kernel: Make Inode::traverse_as_directory() callback return ErrorOrAndreas Kling
This allows us to propagate errors from inside the callback with TRY().
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-11-08Kernel: Expose inode information in /proc/pid/fdsBen Wiederhake
2021-10-31Kernel: Clarify ambiguous {File,Description}::absolute_pathBen Wiederhake
Found due to smelly code in InodeFile::absolute_path. In particular, this replaces the following misleading methods: File::absolute_path This method *never* returns an actual path, and if called on an InodeFile (which is impossible), it would VERIFY_NOT_REACHED(). OpenFileDescription::try_serialize_absolute_path OpenFileDescription::absolute_path These methods do not guarantee to return an actual path (just like the other method), and just like Custody::absolute_path they do not guarantee accuracy. In particular, just renaming the method made a TOCTOU bug obvious. The new method signatures use KResultOr, just like try_serialize_absolute_path() already did.
2021-09-07Kernel: Make PerformanceEventBuffer::to_json() return a KResultAndreas Kling
There's a ton of things inside to_json() that could go wrong but we don't know about it yet. One step at a time.
2021-09-07Kernel: Add const variant of Process::perf_events()Andreas Kling
This lets us get rid of some const_casts.
2021-09-07Kernel: Rename file_description(fd) => open_file_description(fd)Andreas Kling
To go with the class rename.
2021-09-07Kernel: Rename FileDescription => OpenFileDescriptionAndreas Kling
Dr. POSIX really calls these "open file description", not just "file description", so let's call them exactly that. :^)
2021-09-06Kernel: Make KBufferBuilder::append() & friends return KResultAndreas Kling
This allows callers to react to a failed append (due to OOM.)
2021-09-06Kernel: Use TRY() more in process-specific ProcFS codeAndreas Kling
2021-09-05Kernel: Make file description lookup return KResultOrAndreas Kling
Instead of checking it at every call site (to generate EBADF), we make file_description(fd) return a KResultOr<NonnullRefPtr<FileDescription>>. This allows us to wrap all the calls in TRY(). :^) The only place that got a little bit messier from this is sys$mount(), and there's a whole bunch of things there in need of cleanup.
2021-08-22Kernel: Rename ScopedSpinlock => SpinlockLockerAndreas Kling
This matches MutexLocker, and doesn't sound like it's a lock itself.
2021-08-22Kernel: Rename SpinLock => SpinlockAndreas Kling
2021-08-19Kernel: Make Process::current() return a Process& instead of Process*Idan Horowitz
This has several benefits: 1) We no longer just blindly derefence a null pointer in various places 2) We will get nicer runtime error messages if the current process does turn out to be null in the call location 3) GCC no longer complains about possible nullptr dereferences when compiling without KUBSAN
2021-08-18Kernel: Specify directory entry types properlySergey Bugaev
...in a few more places, at least. find(1) is about to start relying on the reported types more or less reflecting reality. This is especially relevant for magic symlinks in ProcFS.
2021-08-17Kernel/ProcFS: Avoid String allocation when traversing /proc/PID/fd/Andreas Kling
2021-08-16Kernel: Avoid enumerating all the fds to find a specific one in procfsAli Mohammad Pur
2021-08-15Kernel/ProcFS: Avoid two unnecessary number-to-string conversionsAndreas Kling
We don't need to create a new string from a number in order to compare an existing string to that number. Converting the existing string to a number is much cheaper, since it does not require any heap allocations. Ran into this while profiling "find /" :^)
2021-08-15Kernel+Userland: Remove chroot functionalityAndreas Kling
We are not using this for anything and it's just been sitting there gathering dust for well over a year, so let's stop carrying all this complexity around for no good reason.
2021-08-15Kernel: Move ProcFS related overrides in Process to ProcessProcFSTraitssin-ack
This allows us to 1) let go of the Process when an inode is ref'ing for ProcFSExposedComponent related reasons, and 2) change our ref/unref implementation.
2021-08-15Kernel: Handle allocation failure in ProcFS and friendssin-ack
There were many places in which allocation failure was noticed but ignored.
2021-08-12Kernel: Steer away from heap allocations for ProcFS process dataLiav A
Instead, use more static patterns to acquire that sort of data.
2021-08-06Kernel: Rename Process::space() => Process::address_space()Andreas Kling
We commonly talk about "a process's address space" so let's nudge the code towards matching how we talk about it. :^)
2021-08-06Kernel: Move Kernel/Memory/ code into Kernel::Memory namespaceAndreas Kling
2021-08-06Kernel: Rename Kernel/VM/ to Kernel/Memory/Andreas Kling
This directory isn't just about virtual memory, it's about all kinds of memory management.
2021-07-25Kernel: Make purgeable memory a VMObject level concept (again)Andreas Kling
This patch changes the semantics of purgeable memory. - AnonymousVMObject now has a "purgeable" flag. It can only be set when constructing the object. (Previously, all anonymous memory was effectively purgeable.) - AnonymousVMObject now has a "volatile" flag. It covers the entire range of physical pages. (Previously, we tracked ranges of volatile pages, effectively making it a page-level concept.) - Non-volatile objects maintain a physical page reservation via the committed pages mechanism, to ensure full coverage for page faults. - When an object is made volatile, it relinquishes any unused committed pages immediately. If later made non-volatile again, we then attempt to make a new committed pages reservation. If this fails, we return ENOMEM to userspace. mmap() now creates purgeable objects if passed the MAP_PURGEABLE option together with MAP_ANONYMOUS. anon_create() memory is always purgeable.
2021-07-18Kernel: Rename Locker => MutexLockerAndreas Kling
2021-07-17Kernel/ProcFS: Remove unused ProcFSExposedComponent::entries_count()Andreas Kling
2021-07-17Kernel: Replace "folder" => "directory" everywhereAndreas Kling
Folders are a GUI concept. File systems have directories.