Commit graph

25773 commits

Author SHA1 Message Date
Brian Gianforcaro
3cbc2364a8 AK: Annotate AK::Time APIs as [[nodiscard]] 2021-08-15 12:20:38 +02:00
Brian Gianforcaro
dae17ce7e3 AK: Add Time::now_<clock_id> functions for obtaining the current time
In the quest of removing as timespec / timeval usage in the Userland as
possible, we need a way to conveniently retrieving the current clock
time from the kernel and storing it in `AK::Time` format.
2021-08-15 12:20:38 +02:00
Brian Gianforcaro
188e5f018f ddate: Use DateTime::now() for time 2021-08-15 12:20:38 +02:00
Brian Gianforcaro
3870f4160d date: Use DateTime::now() for time, cleanup duplicate returns 2021-08-15 12:20:38 +02:00
sin-ack
98408b8920 Kernel: Don't hold the process list lock while destructing the process
Once we remove the process from the process list, we're free to do
whatever we want without any locks.
2021-08-15 12:17:29 +02:00
Linus Groh
4520863c0e LibJS/Tests: Add test for PlainMonthDay default reference year 2021-08-15 10:36:36 +01:00
Linus Groh
8f7a9e1e5c LibJS/Tests: Add test for PlainYearMonth default reference day 2021-08-15 10:36:36 +01:00
Linus Groh
1549845389 LibJS: Implement Temporal.PlainMonthDay.prototype.getISOFields() 2021-08-15 10:36:36 +01:00
Linus Groh
7fb05eb878 LibJS: Implement Temporal.PlainMonthDay.prototype.valueOf() 2021-08-15 10:36:36 +01:00
Linus Groh
c2ed3ad66b LibJS: Implement Temporal.PlainMonthDay.prototype.day 2021-08-15 10:36:36 +01:00
Linus Groh
9551aa17d3 LibJS: Implement Temporal.PlainMonthDay.prototype.monthCode 2021-08-15 10:36:36 +01:00
Linus Groh
1382be1707 LibJS: Implement Temporal.PlainMonthDay.prototype.calendar 2021-08-15 10:36:36 +01:00
Linus Groh
37b5a0715e LibJS: Implement Temporal.PlainMonthDay.prototype[@@toStringTag] 2021-08-15 10:36:36 +01:00
Linus Groh
0cf526d0c4 LibJS: Handle PlainMonthDay in the Calendar.prototype getters 2021-08-15 10:36:36 +01:00
Linus Groh
b76bae13fd LibJS: Handle PlainMonthDay in ISO{Year,Month,MonthCode,Day} 2021-08-15 10:36:36 +01:00
Linus Groh
ec00d4729a LibJS: Handle PlainMonthDay in GetTemporalCalendarWithISODefault 2021-08-15 10:36:36 +01:00
Linus Groh
1e54e37228 LibJS: Handle PlainMonthDay in ToTemporalCalendar 2021-08-15 10:36:36 +01:00
Linus Groh
be07e2e91b LibJS: Start implementing Temporal.PlainMonthDay
This commit adds the PlainMonthDay object itself, its constructor and
prototype (currently empty), and the CreateTemporalMonthDay abstract
operations.
2021-08-15 10:36:36 +01:00
Linus Groh
301d622b46 LibJS/Tests: Tweak PlainYearMonth Infinity test values
Since we want to test that +/- Infinity fails as an argument, we should
provide valid arguments for everything else - 0 for month isn't :^)
2021-08-15 10:36:36 +01:00
sin-ack
24fcff45ae Kernel: Make Process final
This silences a clangd diagnostic about Process holding virtual
functions but having a non-virtual destructor.
2021-08-15 02:27:13 +02:00
sin-ack
18f260b78b Kernel: Handle removal of Process from list before unref
This makes the following scenario impossible with an SMP setup:

1) CPU A enters unref() and decrements the link count to 0.
2) CPU B sees the process in the process list and ref()s it.
3) CPU A removes the process from the list and continues destructing.
4) CPU B is now holding a destructed Process object.

