Commit graph

25287 commits

Author SHA1 Message Date
Timothy
62af82f494 AK: Use east const in MappedFile 2021-08-07 12:48:22 +02:00
Timothy
bc75ca4fe5 AK: Add method to create MappedFile from fd 2021-08-07 12:48:22 +02:00
Timothy
95ee7069d5 FileSystemAccessServer: Add window title as parameter for opening file 2021-08-07 12:48:22 +02:00
Brian Gianforcaro
d496eb48e3 Kernel: Fix boot profiling after big process lock separation regression
When I laid down the foundation for the start of the big process lock
separation, I added asserts to all system call implementations to
validate we hold the big process lock in the locations we think we
should be.

Adding that assert to sys$profiling_enable broke boot time profiling as
we were never holding the lock on boot. Even though it's not technically
required, lets make sure to hold the lock while enabling to appease the
assert.
2021-08-07 12:38:59 +02:00
Andreas Kling
58fb38551c Kernel/TTY: Remove redundant SpinLock from VirtualConsole
VirtualConsole::m_lock was only used in a single place: on_tty_write()
That function is already protected by a global lock, so this second
lock served no purpose whatsoever.
2021-08-07 12:38:14 +02:00
Brian Gianforcaro
b5b67a1747 SystemServer: Handle missing service executable gracefully
I use the `configure-components` functionality locally during
development. There are a few services (SpiceAgent) which aren't marked
as required components, and hence aren't built in all configurations,
but we still try to launch them in all configurations.

Instead of letting the forked SystemServer process crash, lets
gracefully handle the situation of a missing binary and provide a
message to the user.
2021-08-07 12:30:50 +02:00
Andreas Kling
5acb7e4eba Kernel: Remove outdated FIXME about ProcessHandle
ProcessHandle hasn't been a thing since Process became ref-counted.
2021-08-07 12:29:26 +02:00
Liav A
02c72de090 Meta: Remove legacy hardware components from Q35 machine
As this is a test machine I use personally to test "modern" hardware
setups, it feels quite comfortable to not care too much about VGA with
this type of machine.
Also, we don't actively use the IDE controller on this machine type, so
let's just remove it :^)
2021-08-07 11:49:07 +02:00
Jean-Baptiste Boric
08891e82a5 Kernel: Migrate process list locking to ProtectedValue
The existing recursive spinlock is repurposed for profiling only, as it
was shared with the process list.
2021-08-07 11:48:00 +02:00
Jean-Baptiste Boric
8554b66d09 Kernel: Make process list a singleton 2021-08-07 11:48:00 +02:00
Jean-Baptiste Boric
626b99ce1c Kernel: Migrate hostname locking to ProtectedValue 2021-08-07 11:48:00 +02:00
Jean-Baptiste Boric
9517100672 Kernel: Migrate UDP socket table locking to ProtectedValue 2021-08-07 11:48:00 +02:00
Jean-Baptiste Boric
9216c72bfe Kernel: Migrate TCP socket tables locking to ProtectedValue
Note: TCPSocket::create_client() has a dubious locking process where
the sockets by tuple table is first shared lock to check if the socket
exists and bail out if it does, then unlocks, then exclusively locks to
add the tuple. There could be a race condition where two client
creation requests for the same tuple happen at the same time and both
cleared the shared lock check. When in doubt, lock exclusively the
whole time.
2021-08-07 11:48:00 +02:00
Jean-Baptiste Boric
583abc27d8 Kernel: Migrate IPv4 socket table locking to ProtectedValue 2021-08-07 11:48:00 +02:00
Jean-Baptiste Boric
edd6c04024 Kernel: Migrate local socket table locking to ProtectedValue 2021-08-07 11:48:00 +02:00
Jean-Baptiste Boric
6d83b2d8f0 Kernel: Migrate FIFO table locking to ProtectedValue 2021-08-07 11:48:00 +02:00
Jean-Baptiste Boric
25d7beec6b Kernel: Use atomic integer for next FIFO id 2021-08-07 11:48:00 +02:00
Jean-Baptiste Boric
738e604bfc Kernel: Migrate ARP table locking to ProtectedValue 2021-08-07 11:48:00 +02:00
Jean-Baptiste Boric
75260bff92 Kernel: Introduce ProtectedValue
A protected value is a variable with enforced locking semantics. The
value is protected with a Mutex and can only be accessed through a
Locked object that holds a MutexLocker to said Mutex. Therefore, the
value itself cannot be accessed except through the proper locking
mechanism, which enforces correct locking semantics.

