Commit graph

5178 commits

Author SHA1 Message Date
Andreas Kling c23addd1fb Kernel: When userspaces calls a removed syscall, fail with ENOSYS
This is a bit gentler than jumping to 0x0, which always crashes the
whole process. Also log a debug message about what happened, and let
the user know that it's probably time to rebuild the program.
2019-11-18 12:35:14 +01:00
Andreas Kling 040fee370d LibHTML: Expand the "padding" shorthand property
This expands in the same way as "margin".
2019-11-18 12:34:52 +01:00
Andreas Kling b08de46480 LibHTML: Implement basic 'max-width' and 'min-width' support
These CSS properties constrain the computed width of a block-level box
to a maximum, followed by a minimum value.

This makes the "better mother fricken website" look more like it's
intended to (which helps makes the author's point, I suppose.)
2019-11-18 12:26:08 +01:00
Andreas Kling df16c9676b LibHTML: Tolerate "px" suffix on CSS lengths
We only support "px" units (and "auto") but we shouldn't choke just
because someone actually says "10px" instead of just "10"
2019-11-18 12:15:23 +01:00
Andreas Kling 00d171e4d6 LibHTML: Implement the "margin" shorthand property
This is a very bulky way of doing this, and doesn't seem sustainable to
implement every shorthand property this way, but it's a place to start.

The "margin" CSS property now expands into its four longhands as far as
my understanding of the specs.

Note that shorthand expansion happens when we *resolve* style, not when
we parse CSS. I'm not sure this is correct anymore, I think other UA's
may actually expand shorthands into the declaration directly at parse
these days. If so, we should do this at parsing as well.
2019-11-18 11:51:02 +01:00
Andreas Kling e6e41e4fb8 LibHTML: Start building a simple code generator for CSS properties
Code for parsing and stringifying CSS properties is now generated based
on LibHTML/CSS/Properties.json

At the moment, the file tells us three things:

- The name of a property
- Its initial value
- Whether it's inherited

Also, for shorthand properties, it provides a list of all the longhand
properties it may expand too. This is not actually used in the engine
yet though.

This *finally* makes layout tree dumps show the names of CSS properties
in effect, instead of "CSS::PropertyID(32)" and such. :^)
2019-11-18 11:48:41 +01:00
Andreas Kling dcd10149fe Lagom: Move this into Meta/
This is more of a meta thing, since it's not seeing active development,
but is just a way for me to build some Serenity parts and include them
in other projects. Move it out of the root to keep things tidy.
2019-11-18 09:07:05 +01:00
Andrew Kaster 618aebdd8a Kernel+LibPthread: pthread_create handles pthread_attr_t
Add an initial implementation of pthread attributes for:
  * detach state (joinable, detached)
  * schedule params (just priority)
  * guard page size (as skeleton) (requires kernel support maybe?)
  * stack size and user-provided stack location (4 or 8 MB only, must be aligned)

Add some tests too, to the thread test program.

Also, LibC: Move pthread declarations to sys/types.h, where they belong.
2019-11-18 09:04:32 +01:00
Dan MacDonald aae26a3a1e LibC: Add O_ACCMODE to fcntl.h 2019-11-18 08:55:45 +01:00
Andreas Kling 39190402e4 Ports: Upgrade the vim port to build with more features :^)
Previously we were only able to build with --with-features=small.
Thanks to all the compatibility work done in the kernel and LibC over
the last couple of months, we can now build --with-features=normal.

It's not the biggest deal in the world, but it's pretty nice to see
this kind of progress!
2019-11-17 21:03:41 +01:00
Andreas Kling 9c35feb14c LibC: jmp_buf and sigjmp_buf should be distinct types
This makes it possible to build 'vim' with more features enabled.
2019-11-17 21:01:26 +01:00
Andreas Kling 5eef2f78b0 LibC: isatty() should return 1 for success, 0 for error 2019-11-17 20:11:56 +01:00
Andreas Kling 70e220a81f Docs: Add note about EINVAL to isatty(3) 2019-11-17 20:09:12 +01:00
Andreas Kling 1bb296ea70 Docs: Add isatty(3) man page 2019-11-17 20:03:42 +01:00
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