Commit graph

6472 commits

Author SHA1 Message Date
Andreas Kling
f4e7aecec2 Kernel: Preserve CoW bits when splitting VM regions 2020-01-25 17:57:10 +01:00
Andreas Kling
7cc0b18f65 Kernel: Only open a single description for stdio in non-fork processes 2020-01-25 17:05:02 +01:00
Andreas Kling
603bf6fb4a Build: Remove -fno-sized-deallocation -Wno-sized-deallocation
Add sized variants of the global operator delete functions so we don't
have to use these GCC options anymore.
2020-01-25 16:59:21 +01:00
Andreas Kling
81ddd2dae0 Kernel: Make sys$setsid() clear the calling process's controlling TTY 2020-01-25 14:53:48 +01:00
Andreas Kling
cf10f22488 Terminal: Start a new session before exec'ing the shell
This will put everything running inside the terminal in the same SID.
2020-01-25 14:52:06 +01:00
Andreas Kling
c303f55b60 Shell: Don't start a new session in every new shell
The session should be started at a higher level, i.e the Terminal app.
2020-01-25 14:51:23 +01:00
Andreas Kling
f309381d4e Ext2FS: Use more dbg() in Ext2FS code
We should use dbg() instead of dbgprintf() as much as possible to
protect ourselves against format string bugs. Here's a bunch of
conversions in Ext2FS.
2020-01-25 14:30:53 +01:00
Andreas Kling
2bf11b8348 Kernel: Allow empty strings in validate_and_copy_string_from_user()
Sergey pointed out that we should just allow empty strings everywhere.
2020-01-25 14:14:11 +01:00
Andreas Kling
69de90a625 Kernel: Simplify Process constructor
Move all the fork-specific inheritance logic to sys$fork(), and all the
stuff for setting up stdio for non-fork ring 3 processes moves to
Process::create_user_process().

Also: we were setting up the PGID, SID and umask twice. Also the code
for copying the open file descriptors was overly complicated. Now it's
just a simple Vector copy assignment. :^)
2020-01-25 14:13:47 +01:00
Andreas Kling
c05c023664 Terminal: Fetch the user shell from /etc/passwd
This allows you to override the shell used by Terminal. :^)
2020-01-25 12:25:43 +01:00
Andreas Kling
0f5221568b Kernel: sys$execve() should not EFAULT for empty argument strings
It's okay to exec { "/bin/echo", "" } and it should not EFAULT.
2020-01-25 12:21:30 +01:00
Andreas Kling
ed90d39cd7 Shell: Allow empty tokens if enclosed in single or double quotes
Previously the shell parser would discard empty tokens. We now allow
them when they are enclosed in quotes (either '' or "")

This means that a command like _echo ""_ will actually pass an empty
string to /bin/echo in argv[1] now.
2020-01-25 12:16:45 +01:00
Andreas Kling
003d52ce6e AK: Vector::is_null() should always return false
This is only used by the somewhat dubious templated String::copy().
An empty Vector should generate an empty String when copied, never
a null String.
2020-01-25 12:14:59 +01:00
Andreas Kling
b648997d1f WindowServer: Don't allow minimize/maximize of windows while modal up
While one window is blocked by another modal one, just ignore events on
the window frame, and also ignore set_minimized() and set_maximized().

The only thing you're allowed to do with a blocked window is moving it.

Fixes #1111.
2020-01-25 10:41:23 +01:00
Andreas Kling
6df81c8a88 WindowServer: Robustify WSWindow<->WSClientConnection link a bit
WSWindow now detaches from WSClientConnection when being destroyed.

Because of this, we can no longer rely on WSWindow::client() to tell
us whether a window is internal to WindowServer or not. So instead we
now have WSWindow::is_internal() which checks for client_id == -1.

Note that WSWindow now also gets a copy of its client_id when
constructed, since we can no longer rely on client() being valid after
destruction has started.

This allows various automatic mechanisms (e.g what happens in response
to window removal) to skip over windows that are being destroyed.

