Commit Graph

309 Commits

Author SHA1 Message Date
Bui Quang Minh
ec063f4f63 HackStudio: Add language client check in identifier click 2021-03-09 07:54:30 +01:00
Ben Wiederhake
1e857de263 UserspaceEmulator: Support munmap/mprotect with partial mappings
Fixes #5663.
2021-03-08 22:57:36 +01:00
Ben Wiederhake
45443f24ec UserspaceEmulator: Enable splitting regions at arbitrary points
This is not yet useful in and of itself, but enables the feature in the next commit.
2021-03-08 22:57:36 +01:00
Ben Wiederhake
7cc8f20a30 UserspaceEmulator: Convert backing storage from malloc to mmap
This saves a few bytes for each guest-mmaped region, especially since these are likely to be page-aligned.
2021-03-08 22:57:36 +01:00
Emanuele Torre
1f81bc6879 Everywhere: Remove unnecessary whitespace at the end of some lines. 2021-03-08 09:20:53 +01:00
Itamar
cfa100cb65 HackStudio: Restart LanguageServer if it crashes
We now restart the language server transparently if it crashes.
If the language server crashes too frequently (current threshold is
twice within 3 seconds), we give up and will not attempt to restart it
again. HackStudio will still work fine, but features that depend on the
language server will not function.

To support this change we use a new class, 'ServerConnectionWrapper',
that holds the actual ServerConnection and is responsible for restarting
the language-server if it crashes.

Closes #5574.
2021-03-06 09:40:33 +01:00
Itamar
4223f03b2b LanguageServers: Support calling SetFileContent with not-yet open files
Also, use dbgln_if
2021-03-06 09:40:33 +01:00
Itamar
6f7ef4ec65 LanguageServers: Tweak FileDB API
- FileDB::get() now returns nullptr if the file is not in the FileDB
- Added FileDB::get_or_create_from_filesystem()
- Added FileDB::add() version that receives that file's content as a
parameter
2021-03-06 09:40:33 +01:00
Itamar
684cc5f027 HackStudio: Add ProjectFile::create_if_needed 2021-03-06 09:40:33 +01:00
Itamar
ba6cbf160b HackStudio: Create Language enum from file extension or language name 2021-03-06 09:40:33 +01:00
Itamar
1edaefca3a HackStudio: Remove redundant null check when creating a new project file
Project::get_file returns a NonNullRefPtr
2021-03-06 09:40:33 +01:00
Itamar
fa4d9da237 HackStudio: Make sure project files are created with an absolute path
This fixes an issue were "Find in Files" would not use the up-to-date
content of a file with unsaved changes.

The issue existed because 'FindInFilesWidget' uses
Project::for_each_text_file, which retrieves files by their absolute
path. However, when a file is opened in an Editor, it is created with
a relative path.

This caused us to store two ProjectFile objects that refer to the same
file - one with a relative path and one with an absolute path.
2021-03-06 09:40:33 +01:00
Itamar
74070ef74d HackStudio: Map connections to langauge-servers by language name
HackStudio keeps a map that stores the different ServerConnection
instances we have open.

Previously, that map was indexed by a project's root path.
This did not make much sense because we only support opening a single
project with each instance of the HackStudio program.

We now index the different ServerConnections by the language name, which
allows us to support talking to multiple language-servers in the same
project (e.g C++ and Shell).

This also fixes an issue where if you first opened a Shell file, and
then a C++ file in the same project, then C++ language-server features
would not work.
2021-03-06 09:40:33 +01:00
Itamar
3f0ace6670 LanguageServers/Cpp: Allow the creation of DocumentData objects to fail
This fixes langauge-server crashes when trying to parse non-existant
header files, such as #include <new>.
Closes #5569.
2021-03-06 09:40:33 +01:00
Linus Groh
50ea0c3500 Profiler: Get perfcore file from ArgsParser
Fixes #5641.
2021-03-05 09:52:22 +01:00
Andreas Kling
1208fc7d37 AK: Simplify Bitmap and implement in terms of BitmapView
Add Bitmap::view() and forward most of the calls to BitmapView since
the code was identical.

