Commit Graph

3712 Commits

Author SHA1 Message Date
Andreas Kling
ee83b1bcf4 LibCore: Use URL in CHttpRequest
Now there's just CHttpRequest::set_url(URL), no need to specify the
host, port and path manually anymore.

Updated ChanViewer and Downloader for the API change.
2019-08-10 19:32:03 +02:00
Andreas Kling
fb636389d6 URL: Add some convenience constructors 2019-08-10 19:31:37 +02:00
Andreas Kling
ed43770b2f AK: Add a basic URL class to help us handle URL's
We're gonna need these as we start to write more networking programs.
2019-08-10 17:30:35 +02:00
Andreas Kling
aaccf6ee4e ProcessManager: Use a GJsonArrayModel for the process memory maps 2019-08-10 16:08:51 +02:00
Andreas Kling
afd25679bc GJsonArrayModel: Support fields that aren't tied to a single JSON value
Change the custom data massaging callback to take a const JsonObject&.
This will allow binding together data from multiple fields into one
output in the model. :^)
2019-08-10 15:06:29 +02:00
Andreas Kling
a4548a150f Kernel: Hack the default keymap to support UK pipe/backslash
Since this key number doesn't appear to collide with anything on the
US keymap, I was thinking we could get away with supporting a hybrid
US/UK keymap. :^)
2019-08-10 14:29:32 +02:00
Andreas Kling
2eead3dfc0 ProcessManager: Use a GJsonArrayModel for the process file desciptors 2019-08-10 11:07:55 +02:00
Andreas Kling
078ce97c41 GJsonArrayModel: Add an optional "massage_for_display" fieldspec hook
This allows to you install a custom callback that can do anything with
Role::Display data before it's returned by GJsonArrayModel::data().
2019-08-10 11:06:29 +02:00
Andreas Kling
0f0a528323 ProcessManager: Remove SocketModel and NetworkAdapterModel
These are trivially replaced by GJsonArrayModels :^)
2019-08-10 10:36:07 +02:00
Andreas Kling
6e50631e35 LibGUI: Add GJsonArrayModel, a simple JSON-data-file-as-GModel helper
This makes it very easy to expose JSON files as GModels. :^)
2019-08-10 10:29:46 +02:00
Conrad Pankoff
fc3667c026 Kernel: Detect some outgoing TCP connection failures 2019-08-10 09:07:11 +02:00
Conrad Pankoff
bd6d2c0819 Kernel: Use a more detailed state machine for socket setup 2019-08-10 09:07:11 +02:00
Conrad Pankoff
638008da13 Kernel: Move TCP state logging into TCPSocket 2019-08-10 09:07:11 +02:00
Conrad Pankoff
e978e7543f Userland: Make sure sockaddr_len is initialised correctly in nc 2019-08-10 08:51:20 +02:00
Conrad Pankoff
5308e310a0 Kernel: Make accept() fill address with peer name rather than local name 2019-08-10 08:50:44 +02:00
Conrad Pankoff
5c0f1f9834 Kernel: Fix get{sock,peer}name port endianness 2019-08-10 08:49:31 +02:00
Sergey Bugaev
ccb482d1a7 Calculator: Add a simple calculator app
Closes https://github.com/SerenityOS/serenity/issues/319
2019-08-10 08:46:22 +02:00
Sergey Bugaev
79f867238a printf: Support dynamic fill widths
The printf formatting mini-language actually allows you
to pass a '*' character in place of the fill width specification,
in which case it eats one of the passed in arguments and uses it
as width, so implement that.
2019-08-10 08:46:22 +02:00
Sergey Bugaev
cfe8fdd5aa LibM: Implement sqrt()
Use the x87 fsqrt instruction for that.

We cannot use __builtin_sqrt(), since GCC expands it into
a sqrt() call, so we just loop endlessly.
2019-08-10 08:46:22 +02:00
Andreas Kling
0a061d4314 GLabel: Repaint immediately on icon change 2019-08-09 23:48:44 +02:00
Andreas Kling
db6ed8eebd GFilePicker: Make double-clicking actually choose/pick the file
..unless it's a directory, in which case we navigate into the directory
instead, as you would expect.
2019-08-09 23:45:04 +02:00
Andreas Kling
d31ddf9aaa Painter: Fix off-by-one in bounding rects for right-aligned text
Another instance of "Rect::right() is the last pixel *inside* the rect,
not the first pixel outside the rect" messing me up.
2019-08-09 19:51:14 +02:00
Andreas Kling
a720061423 Kernel: Zero-length dbgputstr() should just return 0 2019-08-09 19:44:14 +02:00
Andreas Kling
2c947a2c97 ProcessManager: Enable automatic column sizing for all table views
Start making use of the neat new mode in GTableView.
2019-08-09 19:32:09 +02:00
Andreas Kling
b5525d4ec3 GTableView: Add a mode for automatically sizing column to fit content
You can now call GTableView::set_size_columns_to_fit_content(true) and
the table columns will grow to fit the content. They will never shrink,
only grow.