The Locked object has knowledge of shared and exclusive lock types and
will only return const-correct references and pointers. This should
help catch incorrect locking usage where a shared lock is acquired but
the user then modifies the locked value.

This is not a perfect solution because dereferencing the Locked object
returns the value, so the caller could defeat the protected value
semantics once it acquires a lock by keeping a pointer or a reference
to the value around. Then again, this is C++ and we can't protect
against malicious users from within the kernel anyways, but we can
raise the threshold above "didn't pay attention".
2021-08-07 11:48:00 +02:00
Jean-Baptiste Boric
39ceefa5dd Kernel: Implement contended, ref-counted resource framework
This is some syntaxic sugar to use a ContendedResource object with
reference counting. This effectively dissociates merely holding a
reference to an object and actually using the object in a way that
requires locking it against concurrent use.
2021-08-07 11:48:00 +02:00
Jean-Baptiste Boric
019ad8a507 Kernel: Introduce spin-locked contended and locked resource concepts 2021-08-07 11:48:00 +02:00
Jean-Baptiste Boric
3d684316c2 Kernel: Introduce contended and locked resource concepts 2021-08-07 11:48:00 +02:00
Jean-Baptiste Boric
aea98a85d1 Kernel: Move Lockable into its own header 2021-08-07 11:48:00 +02:00
Jean-Baptiste Boric
2c3b0baf76 Kernel: Move SpinLock.h into Locking/ 2021-08-07 11:48:00 +02:00
Jean-Baptiste Boric
f7f794e74a Kernel: Move Mutex into Locking/ 2021-08-07 11:48:00 +02:00
Jean-Baptiste Boric
479b07339c Kernel: Move LockMode into Locking/ 2021-08-07 11:48:00 +02:00
Jean-Baptiste Boric
786036820b AK: Introduce IntrusiveListRelaxedConst
This container is the same as IntrusiveList, except that it allows
modifications to the elements even if the reference to the
IntrusiveList itself is const, by returning mutable iterators. This
represents a use-case where we want to allow modifications to the
elements while keeping the list itself immutable.