Bitmap is now primarily concerned with its dynamically allocated
backing store and BitmapView deals with the rest.
2021-03-04 11:25:45 +01:00
AnotherTest
e59a631511 HackStudio/LanguageServers: Move some components out of Cpp
This makes them available for use by other language servers.
Also as a bonus, update the Shell language server to discover some
symbols and add go-to-definition functionality :^)
2021-03-04 11:21:43 +01:00
Andreas Kling
373a595c56 Profiler: Symbolicate addresses in non-PIE ELF objects
This is a little bit messy, but basically if an ELF object is non-PIE,
we have to account for the executable mapping being at a hard-coded
offset and subtract that when doing symbolication.

There's probably a nicer way to solve this, I just hacked this together
so we can see "cc1plus" and friends in profiles. :^)
2021-03-03 23:13:26 +01:00
Andreas Kling
0fc3983c8d Profiler: Cache and reuse mapped ELF objects
In multi-process profiles, the same ELF objects tend to occur many
times (everyone has libc.so for example) so we will quickly run out
of VM if we map each object once per process that uses it.

Fix this by adding a "mapped object cache" that maps the path of
an ELF object to a cached memory mapping and wrapping ELF::Image.
2021-03-03 22:57:45 +01:00
Bui Quang Minh
faed0e63dc HackStudio: Allow multi-selection in project view tree 2021-03-03 21:59:22 +01:00
Andreas Kling
5e7abea31e Kernel+Profiler: Capture metadata about all profiled processes
The perfcore file format was previously limited to a single process
since the pid/executable/regions data was top-level in the JSON.

This patch moves the process-specific data into a top-level array
named "processes" and we now add entries for each process that has
been sampled during the profile run.

This makes it possible to see samples from multiple threads when
viewing a perfcore file with Profiler. This is extremely cool! :^)
2021-03-02 22:38:06 +01:00
Bui Quang Minh
ee7c8fbd7b HackStudio: Implement removing file from disk 2021-03-02 14:45:18 +01:00
Itamar
05c48cc8d8 LanguageServers/Cpp: Fix nullptr dereference in ~LanguageClient
The WeakPtr to the ServerConnection is nullified if the server crashes.

Closes #5570.
2021-03-02 13:37:26 +01:00
Itamar
17e6287333 LanguageServers/Cpp: Fix typo 2021-03-02 12:50:37 +01:00
Brian Gianforcaro
007b6edce4 Profiler: Print addresses as pointers in new Samples view
The previous formatting was missing the "0x" prefix.
2021-03-01 11:12:53 +01:00
thislooksfun
225baa3cb7 Profiler: remove unimplemented Profile::LibraryMetadata::symbolicate() definition
The implementation of Profile::LibraryMetadata::symbolicate() was
removed in 340180ba05, but the
corresponding public declaration was not.
2021-02-28 15:28:08 +01:00
Andreas Kling
1fb1279cfd Profiler: Add a new "Samples" view to the main UI
You can now view the individual samples in a profile one by one with
the new "Samples" view. The "old" main view moves into a "Call Tree"
tab (but it remains the default view.)

When you select a sample in the samples view, we show you the full
symbolicated backtrace in a separate view on the right hand side. :^)
2021-02-27 18:34:21 +01:00
Andreas Kling
2c1f71055f LibVT: Put TerminalWidget in the VT namespace :^) 2021-02-27 17:49:08 +01:00
Andreas Kling
340180ba05 Profiler: Move ELF object name to its own profile graph column
This way you don't have to look at all the library names if you don't
want to. Since we're pretty good about namespacing our things, the
library names are slightly redundant information.
2021-02-27 17:45:41 +01:00
Andreas Kling
2f0ea9ae33 Profiler: Unbreak DisassemblyModel after shared library introduction
This was failing to take the library base address into account when
tallying up the samples at each instruction.
2021-02-27 17:26:57 +01:00
Itamar
54bc9114b3 HackStudio: Support searching symbol declarations in the Locator
The Locator now keeps a cache of the declared symbol in a document.
The language client updates that cache whenever it gets an update from
the language server about declared symbols.

This allows searching for symbol declarations in the Locator, in
addition to file names.

