Commit graph

5164 commits

Author SHA1 Message Date
Andreas Kling 3da6d89d1f Kernel+LibC: Remove the isatty() syscall
This can be implemented entirely in userspace by calling tcgetattr().
To avoid screwing up the syscall indexes, this patch also adds a
mechanism for removing a syscall without shifting the index of other
syscalls.

Note that ports will still have to be rebuilt after this change,
as their LibC code will try to make the isatty() syscall on startup.
2019-11-17 20:03:42 +01:00
Andreas Kling 3d558f47b0 Docs: Add uname(1) and uname(2) man pages 2019-11-17 19:48:11 +01:00
Andreas Kling 3093b019d0 Kernel: Let's have sys$uname() report "i686" instead of "i386"
We wouldn't be able to run on an 80386 without considerable changes,
so let's be honest here and call it i686.
2019-11-17 19:39:12 +01:00
Andreas Kling 189f234b47 Docs: Add info about -T and -t to crash(1) 2019-11-17 19:23:35 +01:00
Andreas Kling 8ccbd7002b Ext2FS: Rename allocate_inode() => find_a_free_inode()
Since this function doesn't actually mark the inode as allocated,
let's tone down the name a little bit.
2019-11-17 19:19:02 +01:00
Andreas Kling a712d4ac0c Ext2FS: Writing to a slow symlink should not treat it like a fast one
We would misinterpret short writes to the first 60 bytes of a slow
symlink as writes to a fast symlink.
2019-11-17 19:19:00 +01:00
Andreas Kling 5d08665d9a Ext2FS: Remove unnecessary extra cache lookup in get_inode() 2019-11-17 19:11:19 +01:00
Andreas Kling ba997c0a72 Ext2FS: Add some FIXME's while browsing this code 2019-11-17 18:59:14 +01:00
Andreas Kling b2df670cf5 Kernel: Just hang if VFS::mount_root() fails 2019-11-17 18:58:25 +01:00
Andreas Kling e34ed04d1e Kernel+LibPthread+LibC: Create secondary thread stacks in userspace
Have pthread_create() allocate a stack and passing it to the kernel
instead of this work happening in the kernel. The more of this we can
do in userspace, the better.

This patch also unexposes the raw create_thread() and exit_thread()
syscalls since they are now only used by LibPthread anyway.
2019-11-17 17:29:20 +01:00
Andreas Kling 6685be36a0 LibDraw: Add Rect::from_two_points(Point, Point)
This returns the rectangle between two given Points. Thanks Owlinator
for suggesting this much easier way of doing it :^)
2019-11-17 16:37:42 +01:00
Andreas Kling 32ff660aa5 LibC: Oopsie, add the missing semicolons to __bswap32() and __bswap64()
Well that was a lot of flailing around.
2019-11-17 15:37:46 +01:00
Andreas Kling 31447d58fb LibC: Add back __bswap{16,32,64}() to endian.h 2019-11-17 14:34:40 +01:00
Andreas Kling 5f459ee929 LibC: Unbreak endian.h
There were some missing semicolons so this file didn't compile.
Also add some macro paranoia parentheses while we're here.
2019-11-17 12:53:50 +01:00
Andreas Kling 02f89dc419 Kernel+SystemMonitor: Show VM region "shared" and "stack" bits in UI
Expose these two region bits through /proc/PID/vm and show them in the
SystemMonitor process memory map view.
2019-11-17 12:15:46 +01:00
Andreas Kling 794758df3a Kernel: Implement some basic stack pointer validation
VM regions can now be marked as stack regions, which is then validated
on syscall, and on page fault.

If a thread is caught with its stack pointer pointing into anything
that's *not* a Region with its stack bit set, we'll crash the whole
process with SIGSTKFLT.

Userspace must now allocate custom stacks by using mmap() with the new
MAP_STACK flag. This mechanism was first introduced in OpenBSD, and now
we have it too, yay! :^)
2019-11-17 12:15:43 +01:00
Andreas Kling 197ed1bb2a HackStudio: Move the rubber-banding state into CursorTool
I originally put it in FormWidget because CursorTool was clueless about
painting. This patch adds Tool::on_second_paint() which allows all the
tools to hook into the second paint pass.
2019-11-16 22:26:46 +01:00
Andreas Kling 5fc62bcf68 HackStudio: Fill the selection rubber-band with some nice alpha color
Make use of the new alpha support in Painter::fill_rect() to fill the
rubber band with some see-through color. :^)
2019-11-16 19:31:57 +01:00
Andreas Kling 89c0b158da LibDraw: Add support for colors with alpha in Painter::fill_rect()
This code is naive, but it works and looks okay. :^)
2019-11-16 19:26:17 +01:00
Andreas Kling 69dee20761 HackStudio: Allow rubber-band selection of widgets
This patch implements basic rubber-banding. Perhaps this mechanism can
be generalized somehow, but it's not clear to me how that would work
at the moment.
2019-11-16 19:17:27 +01:00
Andreas Kling 196b64c0ae LibC: Move realpath() to <stdlib.h> 2019-11-16 17:29:09 +01:00
Andreas Kling fbcab844de LibC: Move the creat() and open() families to <fcntl.h>
Since POSIX says that's where they belong :^)
2019-11-16 17:29:09 +01:00
Andreas Kling 8d4d63d9b6 Ext2FS: Minor cleanup, remove an unused function 2019-11-16 17:29:09 +01:00
Ørjan Malde 84bedd5528 LibC: use GCC __builtin_bswap{16,32,64} to provide __bswap functions 2019-11-16 17:17:26 +01:00
Ørjan Malde a55fb98d0a LibC: fix arpa/inet.h guards 2019-11-16 16:27:48 +01:00
Ørjan Malde faff1361c3 LibC: properly populate endian.h 2019-11-16 16:27:48 +01:00
Andreas Kling ba97548686 Ports: Build ncurses with --with-termlib
This ensures that a libtinfo.a is produced, which is needed by nano.
2019-11-16 13:18:43 +01:00
Brandon Scott 0414e39035 Port: Nano
An early step towards a fully functional nano.
2019-11-16 12:50:50 +01:00
Brandon Scott 3069988a75 LibC: Implemented getc_unlocked, stubbed flockfile
Implemented getc_unlocked and stubbed out flockfile() and funlockfile().
2019-11-16 12:50:50 +01:00
Brandon Scott bda36853c9 LibC: Implemented mkstemp in stdlib
Implemented mkstemp method in stdlib.
2019-11-16 12:50:50 +01:00
Brandon Scott 48b1c82d53 LibC: Added missing signal flags
Added missing signal flags to signal.h
2019-11-16 12:50:50 +01:00
Brandon Scott f999e30afd LibC: Added execlp method and new pathconf setting
Added execlp method, and _PC_PIPE_BUF setting to pathconf method.
2019-11-16 12:50:50 +01:00
Brandon Scott eb719aa726 LibC: Added some missing directory type constants
Added some missing directory type constants to dirent.h
2019-11-16 12:50:50 +01:00
Brandon Scott 57eb37160c LibC: Added additional fields to lconv struct
Added some additional fields to the lconv structure that were missing
and set all their defaults.
2019-11-16 12:50:50 +01:00
Andreas Kling d1c984da82 Build: Make sure we look in Libraries/LibPthread for libraries :^) 2019-11-16 12:23:40 +01:00
Andreas Kling 66a2b582c3 LibPthread: Implement a basic first pthread mutex
This patch adds these API's:

