Commit Graph

12 Commits

Author SHA1 Message Date
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
Andreas Kling
a446cea759 LibIPC: Add Connection::send_sync_but_allow_failure()
Instead of asserting that the peer responds successfully, this API
allows for the peer to die/crash/whatever happens on the other side
while handling a synchronous request.

This will be useful when using process separation to parse untrusted
data from the web.
2021-02-20 11:37:55 +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
Andreas Kling
dc42b4565b LibIPC: Oops, fix busted dbgln() format string (thanks, checker!) 2021-02-13 20:37:05 +01:00
Andreas Kling
05bb11f482 LibIPC: Make received file descriptors close-on-exec by default
I noticed that programs running in the terminal had an open file
descriptor for the system theme buffer, inherited from the Terminal.

Let's be nice and always mark incoming fds with FD_CLOEXEC.
2021-02-13 20:13:51 +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
Andreas Kling
1b5be4a342 LibIPC: Stop exchanging client/server PIDs in greeting handshake
The PIDs were used for sharing shbufs between processes, but now that
we have migrated to file descriptor passing, we no longer need to know
the PID of the other side.
2021-01-31 09:29:27 +01:00
Andreas Kling
9c6c18d9b6 LibCore+LibIPC: Add Core::AnonymousBuffer, an IPC-friendly buffer class
This will be used to migrate remaining clients off of shbufs.
2021-01-16 17:20:24 +01:00
asynts
01879d27c2 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-16 11:54:35 +01:00
Andreas Kling
f1f7bf567b LibIPC: Add an expressive way to close an IPC::File after sending it
If you don't need a file descriptor after sending it to someone over
IPC, construct it with IPC::File(fd, IPC::File::CloseAfterSending)
and LibIPC will take care of it for you. :^)
2021-01-14 09:50:14 +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
13d7c09125 Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00