Commit graph

17562 commits

Author SHA1 Message Date
Luke Wilde
61847b3cef LibJS: Disallow negative day lengths in ZonedDateTime.protoype.round
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/6f04074
2022-07-22 17:10:03 +01:00
Timothy Flynn
b8d4f8debf LibJS: Selectively display DateTimeFormat day periods as noon 2022-07-21 20:36:03 +01:00
Timothy Flynn
32c07bc6c3 LibUnicode: Generate per-locale data for the "noon" fixed day period
Note that not all locales have this day period.
2022-07-21 20:36:03 +01:00
Timothy Flynn
0f26ab89ae LibJS+LibUnicode: Handle flexible day periods on both sides of midnight
Commit ec7d535 only partially handled the case of flexible day periods
rolling over midnight, in that it only worked for hours after midnight.
For example, the en locale defines a day period range of [21:00, 06:00).
The previous method of adding 24 hours to the given hour would change
e.g. 23:00 to 47:00, which isn't valid.
2022-07-21 20:36:03 +01:00
Samuel Bowman
fadd69263a PartitionEditor: Add size column 2022-07-21 20:13:44 +01:00
Samuel Bowman
ba9f60785b PartitionEditor: Add total blocks column 2022-07-21 20:13:44 +01:00
Samuel Bowman
2f8c20816e LibPartition: Fix end block off by one error
Previously, end block was inconsistent. GUIDPartitionTable treated
end block as an inclusive bound, while MBRPartitionTable and
EBRPartitionTable treated end block as an exclusive bound.
Now all three treat end block as an inclusive upper bound.
2022-07-21 20:13:44 +01:00
Samuel Bowman
fb4221ad52 PartitionEditor: Abort and show a dialog if not running as root 2022-07-21 20:13:44 +01:00
Samuel Bowman
7a8953a833 PartitionEditor: Add the beginnings of a partition editor :^)
This adds a new application PartitionEditor which will eventually be
used to create and edit partition tables. Since LibPartition does not
know how to write partition tables yet, it is currently read-only.

Devices are discovered by scanning /dev for block device files.
Since block devices are chmod 600, PartitionEditor be must run as root.

By default Serenity uses the entire disk for the ext2 filesystem
without a partition table. This isn't useful for testing as the
partition list for the default disk will be empty. To test properly,
I created a few disk images using various partitioning schemes
(MBR, EBR, and GPT) and attached them using the following command:

export SERENITY_EXTRA_QEMU_ARGS="
  -drive file=/path/to/mbr.img,format=raw,index=1,media=disk
  -drive file=/path/to/ebr.img,format=raw,index=2,media=disk
  -drive file=/path/to/gpt.img,format=raw,index=3,media=disk"
2022-07-21 20:13:44 +01:00
Samuel Bowman
7b8088c78d LibCore: Add File::is_{block,char}_device() helpers
The existing File::is_device() helpers don't distinguish between
block and char devices. This commit adds File::is_block_device() and
File::is_char_device() helpers which are more specific.
2022-07-21 20:13:44 +01:00
Samuel Bowman
380ce43afc LibPartition: Make GUIDPartitionTable kernel/userland agnostic 2022-07-21 20:13:44 +01:00
Samuel Bowman
11b4d51fc9 LibPartition: Make EBRPartitionTable kernel/userland agnostic 2022-07-21 20:13:44 +01:00
Samuel Bowman
7e45c3b687 LibPartition: Make MBRPartitionTable kernel/userland agnostic 2022-07-21 20:13:44 +01:00
Samuel Bowman
6a1c85aa61 LibPartition: Make PartitionTable kernel/userland agnostic
Previously, PartitionTable was constructed using a Kernel::StorageDevice
making it only usable in the kernel. This commit adds a new constructor
that takes a Core::File instead, making it usable in userland as well.