Closes #5478
2021-02-27 16:37:35 +01:00
Itamar
a94b5376bc LanguageServers/Cpp: Update client asynchronously about symbols
As a document is parsed, the language server updates the client
asynchronously about symbol declarations it finds.
2021-02-27 16:37:35 +01:00
Itamar
71c7597130 LanguageServers/Cpp: Add type to Declarations 2021-02-27 16:37:35 +01:00
Itamar
4b483071fb LanguageServers: Add ProjectLoaction, Declaration types and use in IPC
With this we can avoid passing (name, line, column) tuples in many
different places.
2021-02-27 16:37:35 +01:00
Itamar
e20cd1d8db LanguageServers/Cpp: Don't VERIFY that a file could be found
... when creating a new DocumentData
2021-02-26 21:14:41 +01:00
Linus Groh
e265054c12 Everywhere: Remove a bunch of redundant 'AK::' namespace prefixes
This is basically just for consistency, it's quite strange to see
multiple AK container types next to each other, some with and some
without the namespace prefix - we're 'using AK::Foo;' a lot and should
leverage that. :^)
2021-02-26 16:59:56 +01:00
thankyouverycool
885c17b583 HackStudio: Set correct icons, text and location in menus
Adds correct icon to New Project, moves Wrapping Mode to more
traditional View, and truncates overly verbose Project entries
2021-02-26 13:50:00 +01:00
Brendan Coles
0ffc06b795 Profiler: Add help documentation 2021-02-24 20:40:00 +01:00
Sahan Fernando
bf68939bcc Profiler: Make sure rendered timestamps don't overflow
If you drag-select a slice of the profile off of the side of the
Profiler window, the profiler will try to render a negative start time,
which will overflow. This commit fixes that bug by clamping timestamps
to the start/end of the profile before rendering.
2021-02-24 12:19:01 +01:00
Andreas Kling
5d180d1f99 Everywhere: Rename ASSERT => VERIFY
(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED)

Since all of these checks are done in release builds as well,
let's rename them to VERIFY to prevent confusion, as everyone is
used to assertions being compiled out in release.

We can introduce a new ASSERT macro that is specifically for debug
checks, but I'm doing this wholesale conversion first since we've
accumulated thousands of these already, and it's not immediately
obvious which ones are suitable for ASSERT.
2021-02-23 20:56:54 +01:00
AnotherTest
29c8d34be7 HackStudio: Fix a misuse of dbgln() intended as dbgln_if()
This currently works accidentally, just because there's an overload for
`dbgln<bool>(...)` - it just bypasses the compiletime checks.
2021-02-23 13:59:33 +01:00
AnotherTest
1c4e15117d UserspaceEmulator: Fix an outln() format bug 2021-02-23 13:59:33 +01:00
Brendan Coles
501834ba45 Inspector: Add help documentation 2021-02-23 13:52:16 +01:00
Ivan Hansgaard Hansen
c9cd96894b
HackStudio: Fix opened files appearing empty (#5480)
When files where placed in outside of the project root, they would
appear empty because the label in the tree would differ from the
actual file path relative to the root.

Fixes #5471.
2021-02-22 23:00:57 +01:00
Itamar
5bc82c0185 LanguageServers/Cpp: Add 'FindDeclaration' capability
The C++ LanguageServer can now find the matching declaration for
variable names, function calls, struct/class types and properties.

When clicking on one of the above with Ctrl pressed, HackStudio will
ask the language server to find a matching declaration, and navigate
to the result in the Editor. :^)
2021-02-20 15:53:37 +01:00
Itamar
d3ff82ba80 LibCpp: Store filename in ASTNodes
As part of the position information, we now also store the filename the
ASTNode belongs to.
2021-02-20 15:53:37 +01:00
Itamar
c4139be461 HackStudio: Always use relative paths when opening project files 2021-02-20 15:53:37 +01:00
Itamar
50f887c9d5 HackStudio: Display identifiers as clickable
This extends the "navigate to include" feature to also display
identifiers as clickable when they're hovered over while left control
is pressed.
2021-02-20 15:53:37 +01:00
Linus Groh
3583b62ad3 LibGUI: Swap order of InputBox value and parent window args
This is now consistent with the other dialog classes.
2021-02-20 12:19:46 +01:00
Andreas Kling
4f0be55770 LibGUI: Remove GUI::FilePicker::file_exists()
I have no idea why this existed but everyone should just use
Core::File::exists() instead. :^)
2021-02-19 23:46:54 +01:00
Andreas Kling
781d29a337 Kernel+Userland: Give sys$recvfd() an options argument for O_CLOEXEC
@bugaevc pointed out that we shouldn't be setting this flag in
userspace, and he's right of course.
2021-02-14 10:39:48 +01:00
Itamar
c2e5bc442d LanguageServers/cpp: Use parser-based autocomplete engine by default 2021-02-13 19:50:09 +01:00
Itamar
715933ce8b HackStudio: Handle crash of the LanguageServer gracefully
Previously, HackStudio exited whenever a LanguageServer crashed.

