Commit graph

121 commits

Author SHA1 Message Date
Andreas Kling e88c8eae6a AK: Fix leak in HashTable move assignment operator. 2019-02-04 08:53:12 +01:00
Andreas Kling dddd0e7b03 Get nyancat nyanning in Serenity.
I found a cute program that renders an animated nyancat in the terminal.
This patch adds enough hackery to get it working correctly. :^)
2019-02-03 16:11:28 +01:00
Andreas Kling 7f91aec25c Support font files.
This only works with the userspace build of SharedGraphics so far.
It's also very slow at loading fonts, but that's easy to fix.

Let's put fonts in /res/fonts/.
2019-02-02 23:13:12 +01:00
Andreas Kling 5e0b7f1a56 Add basic automatic dependency management to Makefiles. 2019-02-02 04:41:59 +01:00
Andreas Kling 95c3442d59 Implement event loop timers.
GObjects can now register a timer with the GEventLoop. This will eventually
cause GTimerEvents to be dispatched to the GObject.

This needed a few supporting changes in the kernel:

- The PIT now ticks 1000 times/sec.
- select() now supports an arbitrary timeout.
- gettimeofday() now returns something in the tv_usec field.

With these changes, the clock window in guitest2 finally ticks on its own.
2019-02-01 03:50:06 +01:00
Andreas Kling ffab6897aa Big, possibly complete sweep of naming changes. 2019-01-31 17:31:23 +01:00
Andreas Kling 3a4207b863 Fix dumb bug in HashTable::clear().
We forgot to clear the m_buckets pointer. This meant that multiple calls to
clear() would cause trouble.
2019-01-30 19:32:54 +01:00
Andreas Kling b4e478aa50 Deallocate PTY's when they close.
This required a fair bit of plumbing. The CharacterDevice::close() virtual
will now be closed by ~FileDescriptor(), allowing device implementations to
do custom cleanup at that point.

One big problem remains: if the master PTY is closed before the slave PTY,
we go into crashy land.
2019-01-30 18:47:18 +01:00
Andreas Kling 027d26cd5d Add a String::format() and use that in place of ksprintf() in the Kernel.
You're never gonna be right 100% of the time when guessing how much buffer
space you need. This avoids having to make that type of decision in a bunch
of cases. :^)
2019-01-30 16:28:51 +01:00
Andreas Kling c30e2c8d44 Implement basic chmod() syscall and /bin/chmod helper.
Only raw octal modes are supported right now.
This patch also changes mode_t from 32-bit to 16-bit to match the on-disk
type used by Ext2FS.

I also ran into EPERM being errno=0 which was confusing, so I inserted an
ESUCCESS in its place.
2019-01-29 04:55:08 +01:00
Andreas Kling cc906a2897 VFS: Resolve FIXME in Inode::read_entire() about using dynamic allocation. 2019-01-28 22:55:55 +01:00
Andreas Kling 7455f5ea42 Expose the kernel log buffer through /proc/dmesg.
Also add a /bin/dmesg program for convenience.
2019-01-28 22:40:55 +01:00
Andreas Kling c7221b7dee Painter: Tell the compiler to flatten Font::draw_glyph().
I think that concludes the Terminal stress test optimizations for now.
2019-01-27 05:23:04 +01:00
Andreas Kling 29dfb4ae13 Ext2FS: Factor out block list generation and writing into functions. 2019-01-23 03:03:44 +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 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 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 b5c76d7559 Get rid of #ifdef SERENITY. We're past that phase of bootstrapping. 2019-01-17 01:41:36 +01:00
Andreas Kling f651405694 Optimize the Painter::blit() loop a bit. ~3% fewer cycles, I'll take it. 2019-01-16 19:50:25 +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 b4da4e8fbd Always inline the locks. 2019-01-14 14:14:30 +01:00
Andreas Kling 11331e9639 Add Vector::take_first(). 2019-01-14 02:49:30 +01:00
Andreas Kling b2d86b7597 Add basic GUI API for creating labels and buttons. 2019-01-13 05:03:17 +01:00
Andreas Kling 17c7bf01a5 Fix Userland build. 2019-01-13 04:31:16 +01:00
Andreas Kling edc827077e Optimize WindowManager::flush() with fast_dword_copy(). 2019-01-12 21:45:45 +01:00
Andreas Kling 8068b8e09e Add a Vector::clear_with_capacity() that doesn't release the backing store.
Use this for WindowManager's dirty rects to avoid kmalloc traffic.
2019-01-12 07:22:25 +01:00
Andreas Kling ceb373cf71 More window manager hacking. FocusIn/FocusOut events. 2019-01-09 05:40:04 +01:00
Andreas Kling 9963da9005 Start refactoring graphics system to have per-window backing stores.
It was fun for everyone to share a single framebuffer but it was also
kinda really awful. Let's move towards having a "GraphicsBitmap" as the
backing store for each Window.

