Commit Graph

2327 Commits

Author SHA1 Message Date
Andreas Kling
9f54ea9bcd NotificationServer: Add a system service for desktop notifications
This patch adds NotificationServer, which runs as the "notify" user
and provides an IPC API for desktop notifications.

LibGUI gains the GUI::Notification class for showing notifications.

NotificationServer is spawned on demand and will unspawn after
dimissing all visible notifications. :^)

Finally, this also comes with a small /bin/notify utility.
2020-02-16 21:58:17 +01:00
Andreas Kling
9794e18a20 Base: Run WindowServer as a separate "window" user
This was actually rather painless and straightforward. WindowServer now
runs as the "window" user. Users in the "window" group can connect to
it via the socket in /tmp/portal/window as usual.
2020-02-16 21:58:17 +01:00
Andreas Kling
31e1af732f Kernel+LibC: Allow sys$mmap() callers to specify address alignment
This is exposed via the non-standard serenity_mmap() call in userspace.
2020-02-16 12:55:56 +01:00
Andreas Kling
7a8be7f777 Kernel: Remove SmapDisabler in sys$accept() 2020-02-16 08:20:54 +01:00
Andreas Kling
7717084ac7 Kernel: Remove SmapDisabler in sys$clock_gettime() 2020-02-16 08:13:11 +01:00
Andreas Kling
7533d61458 Kernel: Fix weird whitespace mistake in RangeAllocator 2020-02-16 08:01:33 +01:00
Andreas Kling
e90765e957 Kernel: Remove Process inheriting from Weakable
This mechanism wasn't actually used to create any WeakPtr<Process>.
Such pointers would be pretty hard to work with anyway, due to the
multi-step destruction ritual of Process.
2020-02-16 02:16:22 +01:00
Andreas Kling
635ae70b8f Kernel: More header dependency reduction work 2020-02-16 02:15:33 +01:00
Andreas Kling
16818322c5 Kernel: Reduce header dependencies of Process and Thread 2020-02-16 02:01:42 +01:00
Andreas Kling
e28809a996 Kernel: Add forward declaration header 2020-02-16 01:50:32 +01:00
Andreas Kling
1d611e4a11 Kernel: Reduce header dependencies of MemoryManager and Region 2020-02-16 01:33:41 +01:00
Andreas Kling
a356e48150 Kernel: Move all code into the Kernel namespace 2020-02-16 01:27:42 +01:00
Andreas Kling
1f55079488 Kernel: Remove SmapDisabler in sys$getgroups() 2020-02-16 00:30:00 +01:00
Andreas Kling
eb7b0c76a8 Kernel: Remove SmapDisabler in sys$setgroups() 2020-02-16 00:27:10 +01:00
Andreas Kling
0341ddc5eb Kernel: Rename RegisterDump => RegisterState 2020-02-16 00:15:37 +01:00
Andreas Kling
5507945306 Kernel: Widen PhysicalPage refcount to 32 bits
A 16-bit refcount is just begging for trouble right nowl.
A 32-bit refcount will be begging for trouble later down the line,
so we'll have to revisit this eventually. :^)
2020-02-15 22:34:48 +01:00
Andreas Kling
c624d3875e Kernel: Use a shared physical page for zero-filled pages until written
This patch adds a globally shared zero-filled PhysicalPage that will
be mapped into every slot of every zero-filled AnonymousVMObject until
that page is written to, achieving CoW-like zero-filled pages.

Initial testing show that this doesn't actually achieve any sharing yet
but it seems like a good design regardless, since it may reduce the
number of page faults taken by programs.

If you look at the refcount of MM.shared_zero_page() it will have quite
a high refcount, but that's just because everything maps it everywhere.
If you want to see the "real" refcount, you can build with the
MAP_SHARED_ZERO_PAGE_LAZILY flag, and we'll defer mapping of the shared
zero page until the first NP read fault.

I've left this behavior behind a flag for future testing of this code.
2020-02-15 13:17:40 +01:00
Andreas Kling
1828d9eadd Kernel: Remove some commented-out code in Scheduler::yield() 2020-02-10 20:16:50 +01:00
Andreas Kling
7cf33a8ccb Kernel: Remove outdated FIXME from Scheduler 2020-02-10 20:15:53 +01:00
Andreas Kling
27f0102bbe Kernel: Add getter and setter for the X86 CR3 register
This gets rid of a bunch of inline assembly.
2020-02-10 20:00:32 +01:00
Andreas Kling
580a94bc44 Kernel+LibC: Merge sys$stat() and sys$lstat()
There is now only one sys$stat() instead of two separate syscalls.
2020-02-10 19:49:49 +01:00
Andreas Kling
ccfee3e573 Kernel: Remove more <LibBareMetal/Output/kstdio.h> includes 2020-02-10 12:07:48 +01:00
Andreas Kling
6cbd72f54f AK: Remove bitrotted Traits::dump() mechanism
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-10 11:55:34 +01:00
Shannon Booth
fe668db999 Meta: Fix shellcheck warnings in various scripts
Warnings fixed:
 * SC2086: Double quote to prevent globbing and word splitting.
 * SC2006: Use $(...) notation instead of legacy backticked `...`
 * SC2039: In POSIX sh, echo flags are undefined
 * SC2209: Use var=$(command) to assign output (or quote to assign string)
 * SC2164: Use 'cd ... || exit' or 'cd ... || return' in case cd fails
 * SC2166: Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.
 * SC2034: i appears unused. Verify use (or export if used externally)
 * SC2046: Quote this to prevent word splitting.
 * SC2236: Use -z instead of ! -n.

There are still a lot of warnings in Kernel/run about:
 - SC2086: Double quote to prevent globbing and word splitting.

