summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2019-07-21Kernel+LibC: Add a dbgputch() syscall and use it for userspace dbgprintf().Andreas Kling
The "stddbg" stream was a cute idea but we never ended up using it in practice, so let's simplify this and implement userspace dbgprintf() on top of a simple dbgputch() syscall instead. This makes debugging LibC startup a little bit easier. :^)
2019-07-21Ports: Add GNU make 4.2! :^)Andreas Kling
2019-07-21AK: Run host tests on makeRobin Burchell
Restructure the makefile a little so it only builds objects once, and then run them on make clean. This is a little slower (since we're relinking tests each makeall), but it also ensures that it will work.
2019-07-21Ext2FS: Put most debug logging behind EXT2_DEBUG.Andreas Kling
The debug output was basically dominated by Ext2FS spam.
2019-07-21Userspace: Deal with select() returning EINTR on a signal interruptionRobin Burchell
Add a trivial CSafeSyscall template that calls a callback until it stops returning EINTR, and use it everywhere we use select() now. Thanks to Andreas for the suggestion of using a template parameter for the syscall function to invoke.
2019-07-21Process: Fix select/poll EINTRRobin Burchell
Check for EINTR before doing anything with the passed sets, otherwise we zero them out which means a re-call with the same sets won't work.
2019-07-21AK: Fix off-by-one in Vector::prepend(Vector&&).Andreas Kling
Caught by valgrind's uninitialized access checks on the Vector unit test. Yay for finding bugs with valgrind on the unit tests! :^)
2019-07-21AK: Make NonnullRefPtr::operator=(NonnullRefPtr<U>&&) cast incoming pointer.Andreas Kling
Same as the RefPtr issue I just fixed. This makes it possible to assign a NonnullRefPtr<Derived>&& to a NonnullRefPtr<Base>.
2019-07-21Scheduler: Allow reentry into block()Robin Burchell
With the presence of signal handlers, it is possible that a thread might be blocked multiple times. Picture for instance a signal handler using read(), or wait() while the thread is already blocked elsewhere before the handler is invoked. To fix this, we turn m_blocker into a chain of handlers. Each block() call now prepends to the list, and unblocking will only consider the most recent (first) blocker in the chain. Fixes #309
2019-07-21TestSuite: Don't leak the suite instanceRobin Burchell
Makes checking for leaks more straightforward
2019-07-21TestSuite: instance() -> the(), and return a referenceRobin Burchell
To be more consistent with the rest of the codebase
2019-07-21AK: RefPtr::operator=(RefPtr<U>&&) needs to cast the incoming pointer.Andreas Kling
Otherwise it's not possible to assign a RefPtr<Derived>&& to a RefPtr<Base>.
2019-07-21AK: Add a unit test for Vector::prepend(Vector&&) with complex T.Andreas Kling
It's good to verify that complex objects can be moved nicely by Vector.
2019-07-21AK: Add some basic unit tests for WeakPtr.Andreas Kling
2019-07-21TestSuite: Make tests actually run (oops!)Andreas Kling
We were not actually running any of the unit tests, only getting a pointer to them. Thankfully they all pass, even after we start running them. :^)
2019-07-21WindowServer: Disable the global menubar while a modal window is active.Andreas Kling
This makes it much harder to screw with an application while it's showing a modal window, and matches what some other systems are doing. :^)
2019-07-21CEventLoop: Skip over null events in the queue.Andreas Kling
Added some FIXME's about correctness issues in nested event loop exiting.
2019-07-21Kernel+LibC: Add a dump_backtrace() syscall.Andreas Kling
This is very simple but already very useful. Now you're able to call to dump_backtrace() from anywhere userspace to get a nice symbolicated backtrace in the debugger output. :^)
2019-07-21ls: Don't print an empty line if there were no files to show.Andreas Kling
Fixes #352.
2019-07-21FileManager: Add a toolbar button for going to the home directory.Andreas Kling
Fixes #308.
2019-07-20GWidget: Add set_preferred_size(width, height) overload.Andreas Kling
It was annoying to always write set_preferred_size({ width, height }). :^)
2019-07-20GSplitter: Implement using the orientation-based geometry helpers.Andreas Kling
2019-07-20LibDraw: Add orientation-based size helpers to Size as well.Andreas Kling
Now you can ask for e.g Size::primary_size_for_orientation(Orientation).
2019-07-20GSlider: Add support for vertical sliders.Andreas Kling
You now have to pass an Orientation to the GSlider constructor. It's not possible to change the orientation after construction. Added some vertical GSliders to the WidgetGallery demo for testing. :^)
2019-07-20LibDraw: Add orientation-based offset/size manipulation helpers.Andreas Kling
These are useful when doing widgets that can be switched between vertical and horizontal mode, such as GSlider. The idea is that instead of using "x" and "y" directly, you use the "primary" and "secondary" offset/size for the Orientation you're configured in.
2019-07-20LibDraw: Move the Orientation enum to its own LibDraw header file.Andreas Kling
2019-07-20Thread: Cleanup m_blocker handlingRobin Burchell
The only two places we set m_blocker now are Thread::set_state(), and Thread::block(). set_state is mostly just an issue of clarity: we don't want to end up with state() != Blocked with an m_blocker, because that's weird. It's also possible: if we yield, someone else may set_state() us. We also now set_state() and set m_blocker under lock in block(), rather than unlocking which might allow someone else to mess with our internals while we're in the process of trying to block. This seems to fix sending STOP & CONT causing a panic. My guess as to what was happening is this: thread A blocks in select(): Blocking & m_blocker != nullptr thread B sends SIGSTOP: Stopped & m_blocker != nullptr thread B sends SIGCONT: we continue execution. Runnable & m_blocker != nullptr thread A tries to block in select() again: * sets m_blocker * unlocks (in block_helper) * someone else tries to unblock us? maybe from the old m_blocker? unclear -- clears m_blocker * sets Blocked (while unlocked!) So, thread A is left with state Blocked & m_blocker == nullptr, leading to the scheduler assert (m_blocker != nullptr) failing. Long story short, let's do all our data management with the lock _held_.
2019-07-20CEventLoop: Use Vector::prepend(Vector&&) to shuffle events to outer loop.Andreas Kling
When exiting a nested event loop, we prepend any unprocessed events to the outer loop's event queue.
2019-07-20AK: Add Vector::prepend(Vector&&).Andreas Kling
Also included a good boy unit test.
2019-07-20CEventLoop: Remove some no-longer-used virtuals.Andreas Kling
2019-07-20Finalizer: Don't double-yieldRobin Burchell
Block will yield for us, so there's no reason to return control to the scheduler immediately after we just blocked.
2019-07-20Net: Merge Thread::wait_for_connect into LocalSocket (as the only place that ↵Robin Burchell
uses it) Also do this more like other blockers, don't call yield ourselves, as block will do that for us.
2019-07-20Thread: Return a result from block() indicating why the block terminatedRobin Burchell
And use this to return EINTR in various places; some of which we were not handling properly before. This might expose a few bugs in userspace, but should be more compatible with other POSIX systems, and is certainly a little cleaner.
2019-07-20SharedBuffer: Amend commit 2d4d465206dRobin Burchell
I had the right cause of the SharedBuffer leak, but goofed the fix by desynching the per-pid refcount and the global refcount. Fix that, and add a generous sprinkle of asserts to make sure the two stay in sync. Fixes #341 (... for real this time)
2019-07-19Shell: Implement support for terminal clearing with ^L.Andreas Kling
Make LineEditor::get_line() responsible for printing the prompt. That way we can re-prompt after clearing the screen on ^L. This makes the Serenity Terminal feel a little bit more like home :^)
2019-07-19SharedBuffer: Fix a denial of serviceRobin Burchell
It's a very bad idea to increment the refcount on behalf of another process. That process may (for either benign or evil reasons) not reference the SharedBuffer, and then we'll be stuck with loads of SharedBuffers until we OOM. Instead, increment the refcount when the buffer is mapped. That way, a buffer is only kept if *someone* has explicitly requested it via get_shared_buffer. Fixes #341
2019-07-19Kernel: Share the "return to ring 0/3 from signal" trampolines globally.Andreas Kling
Generate a special page containing the "return from signal" trampoline code on startup and then route signalled threads to it. This avoids a page allocation in every process that ever receives a signal.
2019-07-19Kernel: Remove accidental use of removed Region::set_user_accessible().Andreas Kling
2019-07-19Kernel: Track user accessibility per Region.Andreas Kling
Region now has is_user_accessible(), which informs the memory manager how to map these pages. Previously, we were just passing a "bool user_allowed" to various functions and I'm not at all sure that any of that was correct. All the Region constructors are now hidden, and you must go through one of these helpers to construct a region: - Region::create_user_accessible(...) - Region::create_kernel_only(...) That ensures that we don't accidentally create a Region without specifying user accessibility. :^)
2019-07-19Thread: Fix a regression introduced in 80a6df90220981e64e0ca192908163d3a263ffc6Robin Burchell
Accidentally forgot to check the state parameter, which made this rather useless. Bug found, and cause identified by Andreas
2019-07-19AK: Introduce IntrusiveListRobin Burchell
And use it in the scheduler. IntrusiveList is similar to InlineLinkedList, except that rather than making assertions about the type (and requiring inheritance), it provides an IntrusiveListNode type that can be used to put an instance into many different lists at once. As a proof of concept, port the scheduler over to use it. The only downside here is that the "list" global needs to know the position of the IntrusiveListNode member, so we have to position things a little awkwardly to make that happen. We also move the runnable lists to Thread, to avoid having to publicize the node.
2019-07-19Kernel: Make the Thread::FileDescriptionBlocker constructor protected.Andreas Kling
Nobody should ever construct one of these directly.
2019-07-19Kernel: Some small refinements to the thread blockers.Andreas Kling
Committing some things my hands did while browsing through this code. - Mark all leaf classes "final". - FileDescriptionBlocker now stores a NonnullRefPtr<FileDescription>. - FileDescriptionBlocker::blocked_description() now returns a reference. - ConditionBlocker takes a Function&&.
2019-07-19Thread: More composition in for_each :)Robin Burchell
2019-07-19Scheduler: Remove some raw use of the runnable listsRobin Burchell
2019-07-19Process: Now that Thread::for_each are composable, we can reuse them rather ↵Robin Burchell
than rewriting them This avoids exposing the runnable lists to Process.
2019-07-19Thread: Normalize all for_each constructs to use IterationDecisionRobin Burchell
This way a caller can abort the for_each early if they want.
2019-07-19Kernel: Only allow superuser to halt() the system (#342)Jesse
Following the discussion in #334, shutdown must also have root-only run permissions.
2019-07-19Kernel: Remove memory allocations from the new Blocker APIRobin Burchell
2019-07-19Kernel: Remove old block(State) APIRobin Burchell
New API should be used always :)