Commit Graph

13158 Commits

Author SHA1 Message Date
Tom
03f45febe2 Kernel: Fix KResultOr move semantics
We need to track whether we actually own the storage.
2020-09-19 00:30:08 +02:00
AnotherTest
4c2f86c24f Shell: Do not strip glob base path when it was explicitly requested
Fixes #3544.
2020-09-19 00:24:16 +02:00
Andreas Kling
eb24603da0 FileManager: Properly reveal newly opened directories in the treeview
Use the new TreeView::expand_all_parent_of() API to ensure that newly
opened directories are revealed and scrolled-into-view in the left-side
treeview. :^)
2020-09-18 21:29:01 +02:00
Andreas Kling
3bccd99fe9 LibGUI: Add TreeView::expand_all_parents_of(ModelIndex)
This does exactly what it sounds like. :^)
2020-09-18 21:29:01 +02:00
Andreas Kling
76ae47c6ed LibGUI: Unbreak FileSystemModel::index(path) after virtual root changes
Now that the "/" directory can have a (virtual) parent index, we need
to account for that when converting a full path to a model index.
2020-09-18 21:29:01 +02:00
Andreas Kling
56328409d9 FileManager: Update GUI when "entering" an inaccessible directory
When we enter an inaccessible directory, we still allow that directory
to become selected in the left-side treeview, so we need to update the
location box and window title to reflect the new current path.

This is not perfectly factored and there's a bit of duplication between
the model's on_error and on_complete hook callbacks in DirectoryView.
Needs more work. :^)
2020-09-18 21:29:01 +02:00
Andreas Kling
e4c23b0151 iLibGUI+Base: Show inaccessible directories with special icon in views 2020-09-18 21:29:01 +02:00
Andreas Kling
fad6b8f267 LibGUI: FileSystemModel should provide full paths to FileIconProvider
This will allow FileIconProvider to check additional things about
the specified path. (We previously only had access to the basename.)
2020-09-18 21:29:01 +02:00
Andreas Kling
8075db683b FileManager: Show an inline error message for inaccessible directories
Instead of popping up a message box whenever we can't read an opened
directory, show the error message inside the DirectoryView (as a label)
instead.

This fixes a visual inconsistency where an inaccessible directory would
be selected in the left-side treeview while the previous directory's
contents were still showing on the right.

This also makes keyboard navigation a bit more pleasant since you're
not suddenly interrupted by a message box.
2020-09-18 21:29:01 +02:00
Andreas Kling
9b89303767 LibGUI: StackWidget should not steal focus when switching active child
Only focus the new active child if the old one had focus previously.
2020-09-18 21:29:01 +02:00
Andreas Kling
65b246aaf4 FileManager: Remove an unused enum in DirectoryView 2020-09-18 21:29:01 +02:00
Linus Groh
a9f5b0339d LibJS: Simplify toEval() implementation 2020-09-18 20:49:35 +02:00
Linus Groh
5fd87ccd16 LibJS: Add FIXMEs for parsing increment operators with function LHS/RHS
The parser considers it a syntax error at the moment, other engines
throw a ReferenceError during runtime for ++foo(), --foo(), foo()++ and
foo()--, so I assume the spec defines this.
2020-09-18 20:49:35 +02:00
Linus Groh
fd32f00839 LibJS: Mark more ASTNode classes as final 2020-09-18 20:49:35 +02:00
Itamar
b82a254da0 HackStudio: Only refresh Git widget on save if initialized 2020-09-18 15:20:55 +02:00
Peter Elliott
e46b4e0865 Minesweeper: Fix inverted Single-Click Chording setting
This was introduced by 705cee528a,
where the '!' was copied from the previous implementation, but the
behavior was not
2020-09-18 09:42:26 +02:00
Andreas Kling
07d4b41bac FileManager: Move DirectoryView into the FileManager namespace 2020-09-17 17:23:37 +02:00
Nico Weber
8212ba467c ntpquery: Use SO_TIMESTAMP to get a more accurate destination_timestamp
We can now see at which time a packet was received by the network
adapter, instead of having to measure user time after receiving
the packet in user space.

This means the destination timestamp is no longer affected by in-kernel
queuing delays, which can be tens of milliseconds when the system
is under load.

It also means that if ntpquery grows a message queue that waits on
replies from several requests, the time used processing one response
won't be incorrectly included in the destination timestamp of the
next response (in case two responses arrive at the network adapter
at roughly the same time).

