Commit graph

25316 commits

Author SHA1 Message Date
Andreas Kling
eb60cb156d AK: Bring Singleton into the global namespace with using 2021-08-08 00:03:45 +02:00
Andreas Kling
15d033b486 Kernel: Remove unused Process pointer in Memory::AddressSpace
Nobody was using the back-pointer to the process, so let's lose it.
2021-08-08 00:03:45 +02:00
Andreas Kling
2362ebf483 Build: Add -fsized-deallocation to global CXXFLAGS
This is enabled by default for GCC (>=C++14) but apparently not for
Clang, which has been causing CLion to get confused about kernel code.
2021-08-08 00:03:45 +02:00
Itamar
9da9398bf0 LibCpp: Do macro substitution in the preprocessor instead of the parser
After this change, the parser is completely separated from preprocessor
concepts.
2021-08-07 21:24:11 +02:00
Itamar
0c4dc00f01 LibCpp: Import definitions from headers while processing
When the preprocessor encounters an #include statement it now adds
the preprocessor definitions that exist in the included header to its
own set of definitions.

We previously only aggregated the definitions from headers after
processing the source, which was less correct. (For example, there
could be an #ifdef that depends on a definition from another header).
2021-08-07 21:24:11 +02:00
Itamar
4673a517f6 LibCpp: Do lexing in the Preprocessor
We now call Preprocessor::process_and_lex() and pass the result to the
parser.

Doing the lexing in the preprocessor will allow us to maintain the
original position information of tokens after substituting definitions.
2021-08-07 21:24:11 +02:00
Itamar
bf7262681e LibCpp: Support initializing the lexer with a "start line" 2021-08-07 21:24:11 +02:00
Andreas Kling
5fda8a6c36 LibGUI: Don't assume GUI::Icon has 16x16 bitmap in AbstractTableView
An empty GUI::Icon would cause the column auto-sizing logic to crash.
2021-08-07 21:11:04 +02:00
Andreas Kling
0cb6c3c831 Kernel/TCP: Port TCP retransmit queue to ProtectedValue
I had to switch to exclusive locking since ProtectedValue rightly
doesn't allow you to mutate protected data with only a shared lock.
2021-08-07 18:49:27 +02:00
Andreas Kling
4c582b57e9 Kernel: Port PTYMultiplexer to ProtectedValue 2021-08-07 18:49:27 +02:00
Andreas Kling
7f2791f02e Kernel: Increase maximum PTY count from 8 to 64
Let's allow users to allocate more pseudo-terminals if they want.
2021-08-07 18:49:27 +02:00
Andrew Kaster
c4604bc080 CI: Don't build libjs for Lagom twice
We need test-js for the parser tests for test262, but we don't need to
rebuild all of Lagom twice. This was missed when we did the initial
change to shared libraries. Before #9017, the Lagom build for test-js
is what built libLagom.a for the libjs-test262-runner to link against.

Now that we are building libjs.so and its dependencies in the runner's
build directory, we should build test-js there as well.

Requires linusg/libjs-test262#32 in order to properly find the built
test-js.
2021-08-07 16:34:06 +01:00
thisSyntaxSucksAndYouKnowIt
f583cddaf7 Solitaire: Don't allow the player to draw cards while mouse is down 2021-08-07 16:59:46 +02:00
Linus Groh
81784afbe1 Ports: Fix Python's expected SHA256 sum
Fixes #9265.
2021-08-07 15:10:50 +01:00
Andrew Kaster
891bc81f30 Meta: Remove syslog.h from clang-format exclusion list
Before Libraries was moved to Userland/Libraries syslog.h had a bunch
of manually aligned defines and array initializations.

Andreas seems to have formatted the file with clang-format as part of
that file move. Since syslog.h is now properly formatted, we don't
need to exclude it from the linter list.
2021-08-07 15:36:51 +02:00
Idan Horowitz
e548c1f489 CI: Cache UnicodeData files on the self-hosted test262 runner
We already cache these files to prevent re-downloading them in the other
CI workflows, so this just brings the test262 runner up to speed with
the rest of them.
2021-08-07 15:30:47 +02:00
Idan Horowitz
9d21c79671 Kernel: Disable big process lock for sys$sync
This syscall doesn't touch any intra-process shared resources and only
calls VirtualFileSystem::sync, which is self-locking.
2021-08-07 15:30:26 +02:00
sin-ack
0d468f2282 Kernel: Implement a ISO 9660 filesystem reader :^)
This commit implements the ISO 9660 filesystem as specified in ECMA 119.
Currently, it only supports the base specification and Joliet or Rock
Ridge support is not present. The filesystem will normalize all
filenames to be lowercase (same as Linux).

The filesystem can be mounted directly from a file. Loop devices are
currently not supported by SerenityOS.

Special thanks to Lubrsi for testing on real hardware and providing
profiling help.

Co-Authored-By: Luke <luke.wilde@live.co.uk>
2021-08-07 15:21:58 +02:00
sin-ack
a2a553b286 AK: Add RecursionDecision
Similar to IterationDecision, this can be returned from callbacks passed
to recursive traversal functions to signal how to proceed.
2021-08-07 15:21:58 +02:00
Tobias Christiansen
833936f3ec LibWeb: Add auto as a recognized argument of flex-basis
There isn't actually any special treatment of this over 'content' in
the FlexFormattingContext, for now both are treated the same.
This fixes #9225
2021-08-07 15:21:34 +02:00
Linus Groh
6852ba4d34 LibJS: Implement Temporal.Instant.prototype.subtract() 2021-08-07 13:10:35 +01:00
Linus Groh
b38f1fb071 LibJS: Implement Temporal.Instant.prototype.add() 2021-08-07 13:10:35 +01:00
Linus Groh
8ffad70504 LibJS: Add missing spec link to Temporal.Instant.prototype.round() 2021-08-07 13:10:35 +01:00
Andreas Kling
b197fc40a7 Kernel: Port process thread lists to SpinLockProtectedValue
I had to move the thread list out of the protected base area of Process
so that it could live with its lock (which needs to be mutable).
Ideally it would live in the protected area, so maybe we can figure out
a way to do that later.
2021-08-07 13:46:16 +02:00
Andreas Kling
d6667e4cb8 Kernel: Port process groups to SpinLockProtectedValue 2021-08-07 13:30:59 +02:00
Linus Groh
6762378f89 LibJS/Tests: Add length test for Temporal.Instant.prototype.round() 2021-08-07 12:10:34 +01:00
Linus Groh
cdb0c879d3 LibJS/Tests: Add length test for Temporal.Instant.prototype.equals() 2021-08-07 12:10:34 +01:00
Linus Groh
a8ba2f4b21 LibJS/Tests: Fix bad copy and paste that crept into a lot of tests
The top-level function should have been `describe()``, but instead it's
been nested `test()`s.
2021-08-07 12:10:34 +01:00
Timothy
1927dbf025 PixelPaint: Use unveil to hide file system 2021-08-07 12:48:22 +02:00
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