Fixes #387.
2020-01-25 10:34:32 +01:00
Andreas Kling
60d5b06e21 WindowServer: Tear down WSClientConnection asynchronously
If something goes wrong when trying to message a windowing client,
we now tear it down *on next event loop* instead of immediately.

This avoids having to deal with disconnected windows suddenly
disappearing from window lists while looping over them.
2020-01-25 10:34:32 +01:00
Andreas Kling
74829cdb75 LibIPC: Short-cirtcuit post_message() if socket already disconnected
To allow for more asynchronous teardown of IClientConnection, make the
post_message() function simply return if called after the IPC socket
has been closed.
2020-01-25 10:34:32 +01:00
Andreas Kling
e576c9e952 Kernel: Clear ESI and EDI on syscall entry
Since these are not part of the system call convention, we don't care
what userspace had in there. Might as well scrub it before entering
the kernel.

I would scrub EBP too, but that breaks the comfy kernel-thru-userspace
stack traces we currently get. It can be done with some effort.
2020-01-25 10:34:32 +01:00
Andreas Kling
3f52cee595 AK: Assert if trying to create a WeakPtr to an object being destroyed
Trying to make_weak_ptr() on something that has begun destruction is
very unlikely to be what you want. Let's assert if that scenario comes
up so we can catch it immediately.
2020-01-25 10:34:32 +01:00
Andreas Kling
b0192cfb38 Meta: Remove some copyright headers added in error 2020-01-25 10:34:32 +01:00
Emanuel Sprung
462e223c3d Meta: Fix typo + suggest value of export variable.
The variable is not set anymore by the UseIt.sh script, so if a user doesn't
have it set in the .bashrc or .zshrc file already, it's not working properly.
2020-01-25 09:09:52 +01:00
Emanuel Sprung
9885ccb7a7 Toolchain: Fix python build script.
This fixes #995
2020-01-25 09:09:52 +01:00
Emanuel Sprung
91b22e049b Toolchain: Fix qemu build script. 2020-01-25 09:09:52 +01:00
Brian Callahan
c8f61de191 Ports: Add bc port 2020-01-25 09:06:20 +01:00
Sergey Bugaev
c0b32f7b76 Meta: Claim copyright for files created by me
This changes copyright holder to myself for the source code files that I've
created or have (almost) completely rewritten. Not included are the files
that were significantly changed by others even though it was me who originally
created them (think HtmlView), or the many other files I've contributed code to.
2020-01-24 15:15:16 +01:00
Dan MacDonald
f1e9588040 Ports: Add GNU sed 4.2.1 (#1127)
4.2.1 was the last version not to depend upon Gnulib.
2020-01-24 14:09:52 +01:00
Brian Callahan
d22415631f Ports: Add byacc port 2020-01-24 11:36:18 +01:00
Brian Callahan
b8b2b30102 Ports: Add flex and pcre2 ports 2020-01-24 11:36:01 +01:00
Andreas Kling
ca413a5b50 AK: Use swap-based assignment in OwnPtr
Also provide a specialized swap(OwnPtr, OwnPtr) that allows swapping
an OwnPtr with itself.
2020-01-24 09:35:55 +01:00
Andreas Kling
7c74d3a657 TextEditor: Focus the editor after opening a new file 2020-01-23 21:33:15 +01:00
Andreas Kling
1c34348b0c GTextEditor: Create the "go to line" action eagerly
Previously it was created the first time you requested a context menu
for the GTextEditor by right-clicking in it.

That meant it wasn't possible to use Ctrl+L to "go to line" before you
had first right-clicked the editor.
2020-01-23 21:33:15 +01:00
Andreas Kling
a33259483a GTextEditor: Move "Go to line" feature from HackStudio into GTextEditor
This is a handy feature for any multi-line GTextEditor, so let's just
have it in the base widget. :^)

