summaryrefslogtreecommitdiff
path: root/Libraries/LibCore
AgeCommit message (Collapse)Author
2020-02-14LibCore: Add a forward declaration headerAndreas Kling
This patch adds <LibCore/Forward.h> and uses it in various places to shrink the header dependency graph.
2020-02-14LibCore: Add Core::MimeData classAndreas Kling
This object contains zero or more { mime_type, data } entries and will be used for clipboard data as well as drag & drop.
2020-02-12LibCore: Add "static bool Core::File::exists(filename)"Andreas Kling
2020-02-11LibCore: Add DateTime::from_timestamp(time_t)Andreas Kling
2020-02-11LibCore: Add a basic Core::DateTime classAndreas Kling
This is just to have a pleasant way to print the current time for now: dbg() << Core::DateTime::now(); Or if you want it as a string: Core::DateTime::now().to_string();
2020-02-10LibCore: TCP and UDP servers should parent Notifiers to themselvesAndreas Kling
This makes things look a little more neat in Inspector. :^)
2020-02-10AK: Remove bitrotted Traits::dump() mechanismAndreas Kling
This was only used by HashTable::dump() which I used when doing the first HashTable implementation. Removing this allows us to also remove most includes of <AK/kstdio.h>.
2020-02-09LibCore: Add File::is_directory() helpersAndreas Kling
2020-02-09LibCore: Allow constructing a Core::HttpRequest from a raw HTTP requestAndreas Kling
This patch adds a very simple HTTP request parser that can be useful for implementing say.. a web server. :^)
2020-02-06LibCore: Merge the CSyscallUtils namespace into CoreAndreas Kling
2020-02-06LibCore: Remove leading C from filenamesAndreas Kling
2020-02-06LibGfx: Rename from LibDraw :^)Andreas Kling
2020-02-05LibCore: CEventLoop: If timeval_sub makes tv_sec negative, use 0joshua stein
2020-02-05LibCore: Fix building with clangjoshua stein
2020-02-02LibCore: Put all classes in the Core namespace and remove the leading CAndreas Kling
I've been wanting to do this for a long time. It's time we start being consistent about how this stuff works. The new convention is: - "LibFoo" is a userspace library that provides the "Foo" namespace. That's it :^) This was pretty tedious to convert and I didn't even start on LibGUI yet. But it's coming up next.
2020-02-02LibGUI: Make GAction scoped to its CObject parent (widget or window)Andreas Kling
Unparented GActions are still parented to the application like before, making them globally available. This makes it possible to have actions that work whenever a specific window is active, no matter which widget is currently focused. :^)
2020-02-02LibCore: is<CObject>(object) should not default to trueAndreas Kling
Otherwise we'll lie about anything that doesn't implement is<T>() and think it's indeed a T.
2020-02-01LibCore: Fix CArgsParser build on my host machineAndreas Kling
2020-01-28LibCore: Rewrite CArgsParserSergey Bugaev
This is a complete reimplementation of CArgsParser with a different API. Now, CArgsParser properly supports and distinguishes between: * Positional arguments (required or not) * Options Options can be short and/or long. The API allows you to add custom option and argument types. A few types are pre-implemented for convenience: * Boolean options (take no value) * String and integer options (take a required value) * String and integer arguments * Vector-of-string arguments This commit doesn't include changes for all the users of CArgsParser (see next commit for that).
2020-01-26LibCore: Add UDP socket and server classesAndreas Kling
2020-01-26LibCore: CSocket::set_blocking() was backwardsAndreas Kling
2020-01-25Meta: Remove some copyright headers added in errorAndreas Kling
2020-01-23LibCore: Remove redundant check in CObject::dispatch_event()Andreas Kling
2020-01-21LibCore: Fix broken "stay_within" mechanism in event dispatchAndreas Kling
The "stay_within" parameter to CObject::dispatch_event() optionally specifies a node in the CObject parent chain where event dispatch should stop bubbling upwards. Since event dispatch is done recursively, this was not working right, as we would simply return from the innermost dispatch loop, leaving the event un-accepted, which meant that the penultimately inner dispatch loop would pick up the event and keep bubbling it anyway. This made it possible for events to jump across window boundaries within an application, in cases where one window was a CObject ancestor of another window. This is typically the case with dialog windows. Fix #1078.
2020-01-21SystemMonitor: Show process unveil() state as "Veil"Andreas Kling
A process has one of three veil states: - None: unveil() has never been called. - Dropped: unveil() has been called, and can be called again. - Locked: unveil() has been called, and cannot be called again.
2020-01-18Meta: Add license header to source filesAndreas Kling
As suggested by Joshua, this commit adds the 2-clause BSD license as a comment block to the top of every source file. For the first pass, I've just added myself for simplicity. I encourage everyone to add themselves as copyright holders of any file they've added or modified in some significant way. If I've added myself in error somewhere, feel free to replace it with the appropriate copyright holder instead. Going forward, all new source files should include a license header.
2020-01-17LibCore: Make CIODevice::read_all() actually read all dataSergey Bugaev
It used to only read the data it could get without blocking. Andreas says this was intentional, but it's counterintuitive and no code that uses read_all() actually expects it to return only a part of the data. So change it to always read data until an EOF (or an error) is received.
2020-01-13LibCore: Fix segfault in CArgsParser (#1072)DrewStratford
CArgsParser::parse_next_param did not properly ensure that, when a param required a following argument, there were enough parameters left to complete the parse. This meant that params_left could become negative, avoiding parse_next_param's termination condition, and cause a segfault when reading from argv with an out of bounds index. This fixes the check to ensure that we do in fact have the right amount of parameters and also adds an assertion to ensure that params_left does not become negative.
2020-01-11SystemMonitor+LibCore: Show process pledges in SystemMonitor :^)Andreas Kling
2020-01-07LibCore: Fix a typo in CConfigFile.hConrad Pankoff
2020-01-05LibCore: Oops, we were forgetting to destroy disconnected RPC clientsAndreas Kling
2020-01-05AK+LibCore: Add an IDAllocator and use to allocate timer idsShannon Booth
2020-01-03LibCore: Fix crash on RPC client disconnectAndreas Kling
The RPC client management was not updated for the changes that made CObject reference-counted it seems. :^)
2020-01-03LibCore: Stop making the RPC sockets go=rwAndreas Kling
Now that we can fchmod() on a pre-bind() socket, use that to lock down the RPC sockets we publish in all CEventLoop-driven programs.
2020-01-02LibCore: CSocketAddress: pull in netinet/in.hjoshua stein
2019-12-30Kernel: Refactor scheduler to use dynamic thread prioritiesAndreas Kling
Threads now have numeric priorities with a base priority in the 1-99 range. Whenever a runnable thread is *not* scheduled, its effective priority is incremented by 1. This is tracked in Thread::m_extra_priority. The effective priority of a thread is m_priority + m_extra_priority. When a runnable thread *is* scheduled, its m_extra_priority is reset to zero and the effective priority returns to base. This means that lower-priority threads will always eventually get scheduled to run, once its effective priority becomes high enough to exceed the base priority of threads "above" it. The previous values for ThreadPriority (Low, Normal and High) are now replaced as follows: Low -> 10 Normal -> 30 High -> 50 In other words, it will take 20 ticks for a "Low" priority thread to get to "Normal" effective priority, and another 20 to reach "High". This is not perfect, and I've used some quite naive data structures, but I think the mechanism will allow us to build various new and interesting optimizations, and we can figure out better data structures later on. :^)
2019-12-30LibCore: Use JsonObject::get_ptr() in CProcessStatisticsReaderAndreas Kling
This removes a bunch of JsonValue copying from the hot path in thread statistics fetching. Also pre-size the thread statistics vector since we know the final size up front. :^)
2019-12-29LibCore+LibGUI: Don't fire timers in non-visible windows by defaultAndreas Kling
LibCore timers now have a TimerShouldFireWhenNotVisible flag which is set to "No" by default. If "No", the timer will not be fired by the event loop if it's within a CObject tree whose nearest GWindow ancestor is currently not visible for timer purposes. (Specificially, this means that the window is either minimized or fully occluded, and so does not want to fire timers just to update the UI.) This is another nice step towards a calm and serene operating system.
2019-12-29Kernel+SystemMonitor: Expose amount of per-process clean inode memoryAndreas Kling
This is memory that's loaded from an inode (file) but not modified in memory, so still identical to what's on disk. This kind of memory can be freed and reloaded transparently from disk if needed.
2019-12-29Kernel+SystemMonitor: Expose amount of per-process dirty private memoryAndreas Kling
Dirty private memory is all memory in non-inode-backed mappings that's process-private, meaning it's not shared with any other process. This patch exposes that number via SystemMonitor, giving us an idea of how much memory each process is responsible for all on its own.
2019-12-27LibCore: Allow LibCore to be compiled on macOS hostStefano Cristiano
Compiling LibCore on macOS is needed if one wants to compile host tools
(like IPCCompiler) on a non Linux host.
These changes could be possibly reverted once "event loop" functionality
and "base library" (Vector, String etc.) will be split in two separate libraries, updating all relevant projects.
2019-12-27LibCore: Fix errors when compiling LibCore using clang instead of gccStefano Cristiano
2019-12-25LibCore: compile puff.c as a separate objectjoshua stein
2019-12-23WindowServer+LibGUI: Implement basic color themingAndreas Kling
Color themes are loaded from .ini files in /res/themes/ The theme can be switched from the "Themes" section in the system menu. The basic mechanism is that WindowServer broadcasts a SharedBuffer with all of the color values of the current theme. Clients receive this with the response to their initial WindowServer::Greet handshake. When the theme is changed, WindowServer tells everyone by sending out an UpdateSystemTheme message with a new SharedBuffer to use. This does feel somewhat bloated somehow, but I'm sure we can iterate on it over time and improve things. To get one of the theme colors, use the Color(SystemColor) constructor: painter.fill_rect(rect, SystemColor::HoverHighlight); Some things don't work 100% right without a reboot. Specifically, when constructing a GWidget, it will set its own background and foreground colors based on the current SystemColor::Window and SystemColor::Text. The widget is then stuck with these values, and they don't update on system theme change, only on app restart. All in all though, this is pretty cool. Merry Christmas! :^)
2019-12-20Build: clean up build system, use one shared Makefilejoshua stein
Allow everything to be built from the top level directory with just 'make', cleaned with 'make clean', and installed with 'make install'. Also support these in any particular subdirectory. Specifying 'make VERBOSE=1' will print each ld/g++/etc. command as it runs. Kernel and early host tools (IPCCompiler, etc.) are built as object.host.o so that they don't conflict with other things built with the cross-compiler.
2019-12-14LibCore: Silence some aggressive CSocket and CHttpJob debug spamAndreas Kling
2019-12-14LibCore: Bump the CHttpJob receive buffer size from 4KB to 64KBAndreas Kling
4KB gets pretty mmap/munmap heavy when downloading larger files, so bump this a bit to reduce time spent in memory allocation. This can be improved in various ways, but I'm not sure what the best way forward is at the moment.
2019-12-10LibCore: Make CHttpJob::response() return a CHttpResponse*Andreas Kling
We know that the CNetworkResponse inside a CHttpJob is always going to be a CHttpResponse, so we can return a casted pointer to be nice. :^)
2019-12-09SystemMonitor: Show information about purgeable memoryAndreas Kling
This patch exposes some fields about purgeable memory regions. We now also show total purgeable volatile and non-volatile memory in the big process table.
2019-12-09AK: Use size_t for the length of stringsAndreas Kling
Using int was a mistake. This patch changes String, StringImpl, StringView and StringBuilder to use size_t instead of int for lengths. Obviously a lot of code needs to change as a result of this.