This also adds the m_block_size field which stores the block size of the
underlying device obtained by calling StorageDevice::block_size() in the
kernel or by using the STORAGE_DEVICE_GET_BLOCK_SIZE ioctl in userland.
This avoids the need for an #ifdef every time block size is needed.
2022-07-21 20:13:44 +01:00
Samuel Bowman
25de9de7dc Kernel+LibPartition: Move GUIDPartitionTable into LibPartition 2022-07-21 20:13:44 +01:00
Samuel Bowman
9053d86b82 Kernel+LibPartition: Move EBRPartitionTable into LibPartition 2022-07-21 20:13:44 +01:00
Samuel Bowman
1a6ef03e4a Kernel+LibPartition: Move MBRPartitionTable into LibPartition 2022-07-21 20:13:44 +01:00
Samuel Bowman
940dde9947 Kernel+LibPartition: Move PartitionTable into LibPartition 2022-07-21 20:13:44 +01:00
Samuel Bowman
be1c5c6b9f Kernel+LibPartition: Move DiskPartitionMetadata into LibPartition
This commit creates a new library LibPartition which will contain
partition related code sharable between Kernel and Userland and
includes DiskPartitionMetadata as the first shared class.
2022-07-21 20:13:44 +01:00
Timur Sultanov
9906f41e01 Keymap+WindowServer: Add context menu to keymap applet
Adding a context menu which lists configured keymaps and allows
setting the active keymap
2022-07-21 16:40:47 +02:00
Itamar
db11cfa2c5 Utilities+LibELF: Temporary promises for dynamic linker in "pledge"
This adds a "temporary promises for the dynamic-linker" flag ('-d')
to the "pledge" utility.

Example usage:
pledge -d -p "stdio rpath" id

Without the '-d' flag, id would crash because the dynamic linker
requires 'prot_exec'.

When this flag is used and the program to be run is dynamically linked,
"pledge" adds promises that are required by the dynamic linker
to the promise set provided by the user.

The dynamic linker will later "give up" the pledge promises it no
longer requires.
2022-07-21 16:40:11 +02:00
Itamar
91a03bc6ae LibCore: Add function for searching a file in $PATH
This extracts the logic of searching for a file in $PATH from
System::exec to a separate function.
2022-07-21 16:40:11 +02:00
Idan Horowitz
01f0ae20b6 LibPthread: Implement named semaphores
Note that as part of this commit semaphore.cpp is excluded from the
DynamicLoader, as the dynamic loader does not build with pthread.cpp
which semaphore.cpp uses.
2022-07-21 16:39:22 +02:00
Idan Horowitz
23f3857cdd SystemServer: Create /tmp/semaphore on startup
This directory will store all LibPthread named semaphores
2022-07-21 16:39:22 +02:00
Idan Horowitz
35789f56a5 LibPthread: Support process-shared semaphores 2022-07-21 16:39:22 +02:00
Idan Horowitz
3f838768d9 LibPthread: Add magic bytes to the start of sem_t structures
This helps ensure random pointers are not passed in as semaphores, but
more importantly once named semaphores are implemented, this will
ensure that random files are not used as semaphores.
2022-07-21 16:39:22 +02:00
Idan Horowitz
e80c0bde70 LibC: Support blocking flock() 2022-07-21 16:39:22 +02:00
Idan Horowitz
9db10887a1 Kernel: Clean up sys$futex and add support for cross-process futexes 2022-07-21 16:39:22 +02:00
Andrew Kaster
f4e30d6b17 LibC: Only select Elf32_* in ElfW() macro defintion on 32-bit platforms 2022-07-21 16:37:15 +02:00
Tim Schumacher
d270c57022 du: Implement the 1k block size short option 2022-07-21 16:37:04 +02:00
Tim Schumacher
220a50111a du: Invert apparent-size behaviour
The apparent size is what `stat` says what we use. The non-apparent size
is the blocks that we actually use on-disk.
2022-07-21 16:37:04 +02:00
Tim Schumacher
d2d6e7835e du: Implement custom block sizes 2022-07-21 16:37:04 +02:00
Tim Schumacher
c938321731 du: Replace home-grown block-based size calculation with ceil_div 2022-07-21 16:37:04 +02:00
Tim Schumacher
bb5db7fba6 LibCore: Add support for long integral types to ArgsParser 2022-07-21 16:37:04 +02:00
Tim Schumacher
0f66963a56 LibCore: Implement integral ArgsParser options through a template
This keeps us from having to duplicate code for each data type we add.
2022-07-21 16:37:04 +02:00
Sam Atkins
094ba6525f LibWeb: Allow calc() inside CSS transform functions :^)
As noted, we should probably handle calc() parsing as part of parsing
other values. eg, any `<length>` can be a `calc()` that returns a
length, but we currently have to manually handle that everywhere that
doesn't use the `Parser::parse_css_value(ComponentValue)` method.
2022-07-21 16:36:08 +02:00
Sam Atkins
10ee29a8b3 LibWeb: Add helper methods for checking a calc()'s resolved type 2022-07-21 16:36:08 +02:00
Sam Atkins
93c999ce00 LibWeb: Stop handling impossible Percentage return values
When a `calc()` is resolved, it can only return a Percentage value if
the requested type is Percentage. In all other cases, it returns a
concrete value.