This behavior is explicitely opt-in by using IntrusiveListRelaxedConst
instead of IntrusiveList. It will be useful later on when we model
shared/exclusive locks with the help of const and mutable references.
2021-08-07 11:48:00 +02:00
sin-ack
bb609cee7f Meta: Add run-local.sh
This allows one to set their desired parameters for run.sh without the
need to set them in every terminal session or add it to the user account
shell files. If a run-local.sh file exists at the repository root and is
executable, it will be sourced. The file can contain any variables that
are expected to be set in run.sh.
2021-08-07 11:47:07 +02:00
sin-ack
ab39a94fdf LibJS: Cast length to signed integer before subtraction
length is size_t as returned, and so subtracting from it may cause
underflow. We handle this case by just casting it to a signed value, and
the for loop predicate takes care of the rest.
2021-08-07 11:32:16 +02:00
sin-ack
3bea3f11e5 CI: Fix node-version typo
Otherwise this generates an "unexpected inputs" warning.
2021-08-07 09:30:28 +02:00
Linus Groh
f12152f77e LibJS: Reflect an editorial change in the Temporal spec
See: https://github.com/tc39/proposal-temporal/commit/fb9b550
2021-08-07 01:21:39 +01:00
Linus Groh
5d536c7fbc LibJS: Reflect infallibility editorial changes in the Temporal spec
See: https://github.com/tc39/proposal-temporal/commit/de918c9
2021-08-07 01:15:45 +01:00
LuK1337
0a7041aad7 Taskbar: Pass full argv for exit action
We need to pass --now to `shutdown` command.
2021-08-07 01:37:28 +02:00
Andreas Kling
f770b9d430 Kernel: Fix bad search-and-replace renames
Oops, I didn't mean to change every *Range* to *VirtualRange*!
2021-08-07 00:39:06 +02:00
Tobias Christiansen
0ca085910e PixelPaint: Make Guides' visibility optional
Whether Guides are drawn or not is now controlled via the menu-entry
View->Show Guides.
2021-08-07 02:52:47 +04:30
Tobias Christiansen
193f1e01cf PixelPaint: Add the GuideTool to the Toolbox
This also adds a custom icon for the GuideTool.
2021-08-07 02:52:47 +04:30
Tobias Christiansen
7923929a4d PixelPaint: Add GuideTool for editing Guides
This patch adds the logic for the GuideTool. Pulling in from outside the
image creates a new Guide, moving a Guide outside of the image deletes
it and a Guide can be deleteted via the context menu.
A Guide is considered clicked when the cursor is less than 20 pixels
away from the line.
2021-08-07 02:52:47 +04:30
Tobias Christiansen
d4cf4b74c1 PixelPaint: Allow creation of Guides via the View-Menu
You can specify the offset in percent, and it's getting parsed and
calculated appropriately.
2021-08-07 02:52:47 +04:30
Tobias Christiansen
515bbd0b83 PixelPaint: Add a Dialog for the creation of a Guide
You can select whether you want a horizontal or a vertical Guide and
specify the offset you want it to be at.
2021-08-07 02:52:47 +04:30
Tobias Christiansen
a717caa4b7 PixelPaint: Include Guides in the ImageEditor
The ImageEditor knows about its Guides, how to draw them and exposes
ways to manipulate them.
2021-08-07 02:52:47 +04:30
Tobias Christiansen
7e01d06226 PixelPaint: Add Guide class
This will allow the user to add Guides to the image, that will only be
visible in the Editor, not affecting the image.
2021-08-07 02:52:47 +04:30
Tobias Christiansen
61a1122c2d LibGfx: Add alternate_color to draw_line
This alternate_color can be used when drawing dashed lines to have two
alternating Colors.
2021-08-07 02:52:47 +04:30
Marcus Nilsson
4a57a4a0b3 PixelPaint: Use a StackWidget in ToolPropertiesWidget
Previously changing tools while simultaneously using a widget like a
slider would result in a event_dispatch() failure.
Instead use a StackWidget to set the active widget.
2021-08-06 23:59:14 +02:00
Lenny Maiorani
2e6fc13b1e AK: Implement any_of using common implementation
Problem:
- `any_of` is implemented in 2 different ways, one for the entire
  container and a different implementation for a partial container
  using iterators.

Solution:
- Follow the "don't repeat yourself" (DRY) idiom and implement the
  entire container version in terms of the partial version.
2021-08-06 23:57:48 +02:00
Lenny Maiorani
8e949c5c91 Tests: Remove unused variables for clang build
Problem:
- Clang will not build `Tests/LibTLS` due to unused variables.

Solution:
- Remove the unused variables.
2021-08-06 23:55:27 +02:00
Lenny Maiorani
da10ad3f0d LibSQL: Use compiler generated default functions
Problem:
- Clang ToT generates warnings due to user-declared functions causing
  the implicitly generated assignment operator to not be generated.

Solution:
- Declare the default constructor `= default`.
- Remove the default copy constructor declaration.
2021-08-06 23:54:36 +02:00
Karol Kosek
91c9d9ee88 LibAudio: Make playing lossy flacs more truthful
Playing a lossy flac file resulted in hearing something
you'd not like to play.  Instead of your lovely bass, you had sounds
as if you put a CD-ROM disc to a CD player.

It turned out that the size for making signed values was too big,
making all the values unsigned.

I've used lossyWav[1] (the posix port[2] to be exact)
to generate such files.

[1]: https://wiki.hydrogenaud.io/index.php?title=LossyWAV
[2]: https://github.com/MoSal/lossywav-for-posix
2021-08-06 23:50:10 +02:00
Karol Kosek
837803531a LibAudio: Fix calculation of wasted bits-per-sample
The value was always zero.
2021-08-06 23:50:10 +02:00
Karol Kosek
2ecd115176 LibAudio: Make read samples signed when decoding fixed FLAC subframes
Prior this change, decoding fixed subframes produced "unpleasant
crackling noices".

While the type doesn't appear so often when using the default settings,
encoding files in flac(1) with --fast option uses fixed subframes
almost every time.

This also applies the logic to the constant subframes,
which isn't so important, as the type is generally for the silence,
but let's use it as well to avoid inconsistency.
2021-08-06 23:50:10 +02:00
Idan Horowitz
ad419a669d Kernel: Disable big process lock for sys$sysconf
This syscall only reads constant kernel globals, and as such does not
need to hold the big lock.
2021-08-06 23:36:12 +02:00