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
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
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
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
Luke
3b4f71e4df
Kernel/USB: Add all USB 2.0 bmRequestType fields
2021-08-14 21:22:44 +02:00
Luke
5578a5a32d
Kernel/USB: Add header containing all the current USB classes
2021-08-14 21:22:44 +02:00
Andreas Kling
97c497f9fe
Kernel: Move {Process,Thread,Session,ProcessGroup}ID to Kernel/Forward.h
2021-08-14 19:58:11 +02:00
Andreas Kling
dcb015fa7e
Kernel: Move VFS-internal O_FOO definitions to VirtualFileSystem.h
2021-08-14 19:58:11 +02:00
Andreas Kling
b47c7a2c38
Kernel: Remove unused integer typedefs from UnixTypes.h
2021-08-14 19:58:11 +02:00
Andreas Kling
e1273a8ff7
Kernel+LibC: Share definitions for sys/statvfs.h
2021-08-14 19:58:11 +02:00
Andreas Kling
dfd78b75d8
Kernel+LibC: Share definitions for sched.h
2021-08-14 19:58:11 +02:00
Andreas Kling
c9a5d83ccc
Kernel+LibC: Share definitions for sys/uio.h
2021-08-14 19:58:11 +02:00
Andreas Kling
37e98a55b7
Kernel+LibC: Share definitions for sys/ptrace.h
2021-08-14 19:58:11 +02:00
Andreas Kling
6dc688a08d
Kernel: Remove some redundant typedefs from UnixTypes.h
2021-08-14 19:58:11 +02:00
Andreas Kling
6b6eca0631
Kernel+LibC: Share definitions for sys/time.h
2021-08-14 19:58:11 +02:00
Andreas Kling
35b52338bb
Kernel+LibC: Share definitions for sys/times.h
2021-08-14 19:58:11 +02:00
Andreas Kling
808ce594db
Kernel+LibC: Share definitions for stdio.h
2021-08-14 19:58:11 +02:00
Andreas Kling
9c2212a60a
Kernel+LibC: Share definitions for unistd.h
2021-08-14 19:58:11 +02:00
Andreas Kling
d33b43276c
Kernel+LibC: Share definitions for poll.h
2021-08-14 19:58:11 +02:00
Andreas Kling
d794ed1de7
Kernel+LibC: Share definitions for utsname.h
2021-08-14 19:58:11 +02:00
Andreas Kling
c65a735d71
Kernel+LibC: Share definitions for dirent.h
2021-08-14 19:58:11 +02:00
Andreas Kling
77c2c0f620
Kernel+LibC: Share definitions for serenity.h
2021-08-14 19:58:11 +02:00
Andreas Kling
6f78377864
Kernel+LibC: Share definitions for sys/wait.h
2021-08-14 19:58:11 +02:00
Andreas Kling
661bd992b0
Kernel+LibC: Share definitions for net/{if,if_arp,route}.h
2021-08-14 19:58:11 +02:00
Andreas Kling
ff50122dc5
Kernel+LibC: Share definitions for futex.h
2021-08-14 19:58:11 +02:00
Andreas Kling
6fd7212476
Kernel+LibC: Share definitions for signal.h
2021-08-14 19:58:11 +02:00
Andreas Kling
9dc1350177
Kernel+LibC: Share definitions for netinet/in.h
2021-08-14 19:58:11 +02:00
Andreas Kling
b92e6b02e5
Kernel+LibC: Share definitions for sys/socket.h and sys/un.h
2021-08-14 19:58:11 +02:00
Andreas Kling
d277cdfd4c
Kernel+LibC: Share definitions for termios.h
2021-08-14 19:58:11 +02:00
Andreas Kling
a8d1c2dde9
Kernel+LibC: Share definitions for sys/mman.h
2021-08-14 19:58:11 +02:00
Andreas Kling
0a78056453
Kernel+LibC: Share definitions for time.h and sys/stat.h
2021-08-14 19:58:11 +02:00
Andreas Kling
740140a661
Kernel+LibC: Share definitions in fcntl.h and sys/types.h
...
This patch begins the work of sharing types and macros between Kernel
and LibC instead of duplicating them via the kludge in UnixTypes.h.
The basic idea is that the Kernel vends various POSIX headers via
Kernel/API/POSIX/ and LibC simply #include's them to get the macros.
2021-08-14 19:58:11 +02:00
Liav A
0847ad9ca0
Kernel/PCI: Assign a PCI address in the SysFS PCI device directories
...
This is a bug that went unnoticed for a long time, so the exposed values
in SysFS PCI device directories were incorrect because the assigned PCI
address was simply the host bridge always.
Also, the bus typing should really be two hexadecimal digits and not 4
digits.
2021-08-14 17:47:42 +02:00
Andreas Kling
7676edfb9b
Kernel: Stop allowing implicit conversion from KResult to int
...
This patch removes KResult::operator int() and deals with the fallout.
This forces a lot of code to be more explicit in its handling of errors,
greatly improving readability.
2021-08-14 15:19:00 +02:00
Andreas Kling
d30d776ca4
Kernel: Make FileSystem::initialize() return KResult
...
This forced me to also come up with error codes for a bunch of
situations where we'd previously just panic the kernel.
2021-08-14 15:19:00 +02:00
Andreas Kling
ef2720bcad
Kernel: Make Inode::lookup() return a KResultOr<NonnullRefPtr<Inode>>
...
This allows file systems to return arbitrary error codes instead of just
an Inode or not an Inode.
2021-08-14 13:34:59 +02:00
Luke
e06660d33c
Kernel/ProcFS: Get unveil stats instead of FDs stats for unveil data
...
It was accidentally using `procfs_get_fds_stats` instead of
`procfs_get_unveil_stats`.
2021-08-14 10:46:00 +02:00
Brian Gianforcaro
f00fde46f6
Meta: Tell user which Toolchain ARCH they need to build
...
There was some understandable confusion about this error now that we
have multiple toolchains.
2021-08-13 22:19:53 +02:00
Daniel Bertalan
85ea66932e
Kernel: Allow kfree_aligned
to be called on null pointers
...
The C++ standard specifies that `free` and `operator delete` should
be callable with nullptr. The non-aligned `kfree` already handles this,
but because of the pointer arithmetic to obtain the allocation start
pointer, the aligned version would produce undefined behavior.
2021-08-13 22:02:23 +02:00