NTP's calculations work better if send and receive latency are
about equal, and this only removes in-kernel queue delays and
context switch delays for the receiving packet. But the two
latencies aren't very equal anyways because $network. Also, maybe
we can add another API for setting the send time in the outgoing
packet in kernel space right before (or when) hitting the network
adapter and use that here too. So this still seems like progress.
2020-09-17 17:23:01 +02:00
Nico Weber
47b3e98af8 Kernel+LibC+UserspaceEmulator: Add SO_TIMESTAMP, and cmsg definitions
When SO_TIMESTAMP is set as an option on a SOCK_DGRAM socket, then
recvmsg() will return a SCM_TIMESTAMP control message that
contains a struct timeval with the system time that was current
when the socket was received.
2020-09-17 17:23:01 +02:00
Nico Weber
ae5ba4074d LibC: Convert SO_ constants to enum
I want to add another entry to this list and don't want to
have to think of a number for it.
2020-09-17 17:23:01 +02:00
Nico Weber
416d470d07 Kernel: Plumb packet receive timestamp from NetworkAdapter to Socket::recvfrom
Since the receiving socket isn't yet known at packet receive time,
keep timestamps for all packets.

This is useful for keeping statistics about in-kernel queue latencies
in the future, and it can be used to implement SO_TIMESTAMP.
2020-09-17 17:23:01 +02:00
Nico Weber
b36a2d6686 Kernel+LibC+UserspaceEmulator: Mostly add recvmsg(), sendmsg()
The implementation only supports a single iovec for now.
Some might say having more than one iovec is the main point of
recvmsg() and sendmsg(), but I'm interested in the control message
bits.
2020-09-17 17:23:01 +02:00
Uma Sankar
19f2203b53
LibGUI: Set ProcessChooser key column and sort order after set_model (#3521)
Need to set the sort order after model was set to sort the table.
2020-09-17 16:17:14 +02:00
Uma Sankar
d7673b41ef
LibGUI: Respect the previously selected sort order in HeaderView (#3522)
Instead of forcefully setting the sort order to Ascending upon column
sort, setting it to the previously selected sort order
2020-09-17 16:15:35 +02:00
Andreas Kling
219c0fbea9 Kernel: Unbreak sys$pledge()
We were dropping all the incoming pledge promise strings and parsing
"" instead.

Fixes #3519.
2020-09-17 15:07:20 +02:00
Andreas Kling
8055f7a1f5 FileManager: Move the DesktopWidget to its own compilation unit 2020-09-17 14:34:47 +02:00
Andreas Kling
4e8c50d92d FileManager: Handle drop events in DirectoryView
This makes it possible to drag & drop files to/from the desktop! :^)
2020-09-17 14:30:00 +02:00
Tom
5ee29e8a26 LibIPC: Check if socket is still open before using socket descriptor
Writing to the socket may trigger a close of the socket descriptor
if a disconnect was detected. We need to check if it is still valid
when waiting for a response after attempting to send a synchronous
message.

Fixes #3515
2020-09-17 09:47:29 +02:00
Peter Elliott
1720030625 LibGUI: Don't recalcuate color from hue if it was not set by hue
Basically, setting the hue is numerically sensitive when the value or
saturation are low.
2020-09-17 09:47:05 +02:00
Peter Elliott
9670d9ad50 LibGUI: Don't allow 4 character html color codes in GUI::ColorPicker
When 4 character colors were allowed, backspace misbehaved and you
couldn't backspace the whole color.
2020-09-17 09:47:05 +02:00
Andreas Kling
d89cad7c57 LibGUI: Use FileIconProvider in the FilePicker dialog 2020-09-16 21:08:55 +02:00
Andreas Kling
e1e58d5bc9 FileManager: Use GUI::FileIconProvider for the location box icon 2020-09-16 21:08:55 +02:00
Andreas Kling
31b65145b6 LibGUI+Base: Add a hard-disk icon and use it for the path "/" 2020-09-16 21:08:55 +02:00
Andreas Kling
17ae1c37bb FileManager: Show the root (/) directory in the treeview on the left
This gives you something to click on if you actually want to open
the root directory. Previously, if you wanted to get to /, you had to
use the "to parent directory" repeatedly. Silly. :^)
2020-09-16 21:08:55 +02:00
Andreas Kling
4d2782db5a LibGUI: Allow FileSystemModel to be rooted one level above "/"
You can now construct a FileSystemModel with a null String() as the
root path. This will root it one level above "/" which makes the
root directory itself selectable as a child.