This means I can spend a lot less time fidgeting with column widths :^)
2019-08-09 19:30:24 +02:00
Sergey Bugaev
be485946b8 ProcFS: Expose UDP sockets in /proc/net/udp 2019-08-09 13:15:59 +02:00
Sergey Bugaev
d06f4291a8 Kernel: Make TCPSocket::for_each() callback accept a reference
Yay for less arrows!
2019-08-09 13:15:59 +02:00
Sergey Bugaev
84a54c7cf7 ProcFS: Make a new nifty /proc/net directory
And move /proc/netadapters and /proc/net_tcp there. Now they're
/proc/net/adapters and /proc/net/tcp respectively, with more to come ^)
2019-08-09 13:15:59 +02:00
Andreas Kling
7e309e27dd Kernel: Clean up and sanitize incoming packet handling a bit more
Once we've converted from an Ethernet frame to an IPv4 packet, we can
pass the IPv4Packet around instead of the EthernetFrameHeader.

Also add some more code to ignore invalid-looking packets.
2019-08-09 10:42:01 +02:00
Andreas Kling
f9de264f88 Kernel: Actually, let's not hang() on bad incoming packets
That kinda defeats the purpose of being smart enough to ignore them :^)
2019-08-09 09:38:38 +02:00
Andreas Kling
9e2a00248e Kernel: Do some basic sanity checking on IPv4 packet headers
Ignore packets that are too small, or not as large as they claim to be.
2019-08-09 09:36:06 +02:00
Andreas Kling
04603237da Kernel: Merge FooSocketHandle classes into a single SocketHandle<Foo>
- IPv4SocketHandle => SocketHandle<IPv4Socket>
- TCPSocketHandle => SocketHandle<TCPSocket>
- UDPSocketHandle => SocketHandle<UDPSocket>
2019-08-09 09:18:16 +02:00
Conrad Pankoff
5c66c67f32 Kernel: Improve some network-related log messages 2019-08-09 07:09:26 +02:00
Conrad Pankoff
4fcbbd24f7 Kernel: Support binding to INADDR_ANY (all IPs) 2019-08-09 07:09:26 +02:00
Conrad Pankoff
3eb659a2bb Kernel: Implement TCP listening sockets and incoming connections 2019-08-09 07:09:26 +02:00
Conrad Pankoff
a53437aa06 Kernel: Let pending socket queue keep socket objects alive until accept() 2019-08-09 07:09:26 +02:00
Conrad Pankoff
54ceabd48d Kernel: Use WeakPtr<NetworkAdapter> instead of NetworkAdapter* in net code 2019-08-09 07:09:26 +02:00
Andreas Kling
d6bce37756 ProcessManager: Add a "Network" tab with live adapter and socket stats
This fetches info from /proc/netadapters and /proc/net_tcp, updating
every second. Very cool. :^)
2019-08-08 20:43:30 +02:00
Andreas Kling
899366da9d GTableView: Debug-log the current column width while resizing
This makes it easier to decide on a good initial width for a column.
2019-08-08 20:41:24 +02:00
Andreas Kling
eb3c19773e ProcessManager: Tweak memory stats widget layout to fit more text
After a while, the kmalloc/kfree counts got too wide for the label.
2019-08-08 19:50:33 +02:00
Andreas Kling
865a1b913c AK: Add Optional<T>(const U&)
This replaces Optional<T>(U&&) which clang-tidy complained may hide the
regular copy and move constructors. That's a good point, clang-tidy,
and I appreciate you pointing that out!
2019-08-08 18:34:59 +02:00
Andreas Kling
533b5c0adc Kernel: Reorder some Process members to shrink the class by 8 bytes 2019-08-08 14:57:45 +02:00
Andreas Kling
6d32b8fc36 Kernel: Use some more InlineLinkedList range-for iteration 2019-08-08 14:40:30 +02:00
Andreas Kling
eb6609124e ProcFS: Remove /proc/kmalloc, that info is already in /proc/memstat 2019-08-08 14:02:21 +02:00
Andreas Kling
9104d32341 Kernel: Use range-for with InlineLinkedList 2019-08-08 13:40:58 +02:00
Andreas Kling
028e834bb4 WindowServer: Use range-for with InlineLinkedList 2019-08-08 13:40:47 +02:00
Andreas Kling
bb9909548b AK: Add an iterator class for InlineLinkedList
This makes it possible to iterate over these with range-for. :^)
2019-08-08 13:39:40 +02:00
Andreas Kling
318068fe1b Kernel: Turns global Custody and Inode tables into InlineLinkedLists
Yet more of this same thing. Each one of these patches has a small but
noticeable impact on the steady-state kmalloc numbers. :^)
2019-08-08 11:11:22 +02:00
Andreas Kling
07425580a8 Kernel: Put all Regions on InlineLinkedLists (separated by user/kernel)
Remove the global hash tables and replace them with InlineLinkedLists.
This significantly reduces the kernel heap pressure from doing many
small mmap()'s.
2019-08-08 11:11:22 +02:00
Andreas Kling
a96d76fd90 Kernel: Put all VMObjects in an InlineLinkedList instead of a HashTable
Using a HashTable to track "all instances of Foo" is only useful if we
actually need to look up entries by some kind of index. And since they
are HashTable (not HashMap), the pointer *is* the index.

Since we have the pointer, we can just use it directly. Duh.
This increase sizeof(VMObject) by two pointers, but removes a global
table that had an entry for every VMObject, where the cost was higher.
It also avoids all the general hash tabling business when creating or
destroying VMObjects. Generally we should do more of this. :^)
2019-08-08 11:11:22 +02:00