Now, we disconnect all clients from that language server instance and
show a nice notification.
2021-02-13 19:50:09 +01:00
Itamar
2da5ecba41 LanguageServers/Cpp: Handle autocomplete request on an empty line 2021-02-13 19:50:09 +01:00
Itamar
18a9b66f10 HackStudio: Set icon for 'make is not available' notification 2021-02-13 19:50:09 +01:00
Nick Vella
b671577223 HackStudio: Project templates and New Project dialog
This commit adds a simple project template system to HackStudio,
as well as a pretty New Project dialog, inspired by early VS.NET
and MS Office.
2021-02-13 19:49:30 +01:00
Itamar
ef9bfbd383 LanguageServers/Cpp: Autocomplete declarations from included headers
We now also look at the available declarations from included header
files when autocompleting names.

Additionally, you can now request autocomplete on an empty token, which
brings up all available names, starting from the inner-most scope.
2021-02-10 23:09:40 +01:00
Itamar
64c80f6ea4 LanguageServers/Cpp: Autocomplete function and struct/class names 2021-02-10 23:09:40 +01:00
Itamar
e42b9e879c HackStudio: Show notification if 'make' is not available
We previously popped a MessageBox for this, but a notification is less
disruptive.
2021-02-10 23:04:54 +01:00
Itamar
72fdab7bfb LanguageServers/Cpp: ParserAutoComplete engine inspects header files
... and performs preprocessing on the source code before parsing.

To support this, we are now able to keep track of multiple
files in the autocomplete engine. We re-parse a file whenever it is
edited.
2021-02-08 23:10:38 +01:00
Itamar
02038a0ede LanguageServers/Cpp: Use FileDB and AutoCompleteEngine base class 2021-02-08 23:10:38 +01:00
Itamar
bed06b13f3 LanguageServers/Cpp: Add FileDB and pass project_root in Greet()
FileDB wraps the access to the contents of project files.

When asked to fetch a file, FileDB will either return its in-memory
model of the file if it has been "opened" by the language-server
protocol, or otherwise fetch it from the filesystem.

Previously, the cpp language server did not pledge "rpath" and got
access to the contents of files whenever they were opened by the
language client.
However, features like inspection of header files require the language
server to get the content of files that were not opened by the client.

The language server now pledges rpath but makes sure to only unveil
the project's directory and /usr/include.
2021-02-08 23:10:38 +01:00
AnotherTest
09a43969ba Everywhere: Replace dbgln<flag>(...) with dbgln_if(flag, ...)
Replacement made by `find Kernel Userland -name '*.h' -o -name '*.cpp' | sed -i -Ee 's/dbgln\b<(\w+)>\(/dbgln_if(\1, /g'`
2021-02-08 18:08:55 +01:00
AnotherTest
b68e34cc2e UserspaceEmulator: Use vdbgln() instead of dbgln() when reporting
This will avoid conflict with the upcoming compiletime checks.
2021-02-08 18:08:55 +01:00
Ben Wiederhake
0a2304ba05 Everywhere: Fix weird includes 2021-02-08 18:03:57 +01:00
Ben Wiederhake
7961e09c29 Everywhere: Add semantically-missing includes
For example, FindInFilesWidget.h mentions GUI::TableView, but did not include
it. On the other hand, all source files that include FindInFilesWidget.h
also include TableView.h, so the issue is only cosmetical.
2021-02-08 18:03:57 +01:00
Andreas Kling
50308f6fda Shell: Move Shell syntax highlighter LibShell 2021-02-07 17:07:33 +01:00
Andreas Kling
ddbf20ecf6 LibSyntax+LibGUI+LibJS: Move JS syntax highlighter to LibJS
This is a little bit messy but the basic idea is:

Syntax::Highlighter now has a Syntax::HighlighterClient to talk to the
outside world. It mostly communicates in LibGUI primitives that are
available in headers, so inlineable.

