Commit Graph

5414 Commits

Author SHA1 Message Date
Andreas Kling
babb726212 LibPthread: Implement pthread_mutex_trylock() 2019-12-07 14:52:27 +01:00
Andreas Kling
594c7f2d83 LibPthread: Implement pthread_self() 2019-12-07 14:52:27 +01:00
Andreas Kling
d08061103d LibPthread: Implement pthread_mutex_destroy() 2019-12-07 14:52:27 +01:00
Andreas Kling
cc1ef6dadb LibPthread: Implement condition variables
This feels like a pretty naive implementation, but I think it can work.
Basically each waiter creates an object on its stack that is then
added to a linked list inside by the pthread_cond_t.

Signalling is then done by walking the list and unsetting the "waiting"
flag on as many of the waiters as you like.
2019-12-07 14:52:27 +01:00
Andreas Kling
db2bfe14e9 LibIPC: Install libipc.a into /usr/lib 2019-12-07 14:52:27 +01:00
Максим Тарасов
3273dd0478 Ports: Add m4 port (#856) 2019-12-07 13:14:08 +01:00
Andreas Kling
c5ff0da93c ProcFS: Fix typo in /proc/net/local 2019-12-07 09:40:30 +01:00
Larkin
e5e0924c0b Ports: Use unzip to extract zips if bsdtar unavailable (#855) 2019-12-06 19:45:57 +01:00
Larkin Nickle
d14d6218d1 Ports: Add termcap port 2019-12-06 19:45:32 +01:00
Sasan Hezarkhani
8cea5c053d TextEditor: `Fix bug when document is marked dirty on open.
Currently, when `set_text()` is called on GTextDocument a change is
triggered and all clients registered get a document_did_set_text
call. This in turn causes the TextEditorWidget to mark the document
as dirty even on the first open, which makes for a weird experience.
2019-12-06 19:45:13 +01:00
Andreas Kling
f93c0dc489 LibIPC: Get client/server PIDs using getsockopt(SO_PEERCRED)
Instead of passing the PIDs back and forth in a handshake "Greet"
message, just use getsockopt(SO_PEERCRED) on both sides to get the same
information from the kernel.

This is a nice little simplification of the IPC protocol, although it
does not get rid of the handshake since we still have to pass the
"client ID" from the server to each client so they know how to refer
to themselves. This might not be necessary and we might be able to get
rid of this later on.
2019-12-06 18:39:59 +01:00
Andreas Kling
23e802518d Kernel: Add getsockopt(SO_PEERCRED) for local sockets
This sockopt gives you a struct with the PID, UID and GID of a socket's
peer process.
2019-12-06 18:38:36 +01:00
Andreas Kling
6e6e0b9de8 WindowServer: Compute some layout rects in WSMenuManager up front
Currently menu applets are laid out relative to the "audio rect" which
is the rect of the little audio muted state icon thingy.

There was an issue where applets would be placed at a negative X coord
if they were added to the WindowServer before the first time drawing
the menubar.
2019-12-05 19:59:54 +01:00
Andreas Kling
20bbeba6d5 CPUGraph: Launch the CPUGraph menu applet on startup 2019-12-05 19:44:22 +01:00
Andreas Kling
86d84f1654 WindowServer: Remove WSCPUMonitor
We'll still have a CPU graph, just not in the WindowServer process.
2019-12-05 19:43:56 +01:00
Andreas Kling
c3029a6a1f MenuApplets: Add CPUGraph, our first menu applet :^)
This implements the WSCPUMonitor functionality in a separate process.
2019-12-05 19:38:08 +01:00
Andreas Kling
44d5388e78 WindowServer: Add basic menu applet concept
It's now possible to create a little applet window that sits inside the
system's menubar. This is done using the new CreateMenuApplet IPC call.

So far, it's possible to assign a backing store ID, and to invalidate
rects for repaint. There is no way to get the events from inside the
applet just yet.

This will allow us to move the CPU graph and audio thingy to separate
applet processes. :^)
2019-12-05 19:36:01 +01:00
Andreas Kling
2d18fc8052 LibGUI: Move tooltip window rects if they don't end up on screen
This makes the quick launch button tooltips actually readable. :^)
2019-12-05 17:59:06 +01:00
Andreas Kling
e1862fe2f5 WindowServer: Move window minimize animation to a separate function
Move this from WSCompositor::compose() to a separate run_animations()
function to keep compose() readable. We might want to add some more
animations later.
2019-12-05 17:44:10 +01:00
William McPherson
aa8b40dce6 Shell: Cache PATH for faster tab completion
This patch reduces the O(n) tab completion to something like O(log(n)).
The cache is just a sorted vector of strings and we binary search it to
get a string matching our input, and then check the surrounding strings
to see if we need to remove any characters. Also we no longer stat each
file every time.

Also added an #include in BinarySearch since it was using size_t. Oops.

If `export` is called, we recache. Need to implement the `hash` builtin
for when an executable has been added to a directory in PATH.
2019-12-05 17:09:22 +01:00
Karol Baraniecki
431abc8846 Shell: Redirectiong from multiple-digit fds 2019-12-05 17:08:37 +01:00
Karol Baraniecki
7ed8a468ec Shell: Implement specifying fds in file redirection 2019-12-05 17:08:37 +01:00
Sergey Bugaev
cf7910fc1e AK: Implement %n printf specifier
This is a special specifier that does not output anything to the stream,
but saves the number of already output chars to the provided pointer.

This is apparently used by GNU Nano.
2019-12-05 12:29:11 +01:00
Dan MacDonald
f686b5b51b Meta: Check for Toolchain presence when running makeall.sh 2019-12-04 19:47:34 +01:00
Sergey Bugaev
f2546d15ce Taskbar: Add a quick launch bar
This is a tiny bar at the left of the taskbar where you can put
your most used apps to launch them with a single click. In a way,
it's another replacement for the Launcher, in addition to the app
menu. Unlike the launcher and the menu, it's not meant to be the
primary way to launch apps; it's only a faster way to launch a few
most often used utilities.
2019-12-04 14:32:15 +01:00
Andreas Kling
d111b6ead4 WindowServer+Taskbar: Animate window frames on minimize/unminimize
We now show a quick window outline animation when going in/out of
minimized state. It's a simple 10 frame animation at 60fps, just to
give a visual cue of what's happening with the window.

The Taskbar sends over the corresponding button rect for each window
to the WindowServer using a new WM_SetWindowTaskbarRect message.

Note that when unminimizing, we still *show* the window right away,
and don't hold off until the animation has finished. This avoids
making the desktop feel slow/sluggish. :^)
2019-12-03 21:34:34 +01:00
Sasan Hezarkhani
51262e7e2d GTextEditor: Clear current selection, if any, on set_document() 2019-12-03 12:51:27 +01:00
Sasan Hezarkhani
5c2ef01f7b LibGUI: Expose a function to clear GTextEditor selection 2019-12-03 12:51:27 +01:00
Tommy Nguyen
9a01e70ff9 FileManager: Refresh tree view when deleting directories
Fixes #825

The logic already existed. I just moved it to a separate lambda then added it
to the appropriate action. Note that when the tree view refreshes, it seems to
randomly open trees. I would like to fix this in a separate PR.
2019-12-03 12:50:47 +01:00
Sasan Hezarkhani
6db11e5bba IRCClient: Sort the member list ignoring the character cases.
I compared a few clients and they do the same sort of sorting.
2019-12-03 12:50:06 +01:00
Andreas Kling
8f80879676 AK: StringView::lines() should keep empty lines 2019-12-02 20:41:15 +01:00
Andreas Kling
d422c46ebb LibC: Also mark empty-but-kept-around BigAllocationBlocks as PROT_NONE
This extends the opportunistic protection of empty-but-kept-around to
also cover BigAllocationBlocks. Since we only cache 4KB BAB's at the
moment, this sees limited use, but it does work.
2019-12-02 20:02:23 +01:00
Andreas Kling
05c65fb4f1 Kernel: Don't CoW non-writable pages
A page fault in a page marked for CoW should not trigger a CoW if the
page is non-writable. I think this makes sense.
2019-12-02 19:20:09 +01:00
Andreas Kling
f41ae755ec Kernel: Crash on memory access in non-readable regions
This patch makes it possible to make memory regions non-readable.
This is enforced using the "present" bit in the page tables.
A process that hits an not-present page fault in a non-readable
region will be crashed.
2019-12-02 19:18:52 +01:00
Andreas Kling
ddd5411472 LibC: Protect empty-but-kept-around ChunkedBlocks with PROT_NONE
We now keep a separate queue of empty ChunkedBlocks in each allocator.
The underlying memory for each block is mprotect'ed with PROT_NONE to
provoke crashes on use-after-free.

This is not going to catch *all* use-after-frees, but if it catches
some, that's still pretty nice. :^)

The malloc memory region names are now updated to reflect their reuse
status: "malloc: ChunkedBlock(size) (free/reused)"
2019-12-02 18:54:12 +01:00
Andreas Kling
61f298faf3 AK: Add DoublyLinkedList::prepend()
Also make it possible to remove() with a value-type Iterator.
2019-12-02 18:36:10 +01:00
Andreas Kling
7dc9c90f83 Kernel: Fix bug where mprotect() would ignore setting PROT_WRITE
A typo in Region::set_writable() caused us to update the readable flag
rather than the writable flag.
2019-12-02 18:15:36 +01:00
Andreas Kling
64e77c262e Build: Add "sm" as an alias for SystemMonitor for now
This is one of the most common apps I bring up, yet there's no handy
alias for it? Silly :^)
2019-12-02 17:45:25 +01:00
Andreas Kling
b9f58a0e2e SystemMonitor: Enable sorting by column in the process memory map view 2019-12-02 17:43:52 +01:00
Andreas Kling
7970b594d5 SystemMonitor: Update the process memory map once every second 2019-12-02 17:36:10 +01:00
Andreas Kling
0e34b7d65e WindowServer: Remove debug spam about menu creation 2019-12-02 17:16:59 +01:00
Andreas Kling
790a27a444 Terminal: Ignore SIGCHLD with SA_NOCLDWAIT
Otherwise we'll accumulate a bunch of dead Terminal children if you
open and close more terminal windows.
2019-12-02 16:50:10 +01:00
Andreas Kling
340c5506b4 WindowServer: Remove silly debug logging on startup :^) 2019-12-02 16:47:11 +01:00
Andreas Kling
e91b2b8f1b WindowServer: Mark clients as misbehaving when they send invalid data
If a client sends an invalid window ID or similar to the WindowServer,
we'll now immediately mark them as misbehaving and disconnect them.

This might be too aggressive in some cases (window management, ...)
but it's just a place to start.
2019-12-02 15:55:14 +01:00
Andreas Kling
af9fd334f3 LibGUI: Don't show "Invalid" for menu items without a keyboard shortcut 2019-12-02 15:54:01 +01:00
William McPherson
d7177212fd AK: Add a BinarySearch template implementation
binary_search takes a haystack, a size, a needle and a compare function.
The compare function should return negative if a < b, positive if a > b
and 0 if a == b. The "sane default" compare function is integral_compare
which implements this with subtraction a - b.
binary_search returns a pointer to a matching element, NOT necessarily
the FIRST matching element. It returns a nullptr if the element was not
found.

This patch includes tests for binary_search.
2019-12-02 15:30:45 +01:00
Andrés Vieira
f8a0eb616c Userland: Add the cal command (#838)
This is a very simple implementation of the cal command to display
a calendar into the command line.

For now this only prints the current month highlighting the current
day.
2019-12-02 15:22:55 +01:00
Tommy Nguyen
2eb5793d55 LibMarkdown: Handle CRLF line endings
Previously, MDDocument only split on Unix-style line endings. This adds
a new function to StringView which handles LF, CR and CRLF.
2019-12-02 13:52:42 +01:00
Andreas Kling
035c4e15f4 Build: Build LibDraw before WindowServer 2019-12-02 13:17:32 +01:00
Andreas Kling
8ae62c57ee LibIPC: Rename IMessage id/name to message_id/message_name
Hogging "id" and "name" makes it impossible to use these as message
parameter names, which seems silly. :^)
2019-12-02 11:11:05 +01:00