Commit graph

11814 commits

Author SHA1 Message Date
Brian Gianforcaro
adb83d3adc AK: Decorate AK::TriState with [[nodiscard]]
TriState is another type of return code, it's value should always be
observed.
2020-08-05 17:29:01 +02:00
Brian Gianforcaro
3319803bd9 AK: Decorate atomic compare exchange operations with [[nodiscard]]
All CAS operations should always check return values, so they are
robust to failure in the event of conflict in parallel operation.
2020-08-05 17:28:44 +02:00
Linus Groh
9ef834384d LibGUI: Use set_cursor() in TextEditor::set_document()
Instead of setting m_cursor directly to reset the cursor position,
TextEditor::set_document() now uses set_cursor() which will call cursor
change callback functions, if any.

This fixes a bug in HackStudio where the cursor information text would
not update immediately after changing the active TextDocument, even
though the cursor is always visibly being reset to 0, 0.
2020-08-05 17:27:14 +02:00
Andreas Kling
e2b4fef6c7 LibWeb: Specialize hit testing for text cursor purposes
The text cursor follows slightly different "intuitive" rules than the
regular hit testing. Clicking past the right edge of a text box should
still "hit" the text box, and place the cursor at its end, for example.

We solve this by adding a HitTestType enum that is passed to hit_test()
and determines whether past-the-edge candidates are considered.
2020-08-05 16:57:51 +02:00
Linus Groh
5cee150a91 Base: Open .hackstudio files in HackStudio 2020-08-05 16:54:23 +02:00
Linus Groh
a8d7cd5a15 HackStudio: Open project or file from argv[1] if given
When HackStudio is invoked with one or more arguments it will attempt to
treat the first argument as a project or source file and open it
accordingly.
2020-08-05 16:54:23 +02:00
Linus Groh
0d493c1879 HackStudio: Rename project file format from .files to .hackstudio 2020-08-05 16:54:23 +02:00
Brian Gianforcaro
f34fcdedef AK: Decorate AK::NonnullOwnPtr::leak_ptr() with [[nodiscard]] 2020-08-05 16:12:00 +02:00
Brian Gianforcaro
fa625a2690 AK: Decorate AK::OwnPtr::leak_ptr() with [[nodiscard]]
We should always leak to an observed variable, otherwise
it's an actual leak. This is similar to AK::RefPtr::leak_ref()
which is also marked as [[nodiscard]].
2020-08-05 16:12:00 +02:00
Andreas Kling
00fe4c7bcb LibGfx: Make draw_scaled_bitmap() apply relative opacity
Instead of overriding the alpha value of all source pixels, apply the
override opacity by multiplying with the source alpha.

Fixes #3004.
2020-08-05 14:43:36 +02:00
Brian Gianforcaro
f3cbb79f80 Kernel: Decorate KResult with [[nodiscard]] 2020-08-05 14:36:48 +02:00
Brian Gianforcaro
946c96dd56 Kernel: Suppress remaining unobserved KResult return codes
These are all cases where there is no clear and easy fix,
I've left FIXME bread crumbs so that these can hopefully
be fixed over time.
2020-08-05 14:36:48 +02:00
Brian Gianforcaro
d67069d922 Kernel: Propagate a few KResults properly in FileSystem subsystems
Propagating un-obsevered KResults up the stack.
2020-08-05 14:36:48 +02:00
Brian Gianforcaro
c4c6d9367d Kernel: Fix build break from missing KResult [[nodiscard]] suppressions
Missed this somehow in previous change.
2020-08-05 14:06:54 +02:00
Brian Gianforcaro
fa666f6897 Kernel: Use Userspace<T> for the futex syscall
Utilizie Userspace<T> for the syscall argument itself, as well
as internally in the SC_futex_params struct.

