Commit graph

39586 commits

Author SHA1 Message Date
Daniel Bertalan
cd0fb6dcc8 AK: Do not negate Pthread error codes for strerror()
On all systems I've checked, pthread functions return the positive error
code directly.
2022-07-19 12:39:24 +02:00
b14ckcat
6aea13e229 Kernel/USB: Make UHCI descriptor pool thread-safe
Right now the TD and QH descriptor pools look to be susceptible
to a race condition in the event they are accessed simultaneously
by separate threads making USB transfers. This fix does not seem to
add any noticeable overhead.
2022-07-19 11:29:58 +01:00
kleines Filmröllchen
00e13b5b27 LibDSP: Rename library namespace to DSP
That's the standard naming convention, but I didn't follow it when
originally creating LibDSP and nobody corrected me, so here I am one
year later :^)
2022-07-19 11:17:45 +01:00
kleines Filmröllchen
3f59356c79 LibAudio: Rename ConnectionFromClient to ConnectionToServer
The automatic nomenclature change for IPC sockets got this one wrong.
2022-07-19 11:17:45 +01:00
Lucas CHOLLET
70846d701c LaunchServer+SystemServer: Move the portal to a user-specific directory
Various changes are needed to support this:
 - The directory is created by Core::Account on login (and located in
   /tmp).
 - Service's sockets are now deleted on exit (to allow re-creation)
 - SystemServer needs to handle SIGTERM to correctly destroy services.
2022-07-19 11:15:14 +01:00
Lucas CHOLLET
cc0d53d6a6 LoginServer: Correctly retrieve SystemServer's exit code
The returned value of `waitpid` is the PID of the process and not the
exit code.
2022-07-19 11:15:14 +01:00
MacDue
8266ebf3c6 TextEditor: Debounce update_preview() in on_change event
This avoids lag spikes when undoing/redoing large chunks of HTML/CSS
with the HTML preview open. This had been bugging me when reducing
LibWeb issues in the text editor. The debounce timeout is 100ms
so the delay should not be noticeable.
2022-07-19 11:10:02 +01:00
MacDue
cdcdc095df LibCore: Add Core::debounce(function, timeout)
This is a simple helper to debounce a function call, such as
an event handler. It avoids the function being called until
the event as settled down (i.e. after the timeout).
2022-07-19 11:10:02 +01:00
Liav A
f96e8e97e6 Kernel/Storage: Remove redundant reference to a controller in IDEChannel
IDEChannel which is an ATAPort derived class holded a NonnullRefPtr to a
parent IDEController, although we can easily defer the usage of it to
not be in the IDEChannel code at all, so it allows to keep NonnullRefPtr
to the parent ATAController in the ATAPort base class and only there.
2022-07-19 11:07:34 +01:00
Liav A
0810c1b972 Kernel/Storage: Introduce basic abstraction layer for ATA components
This abstraction layer is mainly for ATA ports (AHCI ports, IDE ports).
The goal is to create a convenient and flexible framework so it's
possible to expand to support other types of controller (e.g. Intel PIIX
and ICH IDE controllers) and to abstract operations that are possible on
each component.

Currently only the ATA IDE code is affected by this, making it much
cleaner and readable - the ATA bus mastering code is moved to the
ATAPort code so more implementations in the near future can take
advantage of such functionality easily.

In addition to that, the hierarchy of the ATA IDE code resembles more of
the SATA AHCI code now, which means the IDEChannel class is solely
responsible for getting interrupts, passing them for further processing
in the ATAPort code to take care of the rest of the handling logic.
2022-07-19 11:07:34 +01:00
Liav A
7719ef3a61 Kernel/Storage: Move ATA device signature definitions to a general file 2022-07-19 11:07:34 +01:00
Liav A
2c987367e6 Kernel/Storage: Merge IDE functionality from BusMasterChannel to Channel
This simplifies the flow of how things work currently and is a step for
more improvements in the next commits.
2022-07-19 11:07:34 +01:00
Liav A
ade672c576 Kernel/Storage: Rename ATA.h => Definitions.h 2022-07-19 11:07:34 +01:00
Liav A
c001e3f567 Kernel/Storage: Move AHCI and IDE code into new subdirectories
We do that to increase clarity of the major and secondary components in
the subsystem. To ensure it's even more understandable, we rename the
files to better represent the class within them and to remove redundancy
in the name.