GUI::TextEditor inherits from Syntax::HighlighterClient.

This let us to move GUI::JSSyntaxHighlighter to JS::SyntaxHighlighter
and remove LibGUI's dependency on LibJS.
2021-02-07 16:56:02 +01:00
Andreas Kling
43c7d7d285 LibSyntax: Move GUI::Highlighter to Syntax::Highlighter in LibSyntax
This is a move towards dropping more LibGUI dependencies.
2021-02-07 15:15:10 +01:00
Andreas Kling
ff2438e0ce LibGUI+LibCpp: Move C++ syntax highlighter to LibCpp
This makes LibGUI not depend on LibCpp.
2021-02-07 14:40:36 +01:00
Andreas Kling
89483a9408 UserspaceEmulator: Implement a proper VM allocator
This patch brings Kernel::RangeAllocator to UserspaceEmulator in a
slightly simplified form.

It supports the basic three allocation types needed by virt$mmap():
allocate_anywhere, allocate_specific, and allocate_randomized.

Porting virt$mmap() and virt$munmap() to use the allocator makes
UE work correctly once again. :^)
2021-02-06 23:15:44 +01:00
Andreas Kling
9dacd7c0ec UserspaceEmulator: Stub out virt$msyscall()
This is a no-op inside UE for now.
2021-02-06 23:15:44 +01:00
Sahan Fernando
7e9122950e Profiler: Display timing information in ProfileTimelineWidget
Currently, there is no way to know when in a profile's duration a
sample was taken. This commit adds a basic timestamp to the timeline
widget, and a black bar to show where the cursor is hovering over.
2021-02-06 08:55:34 +01:00
Andreas Kling
e87eac9273 Userland: Add LibSystem and funnel all syscalls through it
This achieves two things:

- Programs can now intentionally perform arbitrary syscalls by calling
  syscall(). This allows us to work on things like syscall fuzzing.

- It restricts the ability of userspace to make syscalls to a single
  4KB page of code. In order to call the kernel directly, an attacker
  must now locate this page and call through it.
2021-02-05 12:23:39 +01:00
Zac
cc2f35badd TextEditor: Implement word wrapping
Add a new wrapping mode to the TextEditor that will wrap lines at the
spaces between words.

Replace the previous menubar checkbox 'Wrapping Mode' in HackStudio and
the TextEditor with an exclusive submenu which allows switching between
'No wrapping', 'Wrap anywhere' and 'Wrap at words'. 'Wrap anywhere' (the
new 'Wrap lines') is still the default mode.

Setting the wrapping mode in the constructors of the TextEditorWidget
and HackStudio has been removed, it is now set when constructing the
menubar actions.
2021-02-03 10:33:23 +01:00
Matteo Sozzi
2031baebce HackStudio: do not open empty directories as file
When _double clicking_ or _right click > Open_ in the tree view, the
selected directory, if empty, was open in the editor section as file.
2021-02-03 10:15:09 +01:00
Matteo Sozzi
a8dfba6348 HackStudio: tree_view on_activiation changes
When opening a file in the tree view with _double click_, the file name
was not the same as opening the same file with _right click > Open_.

This caused the opne_files_view to have the same file in it, but with
two different names.
2021-02-03 10:15:09 +01:00
Andreas Kling
1ce03f4f34 LibIPC: Stop sending client ID to clients
The client ID is not useful to normal clients anymore, so stop telling
everyone what their ID is.
2021-02-01 11:32:00 +01:00
Matteo Sozzi
40da077f6c HackStudio: added new directory action
Added the possibility to create a new directory in the current project.
2021-02-01 09:52:13 +01:00
Brendan Coles
50092ea0ca Inspector: Exit if inspected process has not pledged accept 2021-01-31 09:08:51 +01:00
Matteo Sozzi
32a363ded5 HackStudio: removed toggle_index
Removed `m_project_tree_view->toggle_index()` when adding new file to
project.
2021-01-30 22:59:59 +01:00
Brendan Coles
58abdde2e4 Inspector: Allow browsing inspection data in UI after process exits 2021-01-30 14:10:10 +01:00
Matteo Sozzi
f80b40b411 HackStudio: do not toggle_index in open_project
When opening a new project `m_prject_tree_view->toggle_index()` is not
needed because `m_project_tree_view->set_model()` already updates the
indexes.
2021-01-30 14:08:41 +01:00
Itamar
fa18010477 HackStudio: Integate with C++ parser-based autocomplete
By default, C++ auto completion will still be performed by the
lexer-based logic.
However, the parser-based logic can be switched on via the menubar.
2021-01-27 21:10:57 +01:00
Itamar
8ed96eb27c HackStudio: Attach previous Language Client when detaching
Previously, if a new LanguageClient was created & destroyed, the
ServerConnection to the language server would be left without an
attached LanguageClient.
As a result, auto-completion results would not be updated in the UI.