eg, a `calc()` with Lengths and Percentages in will always resolve to a
Length, never a Percentage. This means we can just return Length
directly instead of LengthPercentage, which simplifies things in a few
places.
2022-07-21 16:36:08 +02:00
Sam Atkins
cf6e49350e LibWeb: Handle transform in style_value_for_property() 2022-07-21 16:36:08 +02:00
Sam Atkins
469e881eca LibWeb: Mark transform property as affecting stacking contexts 2022-07-21 16:36:08 +02:00
Sam Atkins
75e0b21940 LibWeb: Store calculated transformation matrix on the StackingContext
This is mainly so we can easily read that matrix later, but also has the
benefit of only calculating the matrix once, instead of every time we
paint. :^)
2022-07-21 16:36:08 +02:00
Sam Atkins
01a3f72d39 LibWeb: Make PaintableBox private members private
These are all `m_` prefixed and only used by PaintableBox itself.
2022-07-21 16:36:08 +02:00
Sam Atkins
032646b6c3 LibWeb: Produce a transformation matrix for TransformFunction::Rotate
Currently we can't actually paint the result, but at least the maths is
correct. :^)
2022-07-21 16:36:08 +02:00
Sam Atkins
b5ab961e20 LibWeb: Add proper support for Angle parameters in transform functions
Also, made the `reference_length` parameter optional for the lambda that
extracts transform-function parameters, since it is only needed to
resolve `LengthPercentage` parameters.
2022-07-21 16:36:08 +02:00
Sam Atkins
e60beef12e LibWeb: Alphabetize style_value_for_property() list 2022-07-21 16:36:08 +02:00
Andreas Kling
237fbe4d54 LibWeb: Remember the used flex basis for each flex item
This will be consulted later on in the flex layout algorithm.
2022-07-21 01:46:26 +02:00
Andreas Kling
b7003194d2 LibWeb: Use right offset for justify-content: flex-end
Offsets in this algorithm are relative to the starting position, so it
should be 0 whether its `flex-start` or `flex-end`.
2022-07-21 01:46:25 +02:00
Andreas Kling
a6e1b9eed2 LibWeb: Snap transformed stacking contexts to pixel grid
Make sure that we're painting them at an integer pixel position, to
avoid smearing.
2022-07-21 01:46:25 +02:00
Andreas Kling
e095b9c6f9 LibWeb: Resolve auto containing block sizes before intrinsic sizing
Before performing intrinsic sizing layout on a box, we now check if its
containing block has automatic size in the relevant axis, and if so,
we fetch the size of the nearest containing block ancestor with a size.
2022-07-21 01:46:25 +02:00
Andreas Kling
da0cc9d401 LibWeb: Floor hypothetical main size at 0
The spec asks us to do this. It doesn't become relevant until we
implement box-sizing, but might as well do it anyway.
2022-07-21 01:46:25 +02:00