Fixes #1122.
2020-01-23 21:33:15 +01:00
Andreas Kling
ebfb3d91e2 TextEditor: Various UI text tweaks 2020-01-23 21:33:15 +01:00
Andreas Kling
9e2c595c64 GTextEditor: Make color of non-highlighted line numbers darker
Fixes #1123.
2020-01-23 21:33:15 +01:00
Andreas Kling
b88be25214 GTextEditor: Disable auto-indentation while pasting
Fixes #1121.
2020-01-23 21:33:15 +01:00
Andreas Kling
14b83ee12f LibGUI: Give GTextDocument access to the GTextEditor during commands
It's useful for the GTextDocument to have access to the initiating
GTextEditor widget during the initial execution of a command.

Since commands are executed via calls to GUndoCommand::redo(), we do
this by wrapping the invocation of redo() in a new helper called
GTextDocumentUndoCommand::execute_from(GTextDocument::Client).

This is then used to fetch the current auto-indentation feature state
and the soft tab width, both used by text insertion.
2020-01-23 21:33:15 +01:00
Andreas Kling
03d73cbaae Kernel: Allow Socket subclasses to fail construction
For example, socket(AF_INET) should only succeed for valid SOCK_TYPEs.
2020-01-23 21:33:15 +01:00
Andreas Kling
a93f35ac71 LibCore: Remove redundant check in CObject::dispatch_event() 2020-01-23 21:33:15 +01:00
Brian Callahan
b90af9b1ed Ports: Add mawk port (#1117) 2020-01-23 20:41:40 +01:00
Andreas Kling
3de5439579 AK: Let's call decrementing reference counts "unref" instead of "deref"
It always bothered me that we're using the overloaded "dereference"
term for this. Let's call it "unreference" instead. :^)
2020-01-23 15:14:21 +01:00
Andreas Kling
4aa1b5b40e LibC: The pwd and grp related functions need to preserve empty fieldso
Now that String::split() defaults to keep_empty=false, we need to make
sure the pwd and grp functions in LibC keep the empty ones.

This fixes "id" moaning about invalid lines in /etc/group.
2020-01-23 14:33:58 +01:00
Andreas Kling
95504b5850 Base: Note in pledge(2) man page which promises are extensions
Also add a little "History" section noting that pledge() is an original
OpenBSD invention and that our implementation differs in many ways.
2020-01-23 10:41:07 +01:00
Andreas Kling
15aac1f9e9 Build: Fix silly mistake in makeall.sh 2020-01-23 10:41:07 +01:00
Brian Gianforcaro
cf151fa0e1 rpcdump: Use pledge() and unveil() 2020-01-23 10:22:54 +01:00
Brian Gianforcaro
e3e22cd42e lspci: Use pledge() and unveil() 2020-01-23 09:51:45 +01:00
Andreas Kling
d66bbc21ce AK: Unbreak FileSystemPath after String::split() changes
FileSystemPath(".") should not have a title(). This was caught by the
unit test for FileSystemPath, yay! :^)
2020-01-22 22:35:12 +01:00
Andreas Kling
e64c335e5a Revert "Kernel: Replace IRQHandler with the new InterruptHandler class"
This reverts commit 6c72736b26.

I am unable to boot on my home machine with this change in the tree.
2020-01-22 22:27:06 +01:00
Oliver Kraitschy
8e21e31b3a Build: use absolute path for /sbin/mke2fs
Distros like Debian and Ubuntu don't have /sbin in PATH, thus mke2fs is
not found.
2020-01-22 22:04:29 +01:00
Sergey Bugaev
b6aae25244 LibGUI: Rename GAbstractColumnView to GAbstractTableView
This is to prevent confusion with GColumnsView, which is unrelated.
2020-01-22 21:22:23 +01:00
Sergey Bugaev
dec95cb8b3 LibGUI: Let GModel specify the drag data type
GModel subclasses can now override drag_data_type() to specify which type
GAbstractView should set for drag data. The default implementation returns a
null string, which disables dragging from this widget.
2020-01-22 21:22:23 +01:00