Commit Graph

200 Commits

Author SHA1 Message Date
Sam Atkins
0c24522635 LibGUI+Everywhere: Use fallible Window::set_main_widget() everywhere :^)
Rip that bandaid off!

This does the following, in one big, awkward jump:
- Replace all uses of `set_main_widget<Foo>()` with the `try` version.
- Remove `set_main_widget<Foo>()`.
- Rename the `try` version to just be `set_main_widget` because it's now
  the only one.

The majority of places that call `set_main_widget<Foo>()` are inside
constructors, so this unfortunately gives us a big batch of new
`release_value_but_fixme_should_propagate_errors()` calls.
2023-01-06 13:36:02 -07:00
MacDue
a1726b1ba5 LibGfx: Avoid rounding/truncating glyph positions till blitting
This keeps some overloads that accept ints to avoid adding calls to
.to_type<float>() all over the place.
2023-01-05 12:09:35 +01:00
John Bundgaard
badfe72b64 SystemMonitor: Update stats/graph immediately on launch
Previously the stats was only updated once the first callback from
refresh_timer fired.

It now makes an early stats update on launch, so something will appear
in the graphs.
2023-01-05 00:12:29 +01:00
Ben Wiederhake
6b7ce19161 Everywhere: Remove unused includes of LibC/stdlib.h
These instances were detected by searching for files that include
stdlib.h, but don't match the regex:

\\b(_abort|abort|abs|aligned_alloc|arc4random|arc4random_buf|arc4random_
uniform|atexit|atof|atoi|atol|atoll|bsearch|calloc|clearenv|div|div_t|ex
it|_Exit|EXIT_FAILURE|EXIT_SUCCESS|free|getenv|getprogname|grantpt|labs|
ldiv|ldiv_t|llabs|lldiv|lldiv_t|malloc|malloc_good_size|malloc_size|mble
n|mbstowcs|mbtowc|mkdtemp|mkstemp|mkstemps|mktemp|posix_memalign|posix_o
penpt|ptsname|ptsname_r|putenv|qsort|qsort_r|rand|RAND_MAX|random|reallo
c|realpath|secure_getenv|serenity_dump_malloc_stats|serenity_setenv|sete
nv|setprogname|srand|srandom|strtod|strtof|strtol|strtold|strtoll|strtou
l|strtoull|system|unlockpt|unsetenv|wcstombs|wctomb)\\b

(Without the linebreaks.)

This regex is pessimistic, so there might be more files that don't
actually use anything from the stdlib.

In theory, one might use LibCPP to detect things like this
automatically, but let's do this one step after another.
2023-01-02 20:27:20 -05:00
Keir Davis
4a0af3dc77 SystemMonitor: Propagate errors when trying to load an icon 2022-12-17 19:20:21 +00:00
Lucas CHOLLET
2693745336 LibThreading+Everywhere: Support returning error from BackgroundAction
This patch allows returning an `Error` from the `on_complete` callback
in `BackgroundAction`.

It also adds a custom callback to manage errors returned during its
execution.
2022-12-15 17:36:57 +00:00
Tim Schumacher
ed4c2f2f8e LibCore: Rename Stream::read_all to read_until_eof
This generally seems like a better name, especially if we somehow also
need a better name for "read the entire buffer, but not the entire file"
somewhere down the line.
2022-12-12 14:16:42 +01:00
Tim Schumacher
8940f2da7f LibCore: Use Core::Stream for ProcessStatisticsReader 2022-12-10 11:49:24 +00:00
Linus Groh
57dc179b1f Everywhere: Rename to_{string => deprecated_string}() where applicable
This will make it easier to support both string types at the same time
while we convert code, and tracking down remaining uses.

One big exception is Value::to_string() in LibJS, where the name is
dictated by the ToString AO.
2022-12-06 08:54:33 +01:00
Linus Groh
6e19ab2bbc AK+Everywhere: Rename String to DeprecatedString
We have a new, improved string type coming up in AK (OOM aware, no null
state), and while it's going to use UTF-8, the name UTF8String is a
mouthful - so let's free up the String name by renaming the existing
class.
Making the old one have an annoying name will hopefully also help with
quick adoption :^)
2022-12-06 08:54:33 +01:00
Maciej
c90024fbab SystemMonitor: Add context menu for opening adapter in NetworkSettings 2022-11-02 12:00:26 +00:00
Maciej
f4a5cd63bb SystemMonitor: Add Command column to ProcessModel
This column shows full command line of a process, or empty line if an
error occures when reading it. The command is not escaped for now.
2022-11-02 12:00:26 +00:00
Tim Schumacher
ce2f1b845f Everywhere: Mark dependencies of most targets as PRIVATE
Otherwise, we end up propagating those dependencies into targets that
link against that library, which creates unnecessary link-time
dependencies.

