Commit Graph

419 Commits

Author SHA1 Message Date
Andreas Kling
db35d59994 VFS: Move Ext2FSInode::m_lock up to Inode so all inodes can have locking. 2019-01-23 05:42:23 +01:00
Andreas Kling
730c14e647 VFS: Rename FS::id() to fsid() for consistency. 2019-01-23 05:39:11 +01:00
Andreas Kling
a1b4f719ba VFS: unlink() should fail when called on a directory. 2019-01-23 05:35:42 +01:00
Andreas Kling
754037874c Move VFS sources into Kernel/. 2019-01-23 05:14:00 +01:00
Andreas Kling
e911caeb10 Kernel: Fix dumb race in Scheduler::yield() debug code.
It was perfectly possible for Scheduler::yield() to get interrupted after
setting s_in_yield but before disabling interrupts.
2019-01-23 05:06:47 +01:00
Andreas Kling
07f4c8b01b VFS: Get rid of the deprecated Inode::write(const ByteBuffer&).
Fix the only remaining call site to use Inode::write_bytes().
2019-01-23 04:59:47 +01:00
Andreas Kling
05f18febb6 Ext2FS: Delete inodes when their link count goes to zero. 2019-01-22 16:34:24 +01:00
Andreas Kling
bda0c935c2 Add unlink() syscall and /bin/rm.
This patch adds most of the plumbing for working file deletion in Ext2FS.
Directory entries are removed and inode link counts updated.
We don't yet update the inode or block bitmaps, I will do that separately.
2019-01-22 07:03:44 +01:00
Andreas Kling
2f2f28f212 Kernel: Refactor Region/PageDirectory ownership model.
Make PageDirectory retainable and have each Region co-own the PageDirectory
they're mapped into. When unmapped, Region has no associated PageDirectory.

This allows Region to automatically unmap itself when destroyed.
2019-01-22 05:06:22 +01:00
Andreas Kling
4d1d875ca7 Remove some unused errno.h duplicates. 2019-01-22 01:12:53 +01:00
Andreas Kling
f70136a324 Kernel: Support open() with O_CREAT.
It's now possible to create zero-length files! :^)
Also hook up the new functionality in /bin/touch.
2019-01-22 00:58:56 +01:00
Andreas Kling
f9fcb682ec Keyboard: Use some of the existing defines instead of hard-coded numbers. 2019-01-21 07:30:46 +01:00
Andreas Kling
51595603bd WindowServer: Rename WSEvent subclasses WSFooEvent for consistency.
Add a WSWindowInvalidationEvent that carries a rect instead of having an
awkward single-purpose rect in WSEvent.
Flesh out WSKeyEvent a bit more.
2019-01-21 07:28:04 +01:00
Andreas Kling
aefbbeb3cb Flesh out keyboard event support a bit more. 2019-01-21 07:27:26 +01:00
Andreas Kling
76a2881793 Mark the two Regions used GraphicsBitmaps as explicitly shared.
This fixes a goofy problem where forking a GUI process would cowify the
GraphicsBitmap for everyone making a hue confusing mess.
2019-01-21 05:18:28 +01:00
Andreas Kling
d1af5c97ca Kernel: Process should drop any framebuffer regions on exec(). 2019-01-21 03:22:03 +01:00
Andreas Kling
61e50780aa Kernel: Forked processes should inherit arguments and environment. 2019-01-21 02:59:58 +01:00
Andreas Kling
e6fc84e234 Kernel: Make /proc/PID/fds display something useful for character devices. 2019-01-21 02:33:01 +01:00
Andreas Kling
786b903d62 WindowServer: Don't invalidate already frontmost window for moving to front. 2019-01-21 02:19:08 +01:00
Andreas Kling
e115ae5641 Kernel: Clone Process::m_gids on fork() and hook up any framebuffer region. 2019-01-21 01:49:30 +01:00
Andreas Kling
ea6678b7b3 LibGUI: Hook up GWindow event dispatch for paint and mouse events. 2019-01-20 07:03:38 +01:00
Andreas Kling
dbe83f3a83 Make it possible for userspace to alter window title/geometry.
I'm not in love with this syscall API but it allows me to make progress.
2019-01-20 06:04:13 +01:00
Andreas Kling
8eae89a405 Start bringing up LibGUI properly (formerly Widgets.) 2019-01-20 05:48:43 +01:00
Andreas Kling
a026da47e7 Move Widget & friends into LibGUI. 2019-01-19 23:49:56 +01:00
Andreas Kling
7e5b81fe48 Make a SharedGraphics directory for classes shared between Kernel and LibGUI. 2019-01-19 23:22:46 +01:00
Andreas Kling
b75ee4aacb Coding style fixes in AK. 2019-01-19 22:53:05 +01:00
Andreas Kling
7e044cf293 Add a simple /bin/sysctl that wraps the files in /proc/sys. 2019-01-18 15:35:38 +01:00
Andreas Kling
f7cc454162 Add mechanism to expose kernel variables to userspace via ProcFS.
Only booleans are supported at first. More types can be added easily.
Use this to add /proc/sys/wm_flash_flush which when enabled flashes pending
screen flush rects in yellow before they happen.
2019-01-18 15:01:40 +01:00
Andreas Kling
9454c5dd52 WindowServer: Merge WSFrameBuffer into WSScreen. 2019-01-18 05:41:15 +01:00
Andreas Kling
dff5051905 Support polling with select() by using a zero timeout.
Use this in WindowServer to avoid getting blocked in select() when
there are pending injected events.
2019-01-18 05:28:07 +01:00
Andreas Kling
dff70021ab Make it possible to invalidate only a portion of a window.
Use this in Terminal to only invalidate rows where anything changed.
2019-01-18 04:37:49 +01:00
Andreas Kling
9d7da26b4e StringBuilder: Use a ByteBuffer internally instead of a Vector<String>. 2019-01-18 03:27:51 +01:00
Andreas Kling
074edffc44 Add a simple StringBuilder::appendf() and use it for ProcFS.
Okay, now ProcFS doesn't crash due to the crappy buffer size estimates
not really working out. This thing has dogshit performance and I will
fix that separately.
2019-01-18 02:46:39 +01:00
Andreas Kling
dad58db757 Add WindowActivated and WindowDeactivated events.
Use this to implement different looking Terminal cursors depending on
the window active state.
2019-01-17 17:38:04 +01:00
Andreas Kling
e9e57c5f65 Rename SpinLock to Lock. It hasn't been a SpinLock for some time.
I'm pretty happy with the mechanism of AK::Lock for now.
2019-01-17 16:25:02 +01:00
Andreas Kling
dc20f00872 PS2MouseDevice: Try to synchronize the data reporting stream.
Turns out this was the reason QEMU wouldn't boot us.
2019-01-17 02:13:21 +01:00
Andreas Kling
a2ec09bc20 Allow the scheduler to unblock the current process.
It's a bit confusing that the "current" process is not actually running
while we're inside the scheduler. Perhaps the scheduler should redirect
"current" to its own dummy Process. I'm not sure.