We were double validating the SC_futex_params.timeout validation,
that was removed as well.
2020-08-05 13:03:50 +02:00
Brian Gianforcaro
a7a7e6245f AK: Decorate Optional<T> with [[nodisard]] 2020-08-05 12:27:15 +02:00
Brian Gianforcaro
9572c95152 LibTLS + LibCrypto: Suppress unobserved Optoinal<T> return values. 2020-08-05 12:27:15 +02:00
Brian Gianforcaro
125eab998f AK: Fix StringUtils tests to actually observe return value.
Noticed this while playing around with making Optional<T>
nodiscard.
2020-08-05 12:18:54 +02:00
Brian Gianforcaro
88092376f3 AK: Use AK relative include style for InlineLinkedList.h
This is the style that seems to be used in the rest of AK.
2020-08-05 12:13:50 +02:00
Brian Gianforcaro
5a984b811c Build: Re-enable -Werror when building with GCC
It looks like PR #2986 mistakenly removed this from both the
Clang and GCC CXX_FLAGS, when the intention seems to have been
to only disable it for Clang.
2020-08-05 12:07:20 +02:00
Luke
f71b112530 Documentation: Add an installation guide for VirtualBox
Now that Serenity can run on VirtualBox, it's time for the documentation.
2020-08-05 10:52:48 +02:00
Brian Gianforcaro
ea3ee4f3f3 Kernel: Decorate KResultOr with [[nodiscard]] to catch misbehaving callers
The [[nodiscard]] decorator enables us to have the compile emit a
warning anytime the decorated type or function's return value isn't
observed. It's very useful for catching error checking bugs in systems
which use C style error handling.
2020-08-05 10:26:29 +02:00
Brian Gianforcaro
e8c9b5e870 Kernel: Make Inode::directory_entry_count errors observable.
Certain implementations of Inode::directory_entry_count were calling
functions which returned errors, but had no way of surfacing them.
Switch the return type to KResultOr<size_t> and start observing these
error paths.
2020-08-05 10:26:29 +02:00
Brian Gianforcaro
7490ea9449 Kernel + LibPthread: Use Userspace<T> in the create_thread syscall 2020-08-05 09:36:53 +02:00
Brian Gianforcaro
337e8f98cd Kernel: Use Userspace<T> for the rename syscall 2020-08-05 09:36:53 +02:00
Brian Gianforcaro
c1541f4a61 Kernel: Use Userspace<T> for the mknod syscall 2020-08-05 09:36:53 +02:00
Brian Gianforcaro
d949b2a367 Kernel: Use Userspace<T> for the set_mmap_name syscall 2020-08-05 09:36:53 +02:00
Brian Gianforcaro
7449921f53 Kernel: Use Userspace<T> for the readlink syscall 2020-08-05 09:36:53 +02:00
Brian Gianforcaro
901dae0227 Kernel: Use Userspace<T> for the mmap syscall 2020-08-05 09:36:53 +02:00
Brian Gianforcaro
74d3b202f1 Kernel: Use Userspace<T> for the waitid syscall 2020-08-05 09:36:53 +02:00
Brian Gianforcaro
84035e1035 Kernel: Use Userspace<T> for the clock_nanosleep syscall 2020-08-05 09:36:53 +02:00
Brian Gianforcaro
baa070afb8 Kernel: Use Userspace<T> for the gettimeofday syscall 2020-08-05 09:36:53 +02:00
Brian Gianforcaro
1eeaed31c2 Kernel: Use Userspace<T> for the open syscall 2020-08-05 09:36:53 +02:00
Brian Gianforcaro
f3eb7db422 Kernel: Switch IPv4Socket receive queue to SinglyLinkedListWithCount<T>
Avoid walking the packet queue, instead use a linked list with a count.
2020-08-05 09:34:22 +02:00
Brian Gianforcaro
efb0805d8e AK: Add SinglyLinkedListWithCount<T>, a singulary linked list with count
There are use cases where a linked list is useful but it's also worth
the overhead to maintain a count so you can quickly answer queries of
the size of the list.
2020-08-05 09:34:22 +02:00
Andreas Kling
83e32788d5 Kernel: Send SIGTTIN and SIGTTOU signals on background TTY read/write
A process that is not in the foreground process group of a TTY should
not be allowed to read/write that TTY. Instead, we now send either a
SIGTTIN (on read) or SIGTTOU (on write) signal to the process, and fail
the I/O syscall with EINTR.

Fixes #205.
2020-08-04 21:25:44 +02:00
AnotherTest
771751258e Shell: Give the TTY to the foreground process
This fixes the bug with the shell not waiting for any foreground process
that attempts to read from the terminal in the Lagom build.
2020-08-04 21:22:44 +02:00
Andreas Kling
984683cf34 Revert "LibM: Always include <math.h> instead of <LibM/math.h>"
This reverts commit dc12cbca41.

Sadly this broke the build due to some confusion about <new>.
Reverting until this can be solved fully.
2020-08-04 21:17:43 +02:00
Andreas Kling
000ef0ec3d Revert "AK: Let the compiler provide the default new and delete operators"
This reverts commit 45b05e9734.

I forgot about the Toolchain build again. :^(
2020-08-04 21:16:07 +02:00
Andreas Kling
90dcab381a SystemMonitor: Replace custom ProcessTableView with just GUI::TableView
This class was added in the very early days of LibGUI, when I wasn't
quite sure if subclassing table views made sense or not.
2020-08-04 21:03:53 +02:00
Andreas Kling
dc12cbca41 LibM: Always include <math.h> instead of <LibM/math.h>
This makes Lagom pick up the host math.h, which is what we want.
2020-08-04 19:06:27 +02:00
Andreas Kling
45b05e9734 AK: Let the compiler provide the default new and delete operators
...except in kernelspace.
2020-08-04 19:05:48 +02:00
Andreas Kling
3cb8ae873c Shell: Use NonnullRefPtr to simplify some things in the parser/AST 2020-08-04 18:17:16 +02:00
Andreas Kling
7a3ab6c517 Kernel: Make File::write() and File::read() return KResultOr<size_t>
Instead of returning a ssize_t where negative values mean error,
we now return KResultOr<size_t> and use the error state to report
errors exclusively.
2020-08-04 18:17:16 +02:00
Andreas Kling
58feebeed2 Kernel+LibC: Tidy up sys$ttyname() and sys$ptsname()
- Remove goofy _r suffix from syscall names.
- Don't take a signed buffer size.
- Use Userspace<T>.
- Make TTY::tty_name() return a String instead of a StringView.
2020-08-04 18:17:16 +02:00
Andreas Kling
cb1fcd3eaf LaunchServer: Disown child processes after spawning 2020-08-04 18:17:16 +02:00
Andreas Kling
8cf818e7c7 ResourceGraph.MenuApplet: Disown child processes after spawning 2020-08-04 18:17:16 +02:00
Andreas Kling
9e81b93ab9 Clock.MenuApplet: Disown child process after spawning 2020-08-04 18:17:16 +02:00
Andreas Kling
6e1cb2bae8 SystemMenu: Disown child processes after spawning 2020-08-04 18:17:16 +02:00
Andreas Kling
cf624550e5 Terminal: Disown child processes after spawning 2020-08-04 18:17:16 +02:00