Also included are changes to readd now missing dependencies to tools
that actually need them.
2022-11-01 14:49:09 +00:00
Liav A
5dfb2b18f3 Applications: Use new global variables at /sys/kernel/ directory 2022-10-25 15:33:34 -06:00
demostanis
34acae90c7 Userland: Let applications make use of make_command_palette_action() 2022-10-25 10:21:18 +01:00
Liav A
5b3980b040 Userland: Utilize MS_NOREGULAR mount flag
For SystemServer, we simply ensure that the /dev mount is now mounted
with MS_NOREGULAR flag to ensure only non-regular files are created,
thus, achieving what DevTmpFS provided in its implementation, but in a
much more sane and clean way than how DevTmpFS did that.

For other userland applications, we simply make them being aware of this
flag so they can show an indication about this flag being used to the
user.
2022-10-22 19:18:15 +02:00
Ali Mohammad Pur
166a905951 Userland: Properly populate GENERATED_SOURCES
We previously put the generated headers in SOURCES, which did not mark
them as GENERATED (and did not produce a proper dependency).
This commit moves all generated headers into GENERATED_SOURCES, and
removes useless header SOURCES.
2022-10-12 15:55:15 +01:00
Orel
d8474805e8 SystemMonitor: Save configuration of columns
Save the columns configuration from the last run in the respective
config file, and add a function to check whether a column should be
visible by default.
2022-09-21 10:14:40 +01:00
Liav A
0eaee045cf SystemMonitor: Don't unveil /boot/Kernel.debug if it does not exist
If the user decided for some reason to not include Kernel debug symbols
in the disk image, let's not try to unveil it.
2022-08-21 10:54:40 +01:00
Andreas Kling
24956ba65d SystemMonitor: Add some margin around widgets in the process inspector 2022-08-14 23:33:28 +02:00
Andreas Kling
511ccc3e36 SystemMonitor: Make process name appear in the process inspector again
This regressed with the UI layout system changes.
2022-08-14 23:33:28 +02:00
Liav A
488f22941b SystemMonitor: Remove GML references to the deleted Hardware tab 2022-08-12 12:24:40 +02:00
Liav A
889b9d029e SystemMonitor: Remove the Hardware tab
This will allow us to essentially remove /proc/pci node for good, as
well as to create a better GUI application to contain PCI information
with other system hardware info too.
2022-07-30 23:29:07 +02:00
David Smith
9ca580aac6 SystemMonitor: Keep selected row in ProcessMemoryMapWidget
The process memory view loses the selected row when it's redrawn. Call
update() instead of invalidate() to fix this.
2022-07-24 14:05:35 +01:00
Liav A
e4e5fa74d0 Kernel+Userland: Rename prefix of user_physical => physical
There's no such supervisor pages concept, so there's no need to call
physical pages with the "user_physical" prefix anymore.
2022-07-14 23:27:46 +02:00
Liav A
1c499e75bd Kernel+Userland: Remove supervisor pages concept
There's no real value in separating physical pages to supervisor and
user types, so let's remove the concept and just let everyone to use
"user" physical pages which can be allocated from any PhysicalRegion
we want to use. Later on, we will remove the "user" prefix as this
prefix is not needed anymore.
2022-07-14 23:27:46 +02:00
sin-ack
c8585b77d2 Everywhere: Replace single-char StringView op. arguments with chars
This prevents us from needing a sv suffix, and potentially reduces the
need to run generic code for a single character (as contains,
starts_with, ends_with etc. for a char will be just a length and
equality check).

No functional changes.
2022-07-12 23:11:35 +02:00
sin-ack
3f3f45580a Everywhere: Add sv suffix to strings relying on StringView(char const*)
Each of these strings would previously rely on StringView's char const*
constructor overload, which would call __builtin_strlen on the string.
Since we now have operator ""sv, we can replace these with much simpler
versions. This opens the door to being able to remove
StringView(char const*).

No functional changes.
2022-07-12 23:11:35 +02:00
Tim Schumacher
5efa8e507b Kernel: Implement an axallowed mount option
Similar to `W^X` and `wxallowed`, this allows for anonymous executable
mappings.
2022-07-08 22:27:38 +00:00
MacDue
5fd5a03d1f Applications: Use spawn_or_show_error() for common spawn pattern 2022-06-03 12:29:56 +01:00
Linus Groh
173dcfb7cb Everywhere: Fix a bunch of typos 2022-05-29 15:22:00 +02:00
Sam Atkins
cdffe556c8 LibGUI+Userland: Make Dialog::ExecResult an enum class 2022-05-13 16:27:43 +02:00
Luke Wilde
caf652799f SystemMonitor: Consistently use u64 for ValueFormat::text_formatter
ValueFormat::text_formatter is called with a u64 retrieved from
GraphWidget::m_values. However, the function pointer definition used
size_t and all the users of text_formatter used int.  If bytes was over
~2 billion, we would interpret bytes to be negative. We then pass this
into `human_readable_size` which converts it to a u64, making it out to
be about 15.9 EiB.

