Commit graph

48788 commits

Author SHA1 Message Date
thankyouverycool 82c06f58af LibGUI: Allow ComboBox windows to intersect Desktop's entire height
Minus a tasteful item height remainder. Ignoring Taskbar is okay now
that the window is a PopUp.

Also expands its width if intersection with the Desktop makes its
ListView scrollable. ComboBox windows no longer intersect horizontally,
remaining firmly "attached" to the editor, similar to other classic UIs.
2023-04-04 19:15:15 +02:00
thankyouverycool 99f28cf4ac LibGUI: Remove calculated_min_size() for ListViews
Originally implemented to handle resizable ComboBox windows, this
"feature" no longer exists, so calculating min size is no longer
necessary. The calculation was also failing to account for dynamic
ListViews properly.

This patch simplifies things by setting ComboBox ListView's minimum size
explicitly and deferring to AbstractScrollableWidget's more flexible
calculated implementation otherwise.

Fixes FontPicker resizing incorrectly due to overly rigid ListViews.
2023-04-04 19:15:15 +02:00
Andreas Kling bd46397e1f Kernel: Mark inode watcher syscalls as not needing the big lock
These syscalls are already protected by existing locking mechanisms,
including the mutex inside InodeWatcher.
2023-04-04 10:33:42 +02:00
Andreas Kling 08d79c757a Kernel: Mark sys$killpg as not needing the big lock
Same as sys$kill, nothing here that isn't already protected by existing
locks.
2023-04-04 10:33:42 +02:00
Andreas Kling e71b84228e Kernel: Mark sys$kill as not needing the big lock
This syscall sends a signal to other threads or itself. This mechanism
is already guarded by locking mechanisms, and widely used within the
kernel without help from the big lock.
2023-04-04 10:33:42 +02:00
Andreas Kling 3108daecc5 Kernel: Remove ancient InterruptDisablers in the kill/killpg syscalls
These are artifacts from the pre-SMP times.
2023-04-04 10:33:42 +02:00
Andreas Kling 46ab245e74 Kernel: Mark sys$getrusage as not needing the big lock
Same deal as sys$times, nothing here that needs locking at the moment.
2023-04-04 10:33:42 +02:00
Andreas Kling 3371165588 Kernel: Make the getsockname/getpeername syscall helper a bit nicer
Instead of templatizing on a bool parameter, use an enum for clarity.
2023-04-04 10:33:42 +02:00
Andreas Kling 5bc7882b68 Kernel: Make sys$times not use the big lock
...and also make the Process tick counters clock_t instead of u32.
It seems harmless to get interrupted in the middle of reading these
counters and reporting slightly fewer ticks in some category.
2023-04-04 10:33:42 +02:00
Andreas Kling b98f537f11 Kernel+Userland: Make some of the POSIX types larger
Expand the following types from 32-bit to 64-bit:
- blkcnt_t
- blksize_t
- dev_t
- nlink_t
- suseconds_t
- clock_t