This is going to need a lot of refactoring so let's get started.
2019-01-09 02:06:04 +01:00
Andreas Kling 741349502f Ext2FS: Free Ext2FSInodes when the last user releases them.
The inode cache was keeping these alive forever. Added a cute little magic
trick to Retainable that calls T::one_retain_left() when the retain count
is decremented to 1.
2019-01-01 02:38:09 +01:00
Andreas Kling edac1d6748 Make PageDirectory store physical pages in a HashMap.
This container is really just there to keep a retain on the individual
PhysicalPages for each page table. A HashMap does the job with far greater
space efficiency.
2018-12-31 15:10:12 +01:00
Andreas Kling ab72666f48 Plug leaks in SynthFS::remove_file().
The process spawn stress test can now run forever. :^)
2018-12-28 03:09:45 +01:00
Andreas Kling 3f3535213b Fix some issues uncovered by the spawn stress test. 2018-12-26 22:02:24 +01:00
Andreas Kling 7bc41532be Remove FS::read_entire_inode() in favor of Inode::read_entire(). 2018-12-21 17:45:42 +01:00
Andreas Kling ec1c487dcd Yet another pass of style fixes. 2018-12-21 02:10:45 +01:00
Andreas Kling d0f06e5f3f Automatically call Inode::flush_metadata() before an Inode is destroyed.
Use a little template magic to have Retainable::release() call out to
T::will_be_destroyed() if such a function exists before actually calling
the destructor. This gives us full access to virtual functions in the
pre-destruction code.
2018-12-19 22:28:09 +01:00
Andreas Kling d2bb139c46 Support inserting a newline. 2018-12-05 01:43:07 +01:00
Andreas Kling ca6847b5bb Import a simple text editor I started working on. 2018-12-04 00:27:16 +01:00
Andreas Kling aff89d2fd7 Yet more coding style fixes. 2018-12-03 01:38:22 +01:00
Andreas Kling f31e1ceab0 Move InlineLinkedList to AK. 2018-12-03 01:18:54 +01:00
Andreas Kling e7cc08226f Implement basic support for times().
The kernel now bills processes for time spent in kernelspace and userspace
separately. The accounting is forwarded to the parent process in reap().

This makes the "time" builtin in bash work.
2018-12-03 01:14:19 +01:00
Andreas Kling f6e27c2abe More coding style changes. 2018-12-03 00:39:25 +01:00
Andreas Kling fb8a1186f6 Use decltype(sizeof(void*)) as a facsimile for std::size_t.
Clang demands that the size argument to the various operator new()'s
to be exactly whatever it thinks std::size_t is.

Since we can't include STL headers, this little trick will do.
2018-12-02 23:48:19 +01:00
Andreas Kling 85b886c2e0 Make it possible to build the Kernel on a macOS host.
It still requires an ELF compiler and linker, but at least it builds.
I need to get rid of the "Unix" namespace. This does a lot of that.
2018-12-02 23:34:50 +01:00
Andreas Kling d90104f9e0 Let reap() communicate the dead process's exit status to the caller.
This way the scheduler doesn't need to plumb the exit status into the waiter.
We still plumb the waitee pid though, I don't love it but it can be fixed.
2018-11-28 22:01:24 +01:00
Andreas Kling f5a0b6961c Fix mkdir with relative paths. 2018-11-18 23:28:43 +01:00
Andreas Kling de4604ac95 Finally hook up the mkdir code to a syscall.
Added a /bin/mkdir that makes directories. How very neat :^)
There are various limitations because of missing functionality.
2018-11-18 15:02:16 +01:00
Andreas Kling d2046e79cf Add a DoubleBuffer thingy to allow TTY read/write to be interleaved.
I feel like this concept might be useful in more places. It's very naive
right now and uses dynamically growing buffers. It should really use static
size buffers and never kmalloc().
2018-11-16 17:57:00 +01:00
Andreas Kling 10c470e95f Make page_in_from_vnode 2x faster.
...by adding a new class called Ext2Inode that inherits CoreInode.
The idea is that a vnode will wrap a CoreInode rather than InodeIdentifier.
Each CoreInode subclass can keep whatever caches they like.

Right now, Ext2Inode caches the list of block indices since it can be very
expensive to retrieve.
2018-11-13 13:02:39 +01:00