Also, some includes are removed from the general components of the ATA
components' classes.
2022-07-19 11:07:34 +01:00
Liav A
a70e1a0340 Utilities: Remove the edid-dump utility
This short-lived utility was essential when we had to use the ioctl
interface to fetch the EDID from a DisplayConnector, but now that we can
simply read it from SysFS, this utility is no longer needed and can be
removed.
2022-07-19 11:02:37 +01:00
Liav A
412a5999d0 Kernel+Userland: Remove GRAPHICS_IOCTL_GET_HEAD_EDID ioctl
We are able to read the EDID from SysFS, therefore there's no need to
provide this ioctl on a DisplayConnector anymore.
Also, now we can simply require the video pledge to be set before doing
any ioctl on a DisplayConnector.
2022-07-19 11:02:37 +01:00
Liav A
ecf015e6ee Userland: Make graphics_connector_get_head_edid to read EDID from SysFS
The EDID blob is now exposed in the SysFS for each DisplayConnector, so
we don't need to use the ioctl interface anymore to read the EDID.
2022-07-19 11:02:37 +01:00
Liav A
3af70cb0fc Kernel/Devices: Abstract SysFS Device add/remove methods more properly
It is starting to get a little messy with how each device can try to add
or remove itself to either /sys/dev/block or /sys/dev/char directories.

To better do this, we introduce 4 virtual methods to take care of that,
so until we ensure all nodes in /sys/dev/block and /sys/dev/char are
actual symlinks, we allow the Device base class to call virtual methods
upon insertion or before being destroying, so it add itself elegantly to
either of these directories or remove itself when needed.

For special cases where we need to create symlinks, we have two virtual
methods to be called otherwise to do almost the same thing mentioned
before, but to use symlinks instead.
2022-07-19 11:02:37 +01:00
Liav A
da8d18b263 Kernel/SysFS: Add exposing interface for DisplayConnectors
Under normal conditions (when mounting SysFS in /sys), there will be a
new directory in the /sys/devices directory called "graphics".
For now, under that directory there will be only a sub-directory called
"connectors" which will contain all DisplayConnectors' details, each in
its own sub-directory too, distinguished in naming with its minor
number.

Therefore, /sys/devices/graphics/connectors/MINOR_NUMBER/ will contain:
- General device attributes such as mutable_mode_setting_capable,
  double_buffering_capable, flush_support, partial_flush_support and
  refresh_rate_support. These values are exposed in the ioctl interface
  of the DisplayConnector class too, but these can be useful later on
  for command line utilities that want/need to expose these basic
  settings.
- The EDID blob, simply named "edid". This will help userspace to fetch
  the edid without the need of using the ioctl interface later on.
2022-07-19 11:02:37 +01:00
Liav A
cb900006b9 Utilities/lspci: Don't unveil /res/pci.ids if not asked to resolve IDs
I tested the grub image under VirtualBox and it appeared that the image
didn't have pci.ids file included in the /res directory. In that case it
would be expected that lspci can still function correctly if the -n
parameter is passed, but then the unveil syscall failed because the file
didn't exist.

To cope with this, we should allow lspci to work without the pci.ids
file being present at the filesystem, so let's not unveil this file if
the -n parameter is passed.
2022-07-19 11:02:25 +01:00
Tim Schumacher
a857b6297a Toolchain: Don't pass -lpthread when pthreads are requested
This is essentially a no-op since we have our replacement linker script,
but if we can skip over that entirely, why not?
2022-07-19 11:00:35 +01:00
Tim Schumacher
5870484d1a LibC: Remove the LibPthread interface target 2022-07-19 11:00:35 +01:00
Tim Schumacher
28061cf94d Everywhere: Fully remove the separate LibPthread directory 2022-07-19 11:00:35 +01:00
Tim Schumacher
dac361e330 Tests: Move the LibPthread tests to the correct namespace 2022-07-19 11:00:35 +01:00
Tim Schumacher
2f3b9c49a5 LibPthread: Move the pthread and semaphore implementation to LibC
This additionally adds some compatibility code to redirect linking
attempts for LibPthread to LibC instead.
2022-07-19 11:00:35 +01:00
Tim Schumacher
e156f79f53 Everywhere: Refer to pthread.h by its non-prefixed name
This removes a bit of noise from the following patches, where we will
move the `pthread.h` header out of the `LibPthread` directory.
2022-07-19 11:00:35 +01:00
djwisdom
268c146c04 Ports: Update serenity-theming use latest commit 98ea1b3 2022-07-19 10:50:05 +01:00
Lucas CHOLLET
7a8104e79b LibGUI: Add MoveLineUpOrDownCommand
This allows lines moved by Ctrl+Shift+[Up, Down] to be registered as a
command, i.e. cancellable by Ctrl+Z.

This patch also introduces the usage of TextDocument::[take,
insert]_line. Those functions forward changes to the visual lines and
then avoid some data mismatch.

Co-authored-by: Jorropo <jorropo.pgm@gmail.com>
2022-07-19 10:49:38 +01:00
Lucas CHOLLET
cf693136e2 LibGUI: Remove wrong casts in TextDocument.cpp 2022-07-19 10:49:38 +01:00
Lucas CHOLLET
d391f1fb2a LibGUI: Add TextDocument::take_line(size_t line_index)
This method is similar in all respects to remove_line except that it
returns the removed line.
2022-07-19 10:49:38 +01:00
Lucas CHOLLET
a85223e13b LibGUI: Add a default virtual destructor to virtual classes
Affected classes are children of TextDocumentUndoCommand:
 - InsertTextCommand
 - RemoveTextCommand
 - ReplaceAllTextCommand