This matches their size on other 64-bit systems.
2023-04-04 10:33:42 +02:00
Andreas Kling d8bb32117e Kernel: Mark sys$umask as not needing the big lock
The body of this syscall is already serialized by calling
with_mutable_protected_data().
2023-04-04 10:33:42 +02:00
Andreas Kling 6c02c493f1 Kernel: Mark sys$sigtimedwait as not needing the big lock
Yet another syscall that only messes with the current thread.
2023-04-04 10:33:42 +02:00
Andreas Kling f0b5c585f2 Kernel: Mark sys$sigpending as not needing the big lock
Another one that only touches the current thread.
2023-04-04 10:33:42 +02:00
Andreas Kling e9fe0ecbae Kernel: Mark sys$sigprocmask as not needing the big lock
Another one that only messes with the current thread.
2023-04-04 10:33:42 +02:00
Andreas Kling d1fae8b09c Kernel: Mark sys$sigsuspend as not needing the big lock
This syscall is only concerned with the current thread.
2023-04-04 10:33:42 +02:00
Andreas Kling 374f4aeab9 Kernel: Mark sys$sigreturn as not needing the big lock
This syscall is only concerned with the current thread (except in the
case of a pledge violation, when it will add some details about that
to the process coredump metadata. That stuff is already serialized.)
2023-04-04 10:33:42 +02:00
Andreas Kling a7212a7488 Kernel: Mark sys$open as not needing the big lock
All the individual sub-operations of this syscall are protected by their
own locking mechanisms, so it should be okay to get it off the big lock.
2023-04-04 10:33:42 +02:00
Andreas Kling 97ac4601f5 Kernel: Use custody_for_dirfd() in more syscalls
This simplifies a lot of syscalls, some of which were doing very
unnecessarily verbose things instead of calling this.
2023-04-04 10:33:42 +02:00
Andreas Kling f0c9c5e076 Kernel: Make custody_for_dirfd() fail on files other than directories 2023-04-04 10:33:42 +02:00
Andreas Kling 41f5598516 Kernel: Make sys$getsid not require the big lock
Reorganize the code slightly to avoid creating a TOCTOU bug, then mark
the syscall as not needing the big lock anymore.
2023-04-04 10:33:42 +02:00
Andreas Kling 1382439267 Kernel: Mark sys$getpgrp as not needing the big lock
Access to the process's process group is already serialized by
SpinlockProtected.
2023-04-04 10:33:42 +02:00
Andreas Kling 2ddd69260c Kernel: Mark sys$getpgid as not needing the big lock
Access to the process's process group is already serialized by
SpinlockProtected.
2023-04-04 10:33:42 +02:00
Andreas Kling 775e6d6865 Kernel: Mark sys$fcntl as not needing the big lock
This syscall operates on the file descriptor table, and on individual
open file descriptions. Both of those are already protected by scoped
locking mechanisms.
2023-04-04 10:33:42 +02:00
Andreas Kling 6132193bd4 Kernel: Make sys$disown not require the big lock
This syscall had a TOCTOU where it checked the peer's PPID before
locking the protected data (where the PPID is stored).

After closing the race window, we can mark the syscall as not needing
the big lock.
2023-04-04 10:33:42 +02:00
Andreas Kling 5759ea19fb Kernel: Mark sys$alarm as not needing the big lock
Access to Process::m_alarm_timer is serialized via SpinlockProtected,
so there's no longer need for this syscall to use the big lock.
2023-04-04 10:33:42 +02:00
Andreas Kling 496d918e92 Kernel: Stop using *LockRefPtr for Kernel::Timer 2023-04-04 10:33:42 +02:00
Andreas Kling 83b409083b Kernel: Stop using *LockRefPtr for ProcessGroup
Had to wrap Process::m_pg in a SpinlockProtected for this to be safe.
2023-04-04 10:33:42 +02:00
Andreas Kling ed1253ab90 Kernel: Don't ref/unref the holder thread in Mutex
There was a whole bunch of ref counting churn coming from Mutex, which
had a RefPtr<Thread> m_holder to (mostly) point at the thread holding
the mutex.

Since we never actually dereference the m_holder value, but only use it
for identity checks against thread pointers, we can store it as an
uintptr_t and skip the ref counting entirely.

Threads can't die while holding a mutex anyway, so there's no risk of
them going missing on us.
2023-04-04 10:33:42 +02:00
Andreas Kling c3915e4058 Kernel: Stop using *LockRefPtr for Thread
These were stored in a bunch of places. The main one that's a bit iffy
is the Mutex::m_holder one, which I'm going to simplify in a subsequent
commit.

In Plan9FS and WorkQueue, we can't make the NNRPs const due to
initialization order problems. That's probably doable with further
cleanup, but left as an exercise for our future selves.

Before starting this, I expected the thread blockers to be a problem,
but as it turns out they were super straightforward (for once!) as they
don't mutate the thread after initiating a block, so they can just use
simple const-ified NNRPs.
2023-04-04 10:33:42 +02:00
Andreas Kling a098266ff5 Kernel: Simplify Process factory functions
- Instead of taking the first new thread as an out-parameter, we now
  bundle the process and its first thread in a struct and use that
  as the return value.

- Make all Process factory functions return ErrorOr. Use this to convert
  some places to more TRY().

- Drop the "try_" prefix on Process factory functions.
2023-04-04 10:33:42 +02:00
Andreas Kling 65438d8a85 Kernel: Stop using *LockRefPtr for Process pointers
The only persistent one of these was Thread::m_process and that never
changes after initialization. Make it const to enforce this and switch
everything over to RefPtr & NonnullRefPtr.
2023-04-04 10:33:42 +02:00
Andreas Kling 19084ef743 Kernel: Simplify Mount internals
- The host custody never changes after initialization, so there's no
  need to protect it with a spinlock.

