Andreas Kling
4cb87b1753
FileSystem: Add a Custody class that represents a parent/child guardianship.
...
A custody is kind of a directory entry abstraction that represents a single
entry in a parent directory that tells us the name of a child inode.
The idea here is for path resolution to produce a chain of custody objects.
2019-05-30 17:46:08 +02:00
Andreas Kling
baaede1bf9
Kernel: Make the Process allocate_region* API's understand "int prot".
...
Instead of having to inspect 'prot' at every call site, make the Process
API's take care of that so we can just pass it through.
2019-05-30 16:14:37 +02:00
Andreas Kling
8fe72d7b3c
Kernel: Make fcntl(F_SETFL) actually update the append/blocking flags.
2019-05-30 15:37:51 +02:00
Andreas Kling
08926e59b3
Kernel: Add InodeFile, a File subclass for regular files.
...
Finally everything that can be held by a FileDescriptor actually inherits
from the File class.
2019-05-30 13:39:17 +02:00
Andreas Kling
66c1a9be3b
Kernel: Pass 'prot' argument to File::mmap() and act on it.
...
Nothing crazy, this just means that PROT_READ allocates readable regions,
and that PROT_WRITE allocates writable ones.
2019-05-30 12:38:35 +02:00
Robin Burchell
d31ce9eccd
Misc: Add a simple init process
...
This doesn't do much right now, just fork off a bunch of stuff and set priorities.
2019-05-30 02:57:15 +02:00
Robin Burchell
9cd0f6ffac
Kernel/LibC: Implement sched_* functionality to set/get process priority
...
Right now, we allow anything inside a user to raise or lower any other process's
priority. This feels simple enough to me. Linux disallows raising, but
that's annoying in practice.
2019-05-30 02:57:15 +02:00
Robin Burchell
a906098579
Kernel: Fix a bad printf, and stub out SO_ERROR a bit more fully
...
links requests SO_ERROR, so in not supporting it, things were unhappy.
Supporting this properly looks a little messy. I guess Socket will need
an m_error member it sets everywhere it returns an error. Or Syscall
could set it, perhaps, but I don't know if that's the right thing to
do, so let's just stub this for now and file a bug.
2019-05-30 02:02:30 +02:00
Robin Burchell
0dc9af5f7e
Add clang-format file
...
Also run it across the whole tree to get everything using the One True Style.
We don't yet run this in an automated fashion as it's a little slow, but
there is a snippet to do so in makeall.sh.
2019-05-28 17:31:20 +02:00
Andreas Kling
16ea34fc12
Kernel: Remove accidentally committer .orig file.
2019-05-28 13:17:27 +02:00
Christopher Dumas
aa50e5bb13
tiled backgrounds no longer has strange off-by-one pixel errors
2019-05-27 21:40:53 +02:00
Andreas Kling
bb288c1baf
IDEDiskDevice: Implement basic DMA writes.
...
This could share more code with reads, and generally be better. But it works
and it's considerably faster than PIO, so let's use it. :^)
2019-05-26 14:58:21 +02:00
Andreas Kling
0cac84d6bd
Kernel: Sending a signal to yourself should block until dispatch.
...
By moving the sending (and receiving) thread into the BlockedSignal state,
we ensure that the thread doesn't continue executing until the signal
has been dispatched.
2019-05-26 02:35:25 +02:00
Andreas Kling
6ffcee9176
Kernel: Send more specific signals when crashing due to CPU exceptions.
...
- For division by zero, send SIGFPE.
- For illegal instruction, send SIGILL.
- For the rest, default to SIGSEGV.
2019-05-26 02:35:25 +02:00
Robin Burchell
c6e79bd53a
Kernel: Support O_APPEND
...
As per the manpage, this acts as a transparent lseek() before write.
2019-05-26 01:32:05 +02:00
Andreas Kling
75b0e5cce5
Ext2FS: Block #0 can terminate an inode block list early.
...
We were already handling this for the indirect blocks, but the direct ones
would happily consider #0 to be a valid block list entry.
2019-05-25 19:19:43 +02:00
Andreas Kling
728327df8a
Ext2FS: Fix build with EXT2_DEBUG enabled, and tweak some variable names.
2019-05-25 17:23:17 +02:00
Andreas Kling
149b7f92a7
Demos: Start working on a simple WidgetGallery app.
...
It's good to have a place where we can try out all the different widgets.
This needs some more work on a nice layout, and should also include more
of the widgets. :^)
2019-05-24 22:47:41 +02:00
Christopher Dumas
dd84dcf31f
Launcher loads applications from Launcher.ini, is started by default, and is resized automatically
...
Co-Authored-By: Andreas Kling <awesomekling@gmail.com>
2019-05-24 20:40:09 +02:00
Andreas Kling
abbcdba72e
WindowServer: Add 2560x1440 resolution option.
...
Also expand the QEMU VGA memory size to 64 MB, since otherwise we won't
have enough memory for double-buffering the screen.
2019-05-24 14:02:17 +02:00
Andreas Kling
ebf645d72a
Kernel: Tidy up IDEDiskDevice a bit.
...
The main cleanup here is putting the I/O address base in a member variable.
2019-05-24 04:17:15 +02:00
Andreas Kling
fba57d6ba3
Always run QEMU with -debugcon stdio.
...
If someone wants to run without this, they can disable it manually :^)
2019-05-23 20:57:32 +02:00
Andreas Kling
9806a23f83
Kernel: Return ENOSYS if an invalid syscall number is requested.
2019-05-23 17:04:26 +02:00
Robin Burchell
6917c42140
Kernel/AK: Move ELF loader to AK
...
This is in preparation for eventually using it in userspace.
LinearAddress.h has not been moved for the time being (as it seems to be
only used by a very small part of the code).
2019-05-23 16:57:34 +02:00
Andreas Kling
14a202f011
Kernel: getpeername() should fail with ENOTCONN for non-connected sockets.
2019-05-23 15:39:52 +02:00
Andreas Kling
7afc0fb9c8
Kernel: Forked children should inherit their RangeAllocator by copy.
...
Otherwise we'll start handing out addresses that are very likely already in
use by existing ranges.
2019-05-22 13:24:28 +02:00
Andreas Kling
8098d2e337
Kernel: If a signal is ignored, make sure we unset BlockedSignal state.
2019-05-22 13:23:41 +02:00
Andreas Kling
c048ded470
Kernel: Dump backtrace on illegal opcode exception.
2019-05-22 13:22:27 +02:00
Andreas Kling
c9a9ca0dfe
Kernel: Bump kernel stacks to 64 KB.
...
This makes the ELF symbolication crash go away while I work out a smart fix.
2019-05-21 16:15:52 +02:00
Andreas Kling
ae470ec955
Kernel: Add getpeername() syscall, and fix getsockname() behavior.
...
We were copying the raw IPv4 addresses into the wrong part of sockaddr_in,
and we didn't set sa_family or sa_port.
2019-05-20 20:33:03 +02:00
Andreas Kling
f008156dbf
Socket: Fix missing kprintf() args in setsockopt().
2019-05-20 19:45:27 +02:00
Andreas Kling
bcc6ddfb6b
Kernel: Let PageDirectory own the associated RangeAllocator.
...
Since we transition to a new PageDirectory on exec(), we need a matching
RangeAllocator to go with the new directory. Instead of juggling this in
Process and MemoryManager, simply attach the RangeAllocator to the
PageDirectory instead.
Fixes #61 .
2019-05-20 04:46:29 +02:00
Andreas Kling
5023464d95
LocalSocket: Make send() and sendto() work, too.
2019-05-20 03:59:30 +02:00
Andreas Kling
668bfaa2af
LocalSocket: Bump internal buffer sizes to 16KB.
...
This gives us some leeway for WindowServer to queue up a bunch of messages
for one of its clients. Longer-term we should improve DoubleBuffer to be
able to grow dynamically in a way that gets billed to some reasonable place.
2019-05-20 03:57:25 +02:00
Andreas Kling
b3a1671f1a
Kernel: Add support for recv() with MSG_DONTWAIT.
...
Passing this flag to recv() temporarily puts the file descriptor into
non-blocking mode.
Also implement LocalSocket::recv() as a simple forwarding to read().
2019-05-20 03:47:02 +02:00
Andreas Kling
85d2e85912
LocalSocket: Fix mismatch between can_write() and write() logic.
...
can_write() was saying yes in situations where write() would overflow the
internal buffer. This patch adds a has_attached_peer() helper to make it
easier to understand what's going on in these functions.
2019-05-20 02:54:52 +02:00
Robin Burchell
a8864dc590
Kernel: Report EAGAIN from read() on a non-blocking socket if the buffer is empty
...
This is not EOF, and never should have been so -- can trip up other code
when porting.
Also updates LibGUI and WindowServer which both relied on the old
behaviour (and didn't work without changes). There may be others, but I
didn't run into them with a quick inspection.
2019-05-20 01:31:28 +02:00
Andreas Kling
212a263f0a
Kernel+LibC: Implement getsockname() syscall.
2019-05-19 19:55:27 +02:00
Andreas Kling
189b342e6f
LibC: Add mmap_with_name() that names the allocation immediately.
...
This allows us to skip the separate call to set_mmap_name() in code that
we control, e.g malloc() and GraphicsBitmap.
2019-05-19 15:54:56 +02:00
Andreas Kling
5f26f83451
IDEDiskDevice: Add sysctl variable for turning DMA on/off.
2019-05-19 15:54:33 +02:00
Robin Burchell
d8b74c8c86
Kernel: Check can_write for blocking write
...
This way the socket write buffer sizes are respected, and things that
exceed them get sent EAGAIN.
2019-05-19 14:13:49 +02:00
Robin Burchell
635eb20289
Kernel: Add the ability to debug poll/select independently of read/write
2019-05-19 14:13:49 +02:00
Andreas Kling
c7d8aa6969
IDEDiskDevice: Support reading multiple sectors at a time with DMA.
...
This is another sizable improvement to GCC compile times.
2019-05-19 04:40:30 +02:00
Andreas Kling
ed79116e94
IDEDiskDevice: Use wait_for_irq() when waiting for DMA transfers.
...
Also make sure we return any device errors to caller.
2019-05-19 03:56:06 +02:00
Andreas Kling
c818773983
IDEDiskDevice: Add support for DMA reads.
...
I've only tested this with the PIIX3 chipset QEMU emulates, but it works
pretty well here. GCC compile times are cut roughly in half :^)
2019-05-19 03:46:50 +02:00
Andreas Kling
1fd90b09f8
Kernel: Remove an unused ELFLoader member.
2019-05-19 02:03:56 +02:00
Andreas Kling
853597200e
Kernel: Remove relocation-related code since it's not used by the kernel.
...
If/when we need this in the future, we can bring it back. Right now it's
just sitting there making the ELF code look huge when it's not.
2019-05-19 01:14:32 +02:00
Andreas Kling
75866438b5
Kernel: Don't page in entire file immediately on mmap().
...
If we just don't do anything, the page fault handler will load the file
incrementally as-needed instead. :^)
2019-05-18 22:30:55 +02:00
Andreas Kling
959c8f287c
FileDescriptor: It's actually okay to seek past the end of a file. :^)
2019-05-18 21:54:31 +02:00
Andreas Kling
7900da9667
Kernel: Make sure we never put the colonel thread in the runnable list.
...
This would cause it to get scheduled unnecessarily.
2019-05-18 20:28:04 +02:00