This is fixed by making everything in the path take a u64.
2022-05-05 21:25:04 +02:00
Jelle Raaijmakers
f25123df66 LibCore: Remove main event loop
The main event loop functionality was used in just two places where the
alternative is a bit simpler. Remove it in favor of referencing the
event loop directly, or just invoking `EventLoop::current()`.

Note that we don't need locking in the constructor since we're now only
modifying a thread-local `Vector`. We also don't need locking in the
old call sites to `::with_main_locked()` since we already lock the
event loop in the subsequent `::post_event()` invocation.
2022-04-27 11:54:37 +02:00
Sam Atkins
cd7037afd5 SystemMonitor: Remove MakeInspectable::Yes from constructor
I think this was left in by mistake. No application should be hard-coded
as inspectable.
2022-04-18 12:57:34 +02:00
Simon Wanner
206d6ece55 LibGfx: Move other font-related files to LibGfx/Font/ 2022-04-09 23:48:18 +02:00
kleines Filmröllchen
8545e2dec0 SystemMonitor: Default initialize all thread state variables
Having bogus values here when we just initialize the thread state with a
process can lead to all sorts of bad things down the line, like infinite
draws.
2022-04-06 22:41:54 +02:00
kleines Filmröllchen
bafaff61c9 SystemMonitor: Fallback to invalid model index if there's no main thread
In the process model we check the thread with tid=pid to figure out the
main thread of a process. This is used to construct the process view
tree with non-main threads listed as children of the process row.
However, there are sometimes circumstances where there is no main
thread, even though the process should have been removed from the
internal list by then. As a safe fallback, let's default to an invalid
model index if we can't figure out what the main thread of a process is.
2022-04-06 22:41:54 +02:00
kleines Filmröllchen
600596fbae SystemMonitor: Keep current process selection expanded if needed
This is a hack until persistent model indices work.
2022-04-06 12:47:50 +02:00
kleines Filmröllchen
0a61b45b64 SystemMonitor: Display processes and their threads in a tree :^)
This shows all non-main threads as children of the process they belong
to. We also show the TID as that is important to distinguish the
different threads in one process.

Fixes #65

:skeleyak:
2022-04-06 12:47:50 +02:00
kleines Filmröllchen
0e71c6a7de SystemMonitor: Pass the correct parent when checking for selected values
This will cause trouble later when the row is not enough to identify a
selection.
2022-04-06 12:47:50 +02:00
kleines Filmröllchen
9df21a1385 SystemMonitor: Move TID to the front in ProcessModel
This will look much nicer once we enable that column.
2022-04-06 12:47:50 +02:00
Linus Groh
0f27432ec6 Kernel+SystemMonitor+lscpu: Rename 'CPUID' -> 'Vendor ID'
This is what the Intel manual, as well as Linux's cpuinfo calls it.
2022-04-03 23:20:33 +02:00
kleines Filmröllchen
7af87e8e6b SystemMonitor: Move process window to GML
Extra stuff done in this commit to facilitate the above (if you want to
really push my commit count, ask for more atomicisation):
- Register a bunch of widgets that are used in the process window.
- Allow setting the pid after the fact for the process state widget.
2022-04-03 12:21:05 +02:00
kleines Filmröllchen
ee4cec4ea9 SystemMonitor: Open PCI database in parallel
This was causing a bunch of lag (at least half a second, very
noticeable) when first opening the hardware tab, as we would only load
the PCI database when initializing the widget lazily. By starting the
PCI database open on another thread, we avoid this entirely, as nobody
can click the hardware tab this fast :^)
2022-04-03 12:21:05 +02:00
kleines Filmröllchen
81d5e93b92 SystemMonitor: Move storage tab into custom widget 2022-04-03 12:21:05 +02:00
kleines Filmröllchen
99005ca90f SystemMonitor: Move hardware tab to custom widget
This is just a LazyWidget with fancy initialization code that works
perfectly in isolation.
2022-04-03 12:21:05 +02:00
kleines Filmröllchen
5a2716baea SystemMonitor: Move entire main UI to GML
:^)
2022-04-03 12:21:05 +02:00
kleines Filmröllchen
98ed18124d SystemMonitor: Register GraphWidget's stack_values property 2022-04-03 12:21:05 +02:00
kleines Filmröllchen
a7d9d416d5 SystemMonitor: Register a graph_widget pseudo-property in MemoryStatsW
The property graph_widget on MemoryStatsWidget is a-pseudo property that
specifies the name of the graph widget which should be attached to the
MemoryStatsWidget. When the property is set, the widget looks up the
graph with that name in its parent, therefore automatically linking to
the correct widget given that it's a sibling or descendant of a sibling.
2022-04-03 12:21:05 +02:00