Andreas Kling
6416123cfb
Kernel: Set the colonel task to low priority.
...
This gives it a smaller time slice, improving responsiveness.
2019-03-23 22:22:01 +01:00
Andreas Kling
8501fdc6f5
Kernel: Don't add the colonel process' main thread to g_threads.
...
This was causing the colonel to get scheduled when he wasn't needed.
2019-03-23 22:17:38 +01:00
Andreas Kling
60d25f0f4a
Kernel: Introduce threads, and refactor everything in support of it.
...
The scheduler now operates on threads, rather than on processes.
Each process has a main thread, and can have any number of additional
threads. The process exits when the main thread exits.
This patch doesn't actually spawn any additional threads, it merely
does all the plumbing needed to make it possible. :^)
2019-03-23 22:03:17 +01:00
Andreas Kling
9dfcd95cd7
Use 64-bit integers inside Stopwatch to enable longer timings.
2019-03-21 13:41:36 +01:00
Andreas Kling
42755e98cf
SharedGraphics: Implement a simple PNG decoder.
...
This is extremely unoptimized, but it does successfully load "folder32.png"
so it must be at least somewhat correct. :^)
2019-03-21 03:57:42 +01:00
Andreas Kling
86e2348b74
Kernel+LibC: Don't crash upon traversal of large directories.
2019-03-20 18:31:12 +01:00
Andreas Kling
7b32afdcfc
Kernel: Oops, forgot to add Alarm.h earlier. Here it is.
2019-03-20 18:16:15 +01:00
Andreas Kling
367bb9e4eb
Kernel: Remove ioctl for getting a socket peer's PID.
...
Now that everything is nice and mature, the WindowServer can just use the
client PID it receives in the Greeting message, and we can get rid of this
hacky ioctl. :^)
2019-03-20 17:14:48 +01:00
Andreas Kling
bc1da7f1fd
Kernel: Snooze the NetworkTask until there are incoming packets to process.
...
This is accomplished using a new Alarm class and a BlockedSnoozing state.
Basically, you call Process::snooze_until(some_alarm) and then the scheduler
won't wake up the process until some_alarm.is_ringing() returns true.
2019-03-20 17:09:46 +01:00
Andreas Kling
d17a91f185
Move WindowServer into Servers.
2019-03-20 04:34:14 +01:00
Andreas Kling
9120b05a40
Rename DNSLookupServer => LookupServer.
2019-03-20 04:26:30 +01:00
Andreas Kling
41c744b3c8
Kernel: Don't panic if a call redirected to Device::open() has an error.
...
Just pass the error to the user. I hit this when opening so many Terminal
windows that PTYMultiplexer::open() ran out of master/slave pairs.
2019-03-20 02:55:12 +01:00
Andreas Kling
6f966ca51d
Kernel: Accepting sockets don't need to retain the client sockets.
...
This is all taken care of by the respective FileDescriptors.
Before this patch, we were leaking every single socket, not great!
2019-03-20 02:48:02 +01:00
Andreas Kling
e48cbf3c8c
Kernel: connect() should fail with EISCONN for already-connected sockets.
...
Also make sure to reset the socket role if Socket::connect() fails.
2019-03-20 02:38:36 +01:00
Andreas Kling
4aa0ab4e08
Kernel: Fix race between accept() and connect().
...
We had a bug where an accepted socket would appear to be EOF/disconnected
on the accepting side until the connecting side had called attach_fd().
Fix this by adding a new SocketRole::Connecting state.
2019-03-20 02:33:51 +01:00
Andreas Kling
a02c945ef2
Kernel: DoubleBuffer can return early if read/write is called with !size.
2019-03-20 02:12:40 +01:00
Andreas Kling
0e4a1936ca
LibC: Implement gethostbyname() by talking to the DNSLookupServer.
...
We now talk to the lookup server over a local socket and it does the lookup
on our behalf. Including some retry logic, which is nice, because it seems
like DNS requests disappear in the ether pretty damn often where I am.
2019-03-20 01:15:22 +01:00
Andreas Kling
fe2fa4ac80
DNSLookupServer: Start working on a userspace DNS resolver.
...
This doesn't have any server functionality just yet, but it does post
decent-looking DNS queries and parse the responses.
2019-03-19 16:29:06 +01:00
Andreas Kling
57ff293a51
LibGUI: Implement nested event loops to support dialog boxes.
...
This patch adds a simple GMessageBox that can run in a nested event loop.
Here's how you use it:
GMessageBox box("Message text here", "Message window title");
int result = box.exec();
The next step is to make the WindowServer respect the modality flag of
these windows and prevent interaction with other windows in the same
process until the modal window has been closed.
2019-03-19 00:01:02 +01:00
Andreas Kling
8e3d0a23d5
LibGUI: Add GTCPSocket and base class GSocket (inherits from GIODevice.)
...
And use these to do the line-by-line reading automagically instead of having
that logic in IRCClient. This will definitely come in handy.
2019-03-18 14:09:58 +01:00
Andreas Kling
c24d4b07db
IPv4: Add simple pseudorandom ephemeral port allocators for TCP and UDP.
2019-03-18 04:03:44 +01:00
Andreas Kling
1c6dfc3282
AK: Make ByteBuffer's copy() and wrap() take void*.
...
This way we don't have to cast whatever we're passing to copy()/wrap().
2019-03-17 00:36:41 +01:00
Andreas Kling
5dd79736c5
Kernel: Remove the one client of Vector-with-custom-allocator.
...
This was a silly experiment. If I want to save space here, I can do it in
one of many other ways.
2019-03-16 13:19:58 +01:00
Andreas Kling
313ee8dd19
Move Lock from AK to Kernel, since it only works inside the kernel.
2019-03-16 13:18:22 +01:00
Andreas Kling
15657f0916
AK: Remove Buffer<T> since it was only ever instantiated with T=byte.
...
Instead make a specialized AK::ByteBufferImpl class for the backing store
of AK::ByteBuffer. This reduces template bloat.
2019-03-16 13:12:13 +01:00
Andreas Kling
aa19735c5a
IRCClient: Start working on a simple graphical IRC client.
...
This will be a nice way to exercise both LibGUI and the TCP/IP support. :^)
2019-03-15 12:14:23 +01:00
Andreas Kling
5dfdcf796d
TCP: Correct checksum for packets with odd number of bytes.
2019-03-14 19:57:54 +01:00
Andreas Kling
f9569db1e5
TCP: Collect the payload if present in a packet with FIN set.
2019-03-14 15:28:23 +01:00
Andreas Kling
25e521f510
TCP: Start working on auto-closing connections when we get FIN.
2019-03-14 15:23:32 +01:00
Andreas Kling
69ffaa366d
Kernel: Handle unaligned ELF segments gracefully in the executable loader.
2019-03-14 14:51:43 +01:00
Andreas Kling
d712d353ac
Kernel: Remove leftover debug spam when returning from mkdir() syscall.
2019-03-14 14:11:35 +01:00
Andreas Kling
edb986c276
IPv4: Factor out UDP parts of IPv4Socket into a UDPSocket class.
2019-03-14 12:43:18 +01:00
Andreas Kling
274b500bac
IPv4: Move more stuff from IPv4Socket to TCPSocket.
2019-03-14 12:28:30 +01:00
Andreas Kling
d2176eddfc
Kernel: Factor out TCP parts of IPv4Socket into a TCPSocket class.
2019-03-14 12:20:38 +01:00
Andreas Kling
8014473918
TCP: Update our side's ack number based on the other side's seq number.
2019-03-14 11:45:22 +01:00
Andreas Kling
54e7df0586
Kernel: Add SocketHandle helper class that wraps locked sockets.
...
This allows us to have a comfy IPv4Socket::from_tcp_port() API that returns
a socket that's locked and safe to access. No need to worry about locking
at the client site.
2019-03-14 09:19:24 +01:00
Andreas Kling
3d5296a901
IPv4: Last burst of TCP hacking for today.
...
Connecting to a test server and exchanging data back and forth works.
2019-03-14 01:44:42 +01:00
Andreas Kling
be46f1bb1f
IPv4: More work on the TCP implementation.
...
Reading from the peer now kinda works. Something still going wrong with
sending packets but it's getting closer.
2019-03-14 01:00:10 +01:00
Andreas Kling
66d55f8e0c
IPv4: More work on the TCP implementation.
...
I can now establish a connection to my little test server on the host.
2019-03-14 00:20:44 +01:00
Andreas Kling
032d9d7065
IPv4: More hacking on bringing up TCP support.
...
This was a bit more complicated than I expected, but it's moving forward.
2019-03-13 23:14:30 +01:00
Andreas Kling
7aba68d51c
Userland+LibC: Add a new little "tc" program for testing TCP.
...
Also added send() and recv() to LibC in support of this. They are just
wrappers around sendto() and recvfrom().
2019-03-13 17:33:40 +01:00
Andreas Kling
c588653f76
IPv4: Begin fleshing out TCP support.
2019-03-13 17:17:07 +01:00
Andreas Kling
ef5d0a397c
IPv4: Do the TCP-to-socket mapping in the same way as UDP.
...
We don't actually have TCP support yet, but we'll get there soon. :^)
2019-03-13 16:43:42 +01:00
Andreas Kling
3ad9561b80
IPv4: Use the UDP-to-socket map to handle incoming UDP packets.
2019-03-13 16:23:22 +01:00
Andreas Kling
209a16bb7f
IPv4: Dynamically allocate the UDP source port if needed.
2019-03-13 16:05:56 +01:00
Andreas Kling
4dddf949c8
IPv4: More work on UDP support.
...
I'm now able to connect to a simple UDP server on my host machine and
exchange some data. Very cool! :^)
2019-03-13 15:40:30 +01:00
Andreas Kling
a9dc332a11
IPv4: recvfrom() shouldn't care about what's in the outparam on entry.
2019-03-13 15:00:28 +01:00
Andreas Kling
ea6a537b70
Userland: Add a simple utility for UDP testing.
2019-03-13 15:00:02 +01:00
Andreas Kling
19a51132f5
Kernel: recvfrom() should treat the address arguments as outparams.
2019-03-13 14:47:21 +01:00
Andreas Kling
b59d588c04
Kernel: Start fleshing out an UDP implementation.
2019-03-13 14:22:27 +01:00