By holding the process list lock before doing anything with it, we
ensure that other CPUs can't find this process in the middle of it being
destructed.
2021-08-15 02:27:13 +02:00
sin-ack
2830a0ecda Kernel: Move ProcFS related overrides in Process to ProcessProcFSTraits
This allows us to 1) let go of the Process when an inode is ref'ing for
ProcFSExposedComponent related reasons, and 2) change our ref/unref
implementation.
2021-08-15 02:27:13 +02:00
sin-ack
748938ea59 Kernel: Handle allocation failure in ProcFS and friends
There were many places in which allocation failure was noticed but
ignored.
2021-08-15 02:27:13 +02:00
sin-ack
134dbe2607 AK: Add adopt_nonnull_ref_or_enomem
This gets rid of the ENOMEM boilerplate for handling memory allocation
failures in the kernel.
2021-08-15 02:27:13 +02:00
Nico Weber
f25be94487 LibCore: Make --version print same version as in LibGUI's About dialogs
Making every binary's behavior depend on the current git hash seems a
bit questionable to me, but we should be self-consistent about this.
2021-08-15 01:22:45 +02:00
Nico Weber
faa2c74b49 LibGUI: Simplify AboutDialog::version_string()
No behavior change.
2021-08-15 01:22:45 +02:00
Nico Weber
a45b6dbc07 LibCore: Include math.h instead of defining isnan() in ArgsParser.cpp 2021-08-15 01:22:45 +02:00
Linus Groh
87b2a6004f CI: Add a hello world step to azure-pipelines.yml so it stops failing 2021-08-14 22:43:34 +01:00
Linus Groh
6f9b87948b CI: Add required stages parameter to azure-pipelines.yml 2021-08-14 22:35:24 +01:00
Idan Horowitz
04359995a7 LibJS: Exclude FinalizationRegistries with queued cleanup jobs from GC
This is done by just adding them to the list of GC roots, which
prevents the VM from trying to run cleanup job of garbage collected
registries.
2021-08-14 22:32:31 +01:00
Kenneth Myhra
df176ca2d9 Ports: Add glib version 2.69.0 2021-08-14 22:32:00 +01:00
Kenneth Myhra
cb10c62327 LibC: Add SOCK_RDM and SOCK_SEQPACKET to socket.h 2021-08-14 22:32:00 +01:00
Kenneth Myhra
3875e8bd4b LibC: Add IPV6_JOIN_GROUP and IPV6_LEAVE_GROUP to netin/in.h 2021-08-14 22:32:00 +01:00
Kenneth Myhra
f8d27303d0 LibC: Add stubs for several functions in xattr.h
The following functions are stubbed out:
- getxattr
- lgetxattr
- fgetxattr
- setxattr
- lsetxattr
- fsetxattr
- listxattr
- llistxattr
- flistxattr
2021-08-14 22:32:00 +01:00
Kenneth Myhra
04733ccb56 LibC: Add stub for res_query 2021-08-14 22:32:00 +01:00
Kenneth Myhra
8abfcb976d LibC: Add stub for fnmatch and a set of defined values
This adds a stub for fnmatch and the following defined values:
- FNM_PATHNAME
- FNM_NOESCAPE
- FNM_PERIOD
- FNM_FILE_NAME
- FNM_LEADING_DIR
- FNM_CASEFOLD
- FNM_EXTMATCH
2021-08-14 22:32:00 +01:00
Kenneth Myhra
8d19d8861a LibC: Add FIONREAD to ioctl.h 2021-08-14 22:32:00 +01:00
Kenneth Myhra
78eba1271f LibC: Add function fdopendir
This adds the function fdopendir and refactors opendir so that opendir
just opens a file descriptor and passes the file descriptor onto
fdopendir.
2021-08-14 22:32:00 +01:00
Luke
51b6bd8d95 Kernel/USB: Remove UAF in device removal
I was using a raw pointer instead of a RefPtr to keep the device alive
during removal.
2021-08-14 23:14:56 +02:00
Linus Groh
a548366425 CI: Set up Azure Pipelines
[skip ci]
2021-08-14 20:29:20 +01:00
Luke
4b4525dfc7 Kernel/USB: Update SysFS from the generic hub instead of from UHCI 2021-08-14 21:22:44 +02:00
Luke
872c75ac44 Kernel/USB: Split SysFS code into its own file
This makes it controller agnostic and allows us to access it from the
USB hub code.

The copyright says "Liav A." because git blame says he wrote this.
2021-08-14 21:22:44 +02:00
Luke
b6a2bbba3b Kernel/USB: Replace PortNumber enum with a raw u8
A hub can technically have up to 255 ports, given that bNbrPorts is a
u8 and the DeviceRemovable field is a VLA to support up to 255 ports.

Source: USB 2.0 Specification Section 11.23.2.1

That means this enum is not going to scale well in terms of size.
Replacing it with a raw u8 allows me to remove the two port assumption
and a cast.
2021-08-14 21:22:44 +02:00
Luke
86ccacf6b5 Kernel/USB: Remove get_device_{at_port,from_address}
Nothing was using these. These can be put back in the future if
required. This also allows removing the devices array in UHCI.
2021-08-14 21:22:44 +02:00
Luke
da0a1068e9 Kernel/USB: Add Hubs and the UHCI Root Hub 2021-08-14 21:22:44 +02:00
Luke
9dcd146ab4 Kernel/USB: Add the USB 1.x/2.0 hub descriptor
There is a different hub descriptor for USB 3.0, but this isn't
included here.
2021-08-14 21:22:44 +02:00
Luke
14da080dcf Kernel/USB: Use allocate_kernel_region in Transfer buffer allocations
Previously it would create a contiguous AVMO manually and pass it to
MM. This uses supervisor pages that quickly run out as they never get
returned and crash the system.

Instead, use allocate_kernel_region as we're only allocating a page so
it will be contiguous and will be returned when destroyed.

A potentially better solution would be to use a pool of transfers to
avoid all the allocations. This just prevents the system from crashing
within ~5 seconds from the continuous hub polling.
2021-08-14 21:22:44 +02:00
Luke
1ca5b6caa9 Kernel/USB: Pass in device address as last argument to Pipe constructor
The order of poll_interval and device_address was flipped.
2021-08-14 21:22:44 +02:00
Luke
7dd1786b13 Kernel/USB: Use "Pipe" instead of "USBPipe" in USBEndpoint
This wasn't caught before because nothing was including this header.
2021-08-14 21:22:44 +02:00
Luke
035aef9c09 Kernel/USB: Add endpoint directions and make endpoint constants public 2021-08-14 21:22:44 +02:00