- To enforce the fact that some members don't change after
  initialization, make them const.
2023-04-04 10:33:42 +02:00
Andreas Kling 673592dea8 Kernel: Stop using *LockRefPtr for FileSystem pointers
There was only one permanent storage location for these: as a member
in the Mount class.

That member is never modified after Mount initialization, so we don't
need to worry about races there.
2023-04-04 10:33:42 +02:00
Caoimhe 3f69ef86c2 Kernel/aarch64: Implement Processor::time_spent_idle() 2023-04-04 10:30:09 +02:00
Timon Kruiper bd2011406e Kernel: Merge x86_64 and aarch64 init.cpp files 2023-04-03 20:01:28 -06:00
Timon Kruiper c31dc82b17 Kernel: Move deferred call code into separate DeferredCallPool class
This allows us to share this code between the x86_64 and aarch64 build.
2023-04-03 20:01:28 -06:00
Timon Kruiper 1f68ac600c Kernel/aarch64: Correctly implement Processor::leave_critical 2023-04-03 20:01:28 -06:00
Timon Kruiper 1fa1f09c38 Kernel/Graphics: Only search for PCI graphics cards on x86_64
This is for the upcoming commit that merges the x86_64 and aarch64
init.cpp files.
2023-04-03 20:01:28 -06:00
Timon Kruiper 14d20618f1 Kernel/aarch64: Move query_firmware_version into RPi::Mailbox
This is for the upcoming commit that merges the x86_64 and aarch64
init.cpp files.
2023-04-03 20:01:28 -06:00
Timon Kruiper 2613ac4cb4 Kernel/aarch64: Move logo drawing and initializing into RPi::Framebuffer
This is for a upcoming commit that merges the x86_64 and aarch64
init.cpp files.
2023-04-03 20:01:28 -06:00
Timon Kruiper aa40cef2b7 Kernel: Disable interrupts for aarch64 in WorkQueue's main loop
This code expects to be executed with interrupts disabled, however we
currently spawn (kernel) threads with interrupts enabled on aarch64.
2023-04-03 20:01:28 -06:00
Timon Kruiper 05b9eb7feb Kernel/aarch64: Rename Processor::install to Processor::early_initialize
Also pass the cpu number to Processor::initialize. This way the init
code can be shared between the x86_64 and aarch64 build.
2023-04-03 20:01:28 -06:00
Fabian Dellwing 14d78e10d1 LibGUI+CertificateSettings: Use custom SortingProxy
The default SortingProxyModel does not allow to react to reodering.
As we would like to keep the column width on sorting, we create a
subclass and inject our code into the sorting method.
2023-04-03 19:58:47 -06:00
Fabian Dellwing dfce65a0ab CertificateSettings: Add export functionality 2023-04-03 19:58:47 -06:00
Fabian Dellwing 8b881eaf02 LibCrypto: Add PEM encoder
This commit adds a new method to create a PEM encoded ASN1 from
its DER variant.
2023-04-03 19:58:47 -06:00
Fabian Dellwing 7ce75ee3c5 CertificateSettings: Add import functionality 2023-04-03 19:58:47 -06:00
Fabian Dellwing c273784c3e CertificateSettings: Create basic Cert Store application
This commit adds a new application named CertificateSettings that
houses our Cert Store. It should be expanded in the future.
2023-04-03 19:58:47 -06:00
Fabian Dellwing 459dee1f86 LibTLS: Refactor CA loading into central function 2023-04-03 19:58:47 -06:00
Daniel Bertalan 924758c6f8 Toolchain+Meta: Support kernel debugging with host AArch64 GDB
Previously, we would unconditionally build GDB from source for the
AArch64 toolchain. This commit makes it possible to use the system's
`gdb` binary if it supports the architecture, or `aarch64-elf-gdb` if
such a package is installed.

An `aarch64-elf-gdb` package will be available through Homebrew once
this PR is merged: https://github.com/Homebrew/homebrew-core/pull/127323
2023-04-03 19:56:09 -06:00
Lucas CHOLLET 66c12af45f LibTest: Don't output information on tests if none exist 2023-04-03 20:58:49 +01:00