Commit Graph

4037 Commits

Author SHA1 Message Date
Conrad Pankoff
302d521485 Kernel: Take a copy of MACAddress in RoutingDecision 2019-08-29 06:25:06 +02:00
Conrad Pankoff
498f8c01a2 Kernel: Use a public member for NetworkAdapter on_receive 2019-08-29 06:25:06 +02:00
Conrad Pankoff
6d1418aa7a Kernel: Add simple ARP routing layer
This replaces the previous placeholder routing layer with a real one!
It's still very primitive, doesn't deal with things like timeouts very
well, and will probably need several more iterations to support more
normal networking things.

I haven't confirmed that this works with anything other than the QEMU
user networking layer, but I suspect that's what nearly everybody is
using at this point, so that's the important target to keep working.
2019-08-29 06:25:06 +02:00
Conrad Pankoff
626e176cab Kernel: Remove IP configuration from LoopbackAdapter
This is configured in NetworkTask_main now, so there's no need to do it
here as well.
2019-08-29 06:25:06 +02:00
Conrad Pankoff
13abb3e88b Kernel: Remove now-unused singleton methods from our network devices 2019-08-29 06:25:06 +02:00
Conrad Pankoff
93c16590f1 Kernel: Remove specific devices from network code
By setting up the devices in init() and looping over the registered
network adapters in NetworkTask_main, we can remove the remaining
hard-coded adapter references from the network code.

This also assigns IPs according to the default range supplied by QEMU
in its slirp networking mode.
2019-08-29 06:25:06 +02:00
Conrad Pankoff
41e9ad5ea0 Kernel: Add const to packet data in send_raw call 2019-08-29 06:25:06 +02:00
Conrad Pankoff
36d349f7a7 Kernel: Add on_receive callback to NetworkAdapter 2019-08-29 06:25:06 +02:00
Conrad Pankoff
682fe48222 Kernel: Show netmask/gateway in ProcFS when available 2019-08-29 06:25:06 +02:00
Conrad Pankoff
1aa7437ad7 Kernel: Add netmask and gateway to NetworkAdapter 2019-08-29 06:25:06 +02:00
Conrad Pankoff
61bdf09d78 Kernel: Run NetworkTask in init stage 2 to allow use of locks 2019-08-29 06:25:06 +02:00
Conrad Pankoff
bed069bd14 Kernel: Ask for all relevant IRQs in rtl8139 driver 2019-08-29 06:25:06 +02:00
Conrad Pankoff
5f86a979ea Kernel: Ignore IPv6 packets; log unknown Ethernet payload types 2019-08-29 06:25:06 +02:00
Conrad Pankoff
4a4e66b2d0 Kernel/AK: Add is_zero helpers for IP and MAC addresses 2019-08-29 06:25:06 +02:00
Conrad Pankoff
fac1148679 Kernel: Always format MACAddress with two-byte hex digits in to_string 2019-08-29 06:25:06 +02:00
Conrad Pankoff
eb01735ec5 Kernel: Add list-compatible constructor for MACAddress 2019-08-29 06:25:06 +02:00
Brandon Scott
23e8715022 Userland: Add 'which' command (#497)
This mimics the shell's path resolution to locate the executable that
would execute if typing it as a command.
2019-08-29 06:23:22 +02:00
Andreas Kling
50ef2216fa GTextEditor: Optimize write_to_file() with ftruncate()
Compute the final file size and ftruncate() the destination file to the
right size immediately instead of incrementally appending to it.

This kind of optimization belongs in the kernel, but until we have it
there, this makes saving text files a whole lot faster. :^)
2019-08-28 19:32:45 +02:00
Sergey Bugaev
5d3696174b AK: Add a Utf8View type for iterating over UTF-8 codepoints
Utf8View wraps a StringView and implements begin() and end() that
return a Utf8CodepointIterator, which parses UTF-8-encoded Unicode
codepoints and returns them as 32-bit integers.

This is the first step towards supporting emojis in Serenity ^)
https://github.com/SerenityOS/serenity/issues/490
2019-08-28 13:46:02 +02:00
Conrad Pankoff
970e0147f7 AK: Make printf %x actually work properly
When printing hex numbers, we were printing the wrong thing sometimes. This
was because we were dividing the digit to print by 15 instead of 16. Also,
dividing by 16 is the same as shifting four bits to the right, which is a
bit closer to our actual intention in this case, so let's use a shift
instead.
2019-08-28 06:43:04 +02:00
Andreas Kling
b1763238d7 TextEditor: Ask the user before closing a dirty (modified) document
It's a little unfortunate that we have two separate code paths that can
lead to asking the user about this. Longer-term we should find a way to
unify these things.