- pthread_mutex_init()
- pthread_mutex_lock()
- pthread_mutex_unlock()

No mutex attributes are supported yet, so we only do the simplest mutex
wihout recursive locking.
2019-11-16 12:23:36 +01:00
Andreas Kling 73d6a69b3f Kernel: Release the big process lock while yielding in sys$yield()
Otherwise, a thread calling sched_yield() will prevent other threads
in that process from entering the kernel.
2019-11-16 12:18:59 +01:00
Andreas Kling 39e2b69153 AK: Atomic.h needs <stddef.h> for ptrdiff_t 2019-11-16 12:18:25 +01:00
Rok Povsic 95df049071 Terminal: Add selecting whole line on triple click
The line is also added to clipboard
2019-11-15 23:58:06 +01:00
Doc O e17386692a Meta: Add .DS_Store to .gitignore (#786) 2019-11-15 22:19:47 +01:00
Andreas Kling 834eff7983 HackStudio: Mark whitespace tokens as skippable GTextDocumentSpans
This makes Ctrl+Left/Right jump over whitespace, which feels nice :^)
2019-11-15 21:03:22 +01:00
Andreas Kling 57f7009b9e GTextEditor: Allow GTextDocumentSpans to be "skippable"
Setting the is_skippable flag on a GTextDocumentSpan will now cause the
cursor to skip over that span when moving with Ctrl+Left/Right.
2019-11-15 21:03:15 +01:00
Andreas Kling 27a30fdc2a GTextEditor: Allow moving the cursor span-wise with Ctrl+Left/Right
This allows you to move token by token when using HackStudio to edit
a C++ file.

Fixes #767.
2019-11-15 21:02:24 +01:00
ctfloyd a3520bfdfd GTextEditor: Alt+Shift+S alphabetically sorts selected lines 2019-11-15 21:01:12 +01:00
Andreas Kling e89cdd504c AK: Fix leak in WeakPtr(WeakPtr&&) and WeakPtr::operator=(WeakPtr&&)
We were forgetting to adopt the WeakLink, causing a reference leak.
This ended up costing us one allocation per exec(), with this stack:

    kmalloc_impl()
    Inode::set_vmo()
    InodeVMObject::create_with_inode()
    Process::do_exec()
    Process::exec()
    Process::sys$execve()

This was a pain to track down, in the end I caught it by dumping out
every live kmalloc pointer between runs and diffing the sets. Then it
was just a matter of matching the pointer to a call stack and looking
at what went wrong. :^)
2019-11-15 16:07:39 +01:00
Andreas Kling 7ef9c703d2 Kernel: Unbreak SlabAllocator after startup-time constructors
Now that the kernel supports startup-time constructors, we were first
doing slab_alloc_init(), and then the constructors ran later on,
zeroing out the freelist pointers.

This meant that all slab allocators thought they were completelty
exhausted and forwarded all requests to kmalloc() instead.
2019-11-15 12:48:39 +01:00
MWGuy b6ccbd32eb Ports: Add openssl package 2019-11-15 10:30:00 +01:00
Andreas Kling cb5021419e Kernel: Move Thread::m_joinee_exit_value into the JoinBlocker
There's no need for this to be a permanent Thread member. Just use a
reference in the JoinBlocker instead.
2019-11-14 21:04:34 +01:00
Andreas Kling 69efa3f630 Kernel+LibPthread: Implement pthread_join()
It's now possible to block until another thread in the same process has
exited. We can also retrieve its exit value, which is whatever value it
passed to pthread_exit(). :^)
2019-11-14 20:58:23 +01:00
Sergey Bugaev c6a8b95643 HackStudio: Add a Stop action to kill the current process
Also give the Run action a different icon that has the same style
as the stop icon that's now alongside it.

Closes https://github.com/SerenityOS/serenity/issues/771
2019-11-14 20:10:16 +01:00