However, splitting on space is intentional in this case, and not trivial to
change. Therefore ignore the warning for now - but we should fix this in
the future.
2020-02-10 10:46:25 +01:00
Liav A
99ea80695e Kernel: Use VirtualAddress & PhysicalAddress classes from LibBareMetal 2020-02-09 19:38:17 +01:00
Liav A
e559af2008 Kernel: Apply changes to use LibBareMetal definitions 2020-02-09 19:38:17 +01:00
Andreas Kling
db2ede9427 Net: Short-circuit routing to the IPv4 address of a local adapter
This makes it possible to open http://localhost:8000/ in Browser. :^)
2020-02-09 14:15:55 +01:00
Andreas Kling
6c752c15a2 WebServer: Implement a very basic HTTP server :^)
This server listens on port 8000 and serves HTML files from /www.
It's very simple and quite naive, but I think we can start here and
build our way to something pretty neat.

Work towards #792.
2020-02-09 14:15:55 +01:00
Andreas Kling
271bc4b2f2 Net: When routing to loopback, use the loopback adapter's MAC address
Otherwise the routing decision gets interpreted as "host unreachable."
2020-02-09 14:15:55 +01:00
Andreas Kling
d8a30e2ad2 Net: Give the LoopbackAdapter a MAC address
Since the routing code currently interprets an all-zero MAC address as
an invalid next hop, let's give the loopback adapter an address.
2020-02-09 14:15:55 +01:00
Conrad Pankoff
a189285658 Kernel: Support reading/writing PATADiskDevices directly via /dev/hdX 2020-02-09 12:58:45 +01:00
asliturk
57edcb54c2 MenuApplets: Add UserName applet.
Move code from WindowServer.WSMenuManager to the applet.
2020-02-09 10:37:35 +01:00
Andreas Kling
deb154be61 Kernel: Send SIGPIPE to the current thread on write to a broken pipe 2020-02-08 19:12:06 +01:00
Andreas Kling
70c9a89707 IPv4: Put some TCP close handshake debug spam behind TCP_SOCKET_DEBUG 2020-02-08 16:04:58 +01:00
Andreas Kling
3891e6d739 IPv4: Sockets should say can_read() after reading is shut down
This allows clients to get their EOF after shutting down reading.
2020-02-08 16:04:31 +01:00
Andreas Kling
228a1e9099 IPv4: Basic implementation of TCP socket shutdown
We can now participate in the TCP connection closing handshake. :^)
This implementation is definitely not complete and needs to handle a
bunch of other cases. But it's a huge improvement over not being able
to close connections at all.

Note that we hold on to pending-close sockets indefinitely, until they
are moved into the Closed state. This should also have a timeout but
that's still a FIXME. :^)

Fixes #428.
2020-02-08 16:04:27 +01:00
Andreas Kling
1037a1d2ba IPv4: Don't ACK empty TCP packets
Wireshark was complaining about duplicate ACK's and this was why.
2020-02-08 14:09:02 +01:00
Andreas Kling
48f13f2a81 IPv4: Split IPv4Socket::recvfrom() into packet/byte buffered functions
This code was really hard to follow since it handles two separate modes
of buffering the data.
2020-02-08 13:09:37 +01:00
Andreas Kling
00d8ec3ead Kernel: The inode fault handler should grab the VMObject lock earlier
It doesn't look healthy to create raw references into an array before
a temporary unlock. In fact, that temporary unlock looks generally
unhealthy, but it's a different problem.
2020-02-08 12:55:21 +01:00
Andreas Kling
a9d7902bb7 x86: Simplify region unmapping a bit
Add PageTableEntry::clear() to zero out a whole PTE, and use that for
unmapping instead of clearing individual fields.
2020-02-08 12:49:38 +01:00
Andreas Kling
7291370478 Kernel: Make File::truncate() take a u64
No point in taking a signed type here. We validate at the syscall layer
and then pass around a u64 from then on.
2020-02-08 12:07:04 +01:00
Andreas Kling
42d41fdf94 Kernel: Simplify FS::create_inode() a little bit
Return a KResultOr<NonnullRefPtr<Inode>> instead of returning errors in
an out-parameter.
2020-02-08 11:58:28 +01:00
Andreas Kling
2f82d4fb31 Kernel: Add KResultOr<T>::result()
This is just a handy way to get either an error or a KSuccess, even if
there is a T present.
2020-02-08 11:57:53 +01:00
Andreas Kling
f91b3aab47 Kernel: Cloned shared regions should also be marked as shared 2020-02-08 02:39:46 +01:00
Andreas Kling
8731682d0e Kernel: Simplify FS::create_directory() a little bit
None of the clients of this function actually used the returned Inode,
so it can simply return a KResult instead.
2020-02-08 02:34:22 +01:00
Andreas Kling
cb97ef5589 Ext2FS: Fail with EMFILE if we would overflow i_links_count 2020-02-08 02:26:33 +01:00
Andreas Kling
88ea152b24 Kernel: Merge unnecessary DiskDevice class into BlockDevice 2020-02-08 02:20:03 +01:00
Andreas Kling
6be880bd10 IPv4: Send TCP packets right away instead of waiting to "retry"
Also be more explicit about zero-initializing OutgoingPacket objects.
2020-02-08 01:45:45 +01:00
Andreas Kling
0c12d9a618 IPv4: Drop incoming packets on sockets that are shut down for reading 2020-02-08 00:58:11 +01:00
Andreas Kling
2b0b7cc5a4 Net: Add a basic sys$shutdown() implementation
Calling shutdown prevents further reads and/or writes on a socket.
We should do a few more things based on the type of socket, but this
initial implementation just puts the basic mechanism in place.

Work towards #428.
2020-02-08 00:54:43 +01:00