Fixes #491.
2019-08-27 20:39:01 +02:00
Andreas Kling
c4b1456c88 GWindow: Allow clients to prevent close requests from closing
This is done by hooking the new on_close_request callback and returning
GWindow::CloseRequestDecision::StayOpen (instead of ...::Close.)
2019-08-27 20:35:37 +02:00
Andreas Kling
ecbedda34c TextEditor: Add a "document dirty" flag and show it in the window title
This lets you know if the document has been modified since last save.
2019-08-27 20:18:19 +02:00
Andreas Kling
fcf85d8fef GTextEditor: Always call did_change() after deleting with backspace
This is needed for the on_change callback to fire.
2019-08-27 20:16:52 +02:00
Andreas Kling
07933d0b46 TextEditor: Let's enable line wrapping by default 2019-08-27 17:05:01 +02:00
Andreas Kling
b6de723eb3 TextEditor: Move line wrapping setting to a new "View" menu 2019-08-27 17:01:52 +02:00
Sergey Bugaev
8ea25ca3b0 ProcFS: Port JSON generation to streaming serializers
This way we don't allocate giant JSON objects on the kernel heap first.
Hopefully fixes https://github.com/SerenityOS/serenity/issues/484
2019-08-27 14:56:09 +02:00
Sergey Bugaev
216b7b3b80 JSON: Port JsonArray and JsonObject serialization to serializers
This way, primitive JsonValue serialization is still handled by
JsonValue::serialize(), but JsonArray and JsonObject serialization
always goes through serializer classes. This is no less efficient
if you have the whole JSON in memory already.
2019-08-27 14:56:09 +02:00
Sergey Bugaev
56f5c14d86 JSON: Add JSON serializers
These are two new types that allow serializing JSON on-the-fly
as it's generated, without building the whole JSON in memory
first.
2019-08-27 14:56:09 +02:00
Andreas Kling
4ec698d1b0 WindowServer: Fix off-by-one in menu height calculation
This removes the unecessary empty scanline at the bottom of menus and
makes it look nice and tidy when the bottom item is highlighted. :^)
2019-08-27 13:51:09 +02:00
Andreas Kling
a3788f1297 Minesweeper: Reorganize menus a bit
Move some of the "Game" menu into the app menu, and add a separate menu
for the difficulty setting.
2019-08-27 13:51:04 +02:00
Andreas Kling
227bfd79d3 Snake: Merge "Game" menu into the app menu 2019-08-27 13:25:08 +02:00
Andreas Kling
9a80554943 WindowServer: Reverse the menu background colors
Let's try putting the warm gray under the icons/checkboxes. This makes
the checkboxes look more natural.
2019-08-27 13:24:05 +02:00
Andreas Kling
d3c21163a5 WindowServer: Don't highlight disabled menu items when hovered 2019-08-27 10:20:10 +02:00
Andrew Weller
ed0553fe10 GTextEditor: Fixed bug on KeyCode::Key_Right pressed.
Pressing right did nothing when the very last characters of the buffer
were selected.

The expected action would be for the cursor to move to the end of the
buffer.

This patch fixes that.
2019-08-27 07:17:22 +02:00
Andrew Weller
b50ffaf7e1 GTextEditor: Fixed bug in find_prev
Find_prev returned invalid when the contents of the file were equal to
the contents of the search box.

This is due to the checker walking on an empty character at the end of
a line.
2019-08-27 07:17:22 +02:00
Andreas Kling
2147b587b2 WindowServer: Improve look of disabled menu items somewhat 2019-08-27 06:57:14 +02:00
Andreas Kling
161c862f21 WindowServer: Add an icon for the system menu / About action
It's a little ladybug. Maybe someday we'll have a fancy icon, but until
then, this ladybug character is a cute placeholder. :^)
2019-08-27 06:53:23 +02:00
Andreas Kling
b0b94560c3 FileManager: Add "go home" action to the "Go" menu 2019-08-26 21:20:39 +02:00
Andreas Kling
1077c15917 WindowServer: Add some app icons to the system menu 2019-08-26 21:15:35 +02:00
Andreas Kling
c0d81bea06 WindowServer: Make the global menubar selection consistent with items 2019-08-26 21:14:50 +02:00
Andreas Kling
0f48e3b007 WindowServer: Align menu separators correctly
These were off by one vertically, oops!
2019-08-26 20:53:33 +02:00
Andreas Kling
11bb88f513 WindowServer: Improve the menu look a bit
Take some inspiration from the first release of Visual Studio .NET and
add a left-hand stripe to contain the icons. And various other tweaks.
This isn't quite perfect, but it's pretty neat! :^)
2019-08-26 20:46:19 +02:00
Andreas Kling
08d7c86e90 FileManager: Move "File" menu entries to the app menu 2019-08-26 19:18:54 +02:00
Andreas Kling
1e604b7984 WindowServer+LibGUI: Show action icons in the menus when possible
Any GAction that has an icon assigned will now show up with that icon
when added to a menu as well.

I made the menu items 2px taller to accomodate the icons. I think this
turned out quite nice as well :^)
2019-08-26 18:54:44 +02:00
Andreas Kling
d522a6fe4c WindowServer: Improved look of checkable menu items
Paint a little checkbox frame for checkable items to make it obvious
that they are indeed checkable. This looks quite nice :^)

We also now shift all menu items to the right if we have any checkable
items in the menu.
2019-08-26 18:10:07 +02:00
Andreas Kling
cef2c04952 TextEditor: Move all "File" menu entries into the app menu instead
It felt weird to have both the app menu *and* a "File" menu.
2019-08-26 17:59:05 +02:00
Andreas Kling
dde10f534f Revert "Kernel: Avoid a memcpy() of the whole block when paging in from inode"
This reverts commit 11896d0e26.

This caused a race where other processes using the same InodeVMObject
could end up accessing the newly-mapped physical page before we've
actually filled it with bytes from disk.

It would be nice to avoid these copies without breaking anything.
2019-08-26 13:50:55 +02:00
Andreas Kling
f5d779f47e Kernel: Never forcibly page in entire executables
We were doing this for the initial kernel-spawned userspace process(es)
to work around instability in the page fault handler. Now that the page
fault handler is more robust, we can stop worrying about this.

Specifically, the page fault handler was previous not able to handle
getting a page fault in anything but the currently executing task's
page directory.
2019-08-26 13:20:01 +02:00
Andreas Kling
e29fd3cd20 Kernel: Display virtual addresses as V%p instead of L%x
The L was a leftover from when these were called linear addresses.
2019-08-26 11:31:58 +02:00