2022-07-19 10:49:38 +01:00
Lucas CHOLLET
cb4844bf64 LibGUI: Add VerticalDirection::operator!
This allows to invert the direction of a VerticalDirection.
2022-07-19 10:49:38 +01:00
Andrew Kaster
9c2211f246 Meta: Add Android cross-compile support to Lagom
This is a start to properly letting us cross-compile Lagom where both
the Tools and the BUILD_LAGOM=ON build are using Lagom CMakeLists.

The initial cut allows an Android build to succeed, more or less.
But there are issues with namespace clashes when using FetchContent with
this approach.
2022-07-19 10:44:02 +01:00
Andrew Kaster
d84fc60f96 LibCore: Add support for compiling for Android with API Version >= 30
Most changes are around user and group management, which are exposed in
the Android NDK differently than other Unices.

We require version 30 for memfd_create, version 28 for posix_spawn, and
so on. It's possible a shim for memfd_create could be used, but since
Google is mandating new apps use API level 30 as of Nov 2022, this seems
suitable.
2022-07-19 10:44:02 +01:00
Andrew Kaster
3b15addbc8 AK: Add support for building on Android with API version >= 30 2022-07-19 10:44:02 +01:00
DexesTTP
686c15149e headless-browser: Simplify the arguments used to select resources
We can just infer the favicon, fonts and palette from the location of
the /res folder, no need to ask each of the resources one by one.
2022-07-19 08:02:52 +01:00
DexesTTP
9e5af374d0 headless-browser: Split the setters for the screen and the viewport rect
These two represent different things, and should be handled by different
methods.
2022-07-19 08:02:52 +01:00
DexesTTP
9c431ede7a headless-browser: Use port 443 as default for HTTPS requests 2022-07-19 08:02:52 +01:00
Linus Groh
f33df0ee05 LibWeb: Split WrapperGenerator namespace check into an Array + contains
Also sort the entries alphabetically while we're here :^)
2022-07-19 00:46:04 +01:00
Linus Groh
ed49b66f25 LibWeb: Implement '5.1. Headers class' from the Fetch API :^) 2022-07-19 00:27:35 +01:00
Linus Groh
b5ab1f6b4a LibWeb: Implement HeaderList::sort_and_combine() 2022-07-19 00:27:35 +01:00
Linus Groh
bad6ad8861 LibWeb: Implement CaseInsensitiveBytesTraits::equals()
Turns out HashTable::contains() doesn't solely use hash() for equality
checks, so the lack of a proper equals() implementation broke the check
in convert_header_names_to_a_sorted_lowercase_set() and caused duplicate
entries in header_names_set.
2022-07-19 00:27:35 +01:00
Linus Groh
6b64ca4bb8 LibWeb: Prepare WrapperGenerator for Fetch bindings 2022-07-19 00:27:35 +01:00
Linus Groh
2726fc9c73 LibWeb: Move Fetch infra into the Web::Fetch::Infrastructure namespace
The Fetch spec unfortunately will cause a name clash between the Request
concept and the Request JS object - both cannot live in the Web::Fetch
namespace, and WrapperGenerator generally assumes `Web::<Name>` for
things living in the `<Name>/` subdirectory, so let's instead move infra
code into its own namespace - it already sits in a (sub-)subdirectory
anyway.
2022-07-19 00:27:35 +01:00
Timothy Flynn
4b415a23c1 LibJS: Implement Intl.NumberFormat V3's [[RoundingIncrement]] changes 2022-07-18 23:37:31 +01:00
Timothy Flynn
8ee485c350 LibJS: Implement Intl.NumberFormat V3's [[RoundingMode]] changes 2022-07-18 23:37:31 +01:00
Timothy Flynn
800a0ddc63 LibJS: Relax integer size requirements on some NumberFormat helpers
These were changed to i8 while investigating the issues fixed by commit
9e50f25. When [[RoundingIncrement]] is implemented, some of these will
be invoked with [[RoundingIncrement]]'s value, which can be up to 5000.
Change these to i32, and wrap them with AK::Checked for good measure.
Also change a couple helpers that are always comparing against zero to
not need an explicit check.
2022-07-18 23:37:31 +01:00
Timothy Flynn
cb5f7bf696 LibJS: Add missing VERIFY_NOT_REACHED in string-to-enum conversion
Noticed this while working on [[RoundingMode]].
2022-07-18 23:37:31 +01:00
Kenneth Myhra
0a511e29d1 LibWeb: Add support for Blob to XHR::send() 2022-07-18 14:57:58 +01:00
Kenneth Myhra
9b3da5a142 LibWeb: Move extract_body() towards spec compliance 2022-07-18 14:57:58 +01:00