Starting with this commit, the LanguageClient holds a WeakPtr to the
previous LanguageClient that was attached to the ServerConnection,
and re-attaches it after detaching itself.
2021-01-27 21:10:57 +01:00
Itamar
c85dad2383 HackStudio: Add parser-based c++ autocomplete engine 2021-01-27 21:10:57 +01:00
asynts
eea72b9b5c Everywhere: Hook up remaining debug macros to Debug.h. 2021-01-25 09:47:36 +01:00
asynts
8465683dcf Everywhere: Debug macros instead of constexpr.
This was done with the following script:

    find . \( -name '*.cpp' -o -name '*.h' -o -name '*.in' \) -not -path './Toolchain/*' -not -path './Build/*' -exec sed -i -E 's/dbgln<debug_([a-z_]+)>/dbgln<\U\1_DEBUG>/' {} \;

    find . \( -name '*.cpp' -o -name '*.h' -o -name '*.in' \) -not -path './Toolchain/*' -not -path './Build/*' -exec sed -i -E 's/if constexpr \(debug_([a-z0-9_]+)/if constexpr \(\U\1_DEBUG/' {} \;
2021-01-25 09:47:36 +01:00
asynts
bb483f7ef4 Everywhere: Name debug macros more consistently.
Personally, I prefer the naming convention DEBUG_FOO over FOO_DEBUG, but
the majority of the debug macros are already named in the latter naming
convention, so I just enforce consistency here.

This was done with the following script:

    find . \( -name '*.cpp' -o -name '*.h' -o -name '*.in' \) -not -path './Toolchain/*' -not -path './Build/*' -exec sed -i -E 's/DEBUG_PATH/PATH_DEBUG/' {} \;
2021-01-25 09:47:36 +01:00
asynts
acdcf59a33 Everywhere: Remove unnecessary debug comments.
It would be tempting to uncomment these statements, but that won't work
with the new changes.

This was done with the following commands:

    find . \( -name '*.cpp' -o -name '*.h' -o -name '*.in' \) -not -path './Toolchain/*' -not -path './Build/*' -exec awk -i inplace '$0 !~ /\/\/#define/ { if (!toggle) { print; } else { toggle = !toggle } } ; $0 ~/\/\/#define/ { toggle = 1 }' {} \;

    find . \( -name '*.cpp' -o -name '*.h' -o -name '*.in' \) -not -path './Toolchain/*' -not -path './Build/*' -exec awk -i inplace '$0 !~ /\/\/ #define/ { if (!toggle) { print; } else { toggle = !toggle } } ; $0 ~/\/\/ #define/ { toggle = 1 }' {} \;
2021-01-25 09:47:36 +01:00
asynts
1a3a0836c0 Everywhere: Use CMake to generate AK/Debug.h.
This was done with the help of several scripts, I dump them here to
easily find them later:

    awk '/#ifdef/ { print "#cmakedefine01 "$2 }' AK/Debug.h.in

    for debug_macro in $(awk '/#ifdef/ { print $2 }' AK/Debug.h.in)
    do
        find . \( -name '*.cpp' -o -name '*.h' -o -name '*.in' \) -not -path './Toolchain/*' -not -path './Build/*' -exec sed -i -E 's/#ifdef '$debug_macro'/#if '$debug_macro'/' {} \;
    done

    # Remember to remove WRAPPER_GERNERATOR_DEBUG from the list.
    awk '/#cmake/ { print "set("$2" ON)" }' AK/Debug.h.in