Regardless, this patch improves responsiveness by allowing the scheduler
to unblock a process right after it calls select() in case it already has
a pending wakeup request.
2019-01-16 17:47:18 +01:00
Andreas Kling
4fef895eda Rework WindowServer to use select() in its main event loop.
The system can finally idle without burning CPU. :^)

There are some issues with scheduling making the mouse cursor sloppy
and unresponsive that need to be dealt with.
2019-01-16 17:20:58 +01:00
Andreas Kling
f7ca6d254d Tear out or duplicate what's unique for WindowServer from Widgets.
This turned into a huge refactoring that somehow also includes
making locks recursive/reentrant.
2019-01-16 16:03:50 +01:00
Andreas Kling
e655aebd70 Window: Update coding style. 2019-01-16 13:50:24 +01:00
Andreas Kling
9dd29f9aa9 Add a PTY multiplexer (/dev/ptmx) device.
When you open /dev/ptmx, you get a file descriptor pointing to one of the
available MasterPTY's. If none are available, you get an EBUSY.

This makes it possible to open multiple (up to 4) Terminals. :^)

To support this, I also added a CharacterDevice::open() that gets control
when VFS is opening a CharacterDevice. This is useful when we want to return
a custom FileDescriptor like we do here.
2019-01-16 13:39:32 +01:00
Andreas Kling
b46ae2bf09 Get rid of Vnode concept.
We already have an abstraction between Process and Inode/CharacterDevice/FIFO
and it's called FileDescriptor. :^)
2019-01-16 12:57:07 +01:00
Andreas Kling
310a5f4199 Let each MasterPTY create its slave. 2019-01-16 02:11:50 +01:00
Andreas Kling
9c51d9dfcd Catch anyone trying to use a DoubleBuffer with interrupts disabled. 2019-01-16 01:58:11 +01:00
Andreas Kling
09ba129bcf Use a CircularQueue for the PS/2 mouse driver. 2019-01-16 01:52:39 +01:00
Andreas Kling
8ad2dfb6e1 Rename FileDescriptor::has_data_available_for_reading() -> can_read(). 2019-01-16 00:47:00 +01:00
Andreas Kling
a8baee4dcd Tidy up memory map a bit and write out the general map in MemoryManager.
There was a bug that given enough supervisor page allocation, we would
eventually start dipping into the kmalloc range.
2019-01-16 00:44:09 +01:00
Andreas Kling
bd3e77cc16 Pass the process to CharacterDevice::read/write.
This is much nicer than grabbing directly at 'current' inside a read().
2019-01-16 00:20:38 +01:00
Andreas Kling
08bfe518f9 Rename CharacterDevice::has_data_available_for_reading() -> can_read(). 2019-01-16 00:10:13 +01:00
Andreas Kling
10387beda7 Implement basic support for POSIX-style select().
Now we can block on both the PTY *and* the GUI event stream in Terminal.
2019-01-16 00:09:58 +01:00