This will be useful in some places, e.g the FileManager application.
2020-09-16 21:08:55 +02:00
asynts
a9f7b576a4 LibCore: Add missing .characters() for String::format. 2020-09-16 20:52:30 +02:00
Luke
68b361bd21 Kernel: Return ENOMEM in more places
There are plenty of places in the kernel that aren't
checking if they actually got their allocation.

This fixes some of them, but definitely not all.

Fixes #3390
Fixes #3391

Also, let's make find_one_free_page() return nullptr
if it doesn't get a free index. This stops the kernel
crashing when out of memory and allows memory purging
to take place again.

Fixes #3487
2020-09-16 20:38:19 +02:00
asynts
2229b13c97 Userland: Allow executing binaries from PATH with env.
This is useful for shebangs:

    #!/bin/env Shell
    echo "Hello, World!"
2020-09-16 19:39:17 +02:00
asynts
f1b1a78f26 Userland: Use find_executable_in_path in UserspaceEmulator. 2020-09-16 19:39:17 +02:00
asynts
c577f6e139 Userland: Use find_executable_in_path in which. 2020-09-16 19:39:17 +02:00
asynts
3283f5bb5d LibCore: Add find_executable_in_path. 2020-09-16 19:39:17 +02:00
Tom
d55e3c4642 LibIPC: Disable Notifier before closing socket
Because we're closing a file descriptor, we need to disable any
Notifier that is using it so that the EventLoop does not use invalid
file descriptors.

Fixes #3508
2020-09-16 17:50:43 +02:00
Tom
d67553e128 LibCore: Add Notifier::close
If a file descriptor is being closed, we need to permanently disable
any Notifier and remove it from the event loop. This method removes
the notifier and disables it so that the EventLoop does not use a
invalid file descriptor.
2020-09-16 17:50:43 +02:00
asynts
0579a2db34 Kernel: Fix kernel crash in get_dir_entries when buffer too small.
Before e06362de9487806df92cf2360a42d3eed905b6bf this was a sneaky buffer
overflow. BufferStream did not do range checking and continued to write
past the allocated buffer (the size of which was controlled by the
user.)

The issue surfaced after my changes because OutputMemoryStream does
range checking.

Not sure how exploitable that bug was, directory entries are somewhat
controllable by the user but the buffer was on the heap, so exploiting
that should be tough.
2020-09-16 17:10:04 +02:00
Andreas Kling
f69281573e LibGUI: Double-clicking on a TreeView item should set cursor
Don't just set the selection, set the cursor.
2020-09-16 16:37:28 +02:00
Andreas Kling
95b6c98435 LibGUI: Fix TreeView scrolling to top when clicking sub-items
This code was confusing two different versions of scroll_into_view that
were getting mixed up due to member function shadowing.

Adding an "override" to the subclass declaration exposed the problem.

With this fixed, we no longer lose our scroll position wildly when
using the mouse to select TreeView items.
2020-09-16 16:37:28 +02:00
Andreas Kling
d1445cee6d Kernel: Handle Thread::State::Dead in sys$waitid()
I'm not sure how it happened, but it looks like I caught a thread in
this state so let's just handle it the same way we do Dying.
2020-09-16 16:37:28 +02:00
Tom
6212f57755 WindowServer: Make SetWindowTaskbarRect tolerant to non-existing windows
There is a window between windows disappearing (e.g. closing or crashes)
and the Taskbar process being notified. So it is entirely possible that
it may call SetWindowTaskbarRect() for a window and/or client id that no
longer exists. As the Taskbar process does not own these windows, this
should not be treated as a misbehaving application request. Instead, just
silently ignore the request. The Taskbar will be notified shortly after
that the window no longer exist and remove it from its list.

Fixes #3494
2020-09-16 15:57:12 +02:00
AnotherTest
961661ea1d Build: Preserve hard/symbolic links when building root fs
This fixes the issue where there would not be enough space to copy
things when at least the git port and the gcc port are installed.
2020-09-16 15:56:35 +02:00
Tom
e31f8b56e8 Kernel: Fix thread donation hanging the system
Fixes two flaws in the thread donation logic: Scheduler::donate_to
would never really donate, but just trigger a deferred yield. And
that deferred yield never actually donated to the beneficiary.

So, when we can't immediately donate, we need to save the beneficiary
and use this information as soon as we can perform the deferred
context switch.

Fixes #3495
2020-09-15 23:30:44 +02:00