Commit Graph

23335 Commits

Author SHA1 Message Date
Andreas Kling
fd155193e7 LibThreading: Use a condvar to signal the BackgroundAction thread
Now that pthread_cond_t works correctly thanks to Sergey, we can use
them to wake up the BackgroundAction worker thread instead of making
a Unix pipe. :^)
2021-07-07 18:02:43 +02:00
Aziz Berkay Yesilyurt
5fbb1d9e01 Userland: Convert delay option to unsigned for shot
A negative delay option for shot was used to underflow when passed to
sleep. Now, it returns an error for a negative delay value.
2021-07-07 20:05:43 +04:30
Aziz Berkay Yesilyurt
7db3e962f3 LibCore: Add unsigned option to ArgsParser
Unsigned options are used to return underflowed values for negative
inputs. With this change, we can verify that unsigned options only
accept unsigned inputs as arguments.
2021-07-07 20:05:43 +04:30
Peter Elliott
9b40208e3b Documentation: Add less(1) man page, and link to it in others 2021-07-07 20:01:15 +04:30
Peter Elliott
a11658737a Userland: Less: emulate cat when stdout is not a tty
This is the most logical behavior when less is used in a pipe.
2021-07-07 20:01:15 +04:30
Peter Elliott
1ec061d666 Userland: Add pager option to man and use less by default 2021-07-07 20:01:15 +04:30
Peter Elliott
c6fa2f196a Userland: Add more(1) emulation to less(1)
This patch also removes the existing implementation of more, as it is
now redundant.
2021-07-07 20:01:15 +04:30
Peter Elliott
30aa9b837c Userland: Add minimal prompt support to less
GNU less has a pretty cool prompt format language. This patch adds
support for the language and specifiers for filename, linenumber, and
ending.
2021-07-07 20:01:15 +04:30
Peter Elliott
7ee1983db6 Userland: Add less, a better terminal pager
less is a re-implementation of gnu less, a terminal pager with backwards
scrolling and alternate screen support.
2021-07-07 20:01:15 +04:30
Sergey Bugaev
e8d5b16733 test-pthread: Add a mutex test 2021-07-07 17:08:40 +02:00
Sergey Bugaev
65b0642dd0 LibC+LibPthread: Use FUTEX_PRIVATE_FLAG in more places
Performance go brrrrr
2021-07-07 17:08:40 +02:00
networkException
39a3f42534 GameOfLife: Properly switch between play and pause icon
The play and pause icon were previously set on the toggle Action
and not on the Button of the Action that is part of the Toolbar
2021-07-07 15:29:37 +01:00
Yuval Tasher
b08383c48d Assistant: Compare two chars instead of StringViews of length 1 2021-07-07 15:58:57 +02:00
Andres Crucitti
f6f14777ac WindowServer: Allow windows to be pinnable (always on top)
This patch adds the concept of a window being "Pinnable" (always drawn
on top of other windows). This can be toggled through a new checkable
action in the top left corner's window menu.
2021-07-07 15:38:59 +02:00
Max Wipfli
d5722eab36 Kernel: Custody::absolute_path() => try_create_absolute_path()
This converts most users of Custody::absolute_path() to use the new
try_create_absolute_path() API, and return ENOMEM if the KString
allocation fails.
2021-07-07 15:32:17 +02:00
Max Wipfli
0f8a6e574c Kernel: Add formatter function for OwnPtr<KString>
This adds a formatter function for OwnPtr<KString>. This is added mainly
because lots of dbgln() statements generate Strings (such as absolute
paths) which are only used for debugging. Instead of catching possible
OOM situations at all the dbgln() callsites, this makes it possible to
let the formatter code handle those situations by outputting "[out of
memory]" if the OwnPtr is null.
2021-07-07 15:32:17 +02:00
Max Wipfli
95f769ea51 Kernel: Add Custody::try_create_absolute_path()
This adds a way to get a Custody's absolute path as KString, which
enables it to fail gracefully on OOM.
2021-07-07 15:32:17 +02:00
Max Wipfli
1f792faf34 Kernel: Add KLexicalPath::try_join and use it
This adds KLexicalPath::try_join(). As this cannot be done without
allocation, it uses KString and can fail. This patch also uses it at one
place. All the other cases of String::formatted("{}/{}", ...) currently
rely on the return value being a String, which means they cannot easily
be converted to use the new API.
2021-07-07 15:32:17 +02:00
Max Wipfli
ee342f5ec3 Kernel: Replace usage of LexicalPath with KLexicalPath
This replaces all uses of LexicalPath in the Kernel with the functions
from KLexicalPath. This also allows the Kernel to stop including
AK::LexicalPath.
2021-07-07 15:32:17 +02:00
Max Wipfli
87a62f4def Kernel: Add KLexicalPath
This adds KLexicalPath, which are a few static functions which aim to
mostly emulate AK::LexicalPath. They are however constrained to work
with absolute paths only, containing no '.' or '..' path segments and no
consecutive slashes. This way, it is possible to avoid use StringView
for the return values and thus avoid allocating new String objects.