2021-01-25 09:47:36 +01:00
Ben Wiederhake
9058a8367f UserspaceEmulator: Improve error message for typos 2021-01-23 16:47:09 +01:00
Ben Wiederhake
792fa9f9fd UserspaceEmulator: Implement chown
Now we can run 'ue chown anon ReadMe.md' :^)
2021-01-23 16:47:09 +01:00
Andreas Kling
c5df0532c0 HackStudio: Handle failed fork() in TerminalWrapper a bit better 2021-01-23 08:39:59 +01:00
asynts
27bc48e06c Everywhere: Replace a bundle of dbg with dbgln.
These changes are arbitrarily divided into multiple commits to make it
easier to find potentially introduced bugs with git bisect.
2021-01-22 22:14:30 +01:00
Andreas Kling
bf0719092f Kernel+Userland: Remove shared buffers (shbufs)
All users of this mechanism have been switched to anonymous files and
passing file descriptors with sendfd()/recvfd().

Shbufs got us where we are today, but it's time we say good-bye to them
and welcome a much more idiomatic replacement. :^)
2021-01-17 09:07:32 +01:00
Andreas Kling
cc8b3c92ba Everywhere: Remove a bunch of now-unnecessary shared_buffer pledges 2021-01-17 09:07:32 +01:00
Andreas Kling
05dbfe9ab6 Kernel: Remove sys$shbuf_seal() and userland wrappers
There are no remaining users of this syscall so let it go. :^)
2021-01-17 00:18:01 +01:00
Andreas Kling
b818cf898e Kernel+Userland: Remove sys$shbuf_allow_all() and userland wrappers
Nobody is using globally shared shbufs anymore, so let's remove them.
2021-01-16 22:43:03 +01:00
Ben Wiederhake
7ed002d1ca UserlandEmulator: Fix data loss in realpath/readlink
This 'data loss' was introduced in 809a8ee693, because
I hoped we could eventually outlaw overlong paths entirely. This sparked some discussion:
https://github.com/SerenityOS/serenity/discussions/4357
Among other things, we agree that yeah, the Kernel can and should be able to return
paths of arbitrary length. This means that the 'arbitrary' maximum of PATH_MAX in
UserspaceEmulator should be considered to be unnecessary data loss, and as such, needs to
be fixed.
2021-01-16 22:40:53 +01:00
Andreas Kling
d312011708 Everywhere: Drop "shared_buffer" in most GUI programs, pledge "recvfd"
Now that WindowServer broadcasts the system theme using an anonymous
file, we need clients to pledge "recvfd" so they can receive it.

Some programs keep the "shared_buffer" pledge since it's still used for
a handful of things.
2021-01-16 19:30:32 +01:00
Andreas Kling
de31e82f97 Kernel: Remove sys$shbuf_set_volatile() and userland wrappers
There are no remaining users of this syscall so let's remove it! :^)
2021-01-16 14:52:04 +01:00
Andreas Kling
c71807a3fc Everywhere: Convert a handful of String::format() => formatted() 2021-01-16 14:52:04 +01:00
Andreas Kling
12879184ce UserspaceEmulator: Support the anon_create, sendfd and recvfd syscalls 2021-01-15 14:17:19 +01:00
Andreas Kling
20915795a8 Everywhere: Pledge "sendfd" in WindowServer client programs
This is needed for the new way we transfer window backing stores.
2021-01-15 14:10:32 +01:00
Andreas Kling
7f2d8e8884 LibIPC: Close received IPC::File fd's by default unless taken
When receiving a file descriptor over IPC, the receiver must now call
take_fd() on the IPC::File to take over the descriptor. Otherwise,
IPC::File will close the file on destruction.
2021-01-14 09:50:14 +01:00
Andreas Kling
384d047e3e IPCCompiler: Use move semantics in generated IPC message constructors
This allows us to use move-only types as IPC message parameters.
2021-01-14 09:50:14 +01:00
Andreas Kling
1a08ac72ad LibC+Everywhere: Remove open_with_path_length() in favor of open()
This API was a mostly gratuitous deviation from POSIX that gave up some
portability in exchange for avoiding the occasional strlen().

I don't think that was actually achieving anything valuable, so let's
just chill out and have the same open() API as everyone else. :^)
2021-01-12 23:34:01 +01:00
Andreas Kling
4055b03291 DevTools: Move to Userland/DevTools/ 2021-01-12 12:18:55 +01:00