As explained above, the functions are currently very strict about the
allowed input paths. This seems to not be a problem currently. Since the
functions VERIFY this, potential bugs caused by this will become
immediately obvious.
2021-07-07 15:32:17 +02:00
Gunnar Beutner
75ba74a216 Tests: Build all tests on x86_64
This builds some previously-disabled tests for x86_64.
2021-07-07 15:29:18 +02:00
networkException
3fce0e58e5 LibGUI: Use east const style in InputBox.{cpp,h} 2021-07-07 15:29:03 +02:00
networkException
2483a78313 Browser: Show an example url placeholder in the search engine InputBox
This makes it more clear what the format for a search engine url is :^)
2021-07-07 15:29:03 +02:00
networkException
72776b2f61 LibGUI: Allow InputBox to show placeholder
If passed as an argument, showing an InputBox now supports to
set a placeholder text which will be shown in its TextBox.
2021-07-07 15:29:03 +02:00
networkException
f8798c154b LibGUI: Draw the placeholder of a TextEditor also when it is focused
Previously focusing a TextEditor would cause the placeholder to
disapper. This is unpractical editors that get focused automatically
for example.
2021-07-07 15:29:03 +02:00
Max Wipfli
4f29d285dd Kernel: Stop building ctype.cpp into the Kernel
Since AK no longer includes ctype.h, we don't have to build ctype.cpp in
the Kernel anymore.
2021-07-07 14:05:56 +02:00
Max Wipfli
f0fcbb7751 AK: Replace usages of ctype.h with CharacterTypes.h
This replaces all remaining usages of ctype.h in AK with
CharacterTypes.h.
2021-07-07 14:05:56 +02:00
Andreas Kling
8975caca45 PixelPaint: Make SprayTool only invalidate the modified area :^) 2021-07-07 13:01:20 +02:00
Andreas Kling
e28b22c316 PixelPaint: Make BrushTool only invalidate the modified area :^) 2021-07-07 13:01:20 +02:00
Andreas Kling
f33edd33cc LibGfx: Small improvements to fill_rect_with_checkerboard()
- Clamp the checkerboard scanline prologue length to the total width
  of the (clipped) rect we're filling.

- Use fast_u32_fill() for the prologue and epilogue as well.
2021-07-07 13:01:20 +02:00
Andreas Kling
7cbcf5a5fa PixelPaint: Make PenTool only invalidate the modified area :^) 2021-07-07 13:01:20 +02:00
Andreas Kling
f7053059c9 PixelPaint: Allow partial invalidation of Layer and Image
Let's give ourselves the tools needed to update less than the entire
image every time we paint.

This patch adds plumbing so that Layer invalidations have a modified
rect that gets passed on to Image, and then on to ImageEditor.
2021-07-07 13:01:20 +02:00
Andreas Kling
b7e551b164 LibGUI: Make Widget ignore paint events that don't intersect it
LibGUI widgets fully contain their child widgets, so there's no pass
the paint event on to our children if we get a paint event that doesn't
intersect with our rect.

While Gfx::Painter was already dutifully clipping out any attempts at
painting, this avoids even more pointless work.
2021-07-07 13:01:20 +02:00
Gunnar Beutner
13a14b3112 LibELF: Fix loading libs with a .text segment that's not page-aligned
It's perfectly acceptable for the segment's vaddr to not be page aligned
as long as the segment itself is page-aligned. We'll just map a few more
bytes at the start of the segment that will be unused by the library.

We didn't notice this problem because because GCC either always uses
0 for the .text segment's vaddr or at least aligns the vaddr to the
page size.

LibELF would also fail to load really small libraries (i.e. smaller than
4096 bytes).
2021-07-07 11:53:17 +02:00
Gunnar Beutner
4591c00328 DynamicLoader: Don't use LibELF to do the initial relocations
Using LibELF to do the initial relocations doesn't work when building
SerenityOS with Clang. We seem to be accessing a global symbol that
hasn't been relocated yet somewhere along the path to
ELF::DynamicObject::create().
2021-07-07 11:53:17 +02:00
Idan Horowitz
c351b4ad0d LibJS: Stop using a native property for Array lengths
Specifically, replace it with a specification-based implementation that
overrides the internal methods that interact with the length property
instead.
2021-07-07 10:14:44 +01:00
Idan Horowitz
fff112c8a3 LibJS: Add missing spec link to ValidateAndApplyPropertyDescriptor 2021-07-07 10:14:44 +01:00
Edwin Hoksberg
99328e1038 Kernel+KeyboardSettings: Remove numlock syscall and implement ioctl 2021-07-07 10:44:20 +02:00
Edwin Hoksberg
385e2ccb66 Kernel: Add keyboard ioctl to get num/caps lock state 2021-07-07 10:44:20 +02:00
Tom
864b50b5c2 Kernel: Do not hold spinlock while touching user mode futex values
The user_atomic_* functions are subject to the same rules as
copy_from/to/user, which may require preemption.
2021-07-07 10:05:55 +02:00
Tom
7593418b77 Kernel: Fix futex race that could lead to thread waiting forever
There is a race condition where we would remove a FutexQueue from
our futex map and in the meanwhile another thread started to queue
itself into that very same futex, leading to that thread to wait
forever as no other wake operation could discover that removed
FutexQueue.

This fixes the problem by:
* Tracking imminent waits, which prevents a new FutexQueue from being
  deleted that a thread will wait on momentarily
* Atomically marking a FutexQueue as removed, which prevents a thread
  from waiting on it before it is actually removed from the futex map.
2021-07-07 10:05:55 +02:00
Idan Horowitz
dd27490ee1 LibJS: Throw if the trap result of OwnPropertyKeys contains duplicates 2021-07-07 01:38:10 +01:00
Idan Horowitz
d577678658 LibJS: Add a name property to the proxy revoker anonymous function
As per the specification this should an empty string.
2021-07-07 01:38:10 +01:00
Linus Groh
5319694510 js: Implement pretty-printing of Temporal.TimeZone objects 2021-07-07 00:42:01 +01:00
Linus Groh
6cd16eceb3 LibJS: Implement Temporal.now.timeZone() 2021-07-07 00:42:01 +01:00
Linus Groh
265e89367e LibJS: Start implementing Temporal.TimeZone
Here we got our first Temporal object :^)
This patch adds the TimeZone object itself, its constructor and
prototype (currently empty), and a bunch of required abstract operations
2021-07-07 00:42:01 +01:00
Linus Groh
6735353b96 LibJS: Add preparation for Temporal constructors and prototypes
Add a JS_ENUMERATE_TEMPORAL_OBJECTS macro and use it to generate:

- Forward declarations
- CommonPropertyNames class name members
- Constructor and prototype GlobalObject members, getters, visitors,
  and initialize_constructor() calls
2021-07-07 00:42:01 +01:00
Linus Groh
7da1fcb2ef LibJS: Add the Temporal.now namespace object
This will be home to various functions:

- Temporal.now.timeZone()
- Temporal.now.instant()
- Temporal.now.plainDateTime()
- Temporal.now.plainDateTimeISO()
- Temporal.now.zonedDateTime()
- Temporal.now.zonedDateTimeISO()
- Temporal.now.plainDate()
- Temporal.now.plainDateISO()
- Temporal.now.plainTimeISO()
2021-07-07 00:42:01 +01:00
Linus Groh
8269921212 LibJS: Add the Temporal namespace object :^)
Currently empty, but we gotta start somewhere! This is the start of
implementing the Temporal proposal (currently stage 3).

I have decided to start a new subdirectory (Runtime/Temporal/) as well
as a new C++ namespace (JS::Temporal) for this so we don't have to
prefix all the files and classes with "Temporal" - there will be a lot.

https://tc39.es/proposal-temporal/
2021-07-07 00:42:01 +01:00
ngc6302h
a39ec19cd7 Kernel: Fix kernel crash when remote peer resets unexpectedly 2021-07-07 01:18:25 +02:00