Commit Graph

306 Commits

Author SHA1 Message Date
Ben Wiederhake
87eac0e424 Kernel: Add missing include in API
This remained undetected for a long time as HeaderCheck is disabled by
default. This commit makes the following file compile again:

    // file: compile_me.cpp
    #include <Kernel/API/POSIX/ucontext.h>
    // That's it, this was enough to cause a compilation error.
2022-09-18 13:27:24 -04:00
James Bellamy
9c1ee8cbd1 Kernel: Remove big lock from sys$socket
With the implementation of the credentials object the socket syscall no
longer needs the big lock.
2022-08-23 20:29:50 +02:00
Andreas Kling
930dedfbd8 Kernel: Make sys$utime() and sys$utimensat() not take the big lock 2022-08-22 17:56:03 +02:00
Andreas Kling
35b2e9c663 Kernel: Make sys$mknod() not take the big lock 2022-08-22 17:56:03 +02:00
Andreas Kling
18abba2c4d Kernel: Make sys$getppid() not take the big lock
This only needs to access the process PPID, which is protected by the
"protected data" lock.
2022-08-21 13:29:36 +02:00
Andreas Kling
9eeee24a39 Kernel+LibC: Enforce a limit on the number of supplementary group IDs
This patch adds the NGROUPS_MAX constant and enforces it in
sys$setgroups() to ensure that no process has more than 32 supplementary
group IDs.

The number doesn't mean anything in particular, just had to pick a
number. Perhaps one day we'll have a reason to change it.
2022-08-20 22:39:56 +02:00
Andreas Kling
998c1152ef Kernel: Mark syscalls that get/set user/group ID as not needing big lock
Now that these operate on the neatly atomic and immutable Credentials
object, they should no longer require the process big lock for
synchronization. :^)
2022-08-20 18:36:47 +02:00
Samuel Bowman
b5a2f59320 Kernel: Make sys$unveil() not take the big process lock
The unveil syscall uses the UnveilData struct which is already
SpinlockProtected, so there is no need to take the big lock.
2022-08-18 00:04:31 +02:00
Andreas Kling
ce6e93d96b Kernel: Make sys$socketpair() not take the big lock
This system call mainly accesses the file descriptor table, and this is
already guarded by MutexProtected.
2022-08-16 20:43:23 +02:00
Andreas Kling
307932857e Kernel: Make sys$pipe() not take the big lock
This system call mainly accesses the file descriptor table, and this is
already guarded by MutexProtected.
2022-08-16 20:20:11 +02:00
Andreas Kling
e7d2696a56 Kernel: Shrink default userspace stack size from 4 MiB to 1 MiB
This knocks 70 MiB off our idle footprint, (from 350 MiB to 280 MiB.)
2022-08-15 17:18:11 +02:00
zzLinus
ca74443012 Kernel/LibC: Implement posix syscall clock_getres() 2022-07-25 15:33:50 +02:00
Liav A
977aa81310 Kernel+Userland: Add ioctl to set process ownership of DisplayConnector
Now that the infrastructure of the Graphics subsystem is quite stable,
it is time to try to fix a long-standing problem, which is the lack of
locking on display connector devices. Reading and writing from multiple
processes to a framebuffer controlled by the display connector is not a
huge problem - it could be solved with POSIX locking.

The real problem is some program that will try to do ioctl operations on
a display connector without the WindowServer being aware of that which
can lead to very bad situations, for example - assuming a framebuffer is
encoded at a known resolution and certain display timings, but another
process changed the ModeSetting of the display connector, leading to
inconsistency on the properties of the current ModeSetting.

To solve this, there's a new "master" ioctl to take "ownership" and
another one to release that ownership of a display connector device. To
ensure we will not hold a Process object forever just because it has an
ownership over a display connector, we hold it with a weak reference,
and if the process is gone, someone else can take an ownership.
2022-07-23 10:42:08 +01:00
Liav A
1968aba69b Kernel+Userland: Rename FB.h => Graphics.h
This header file represents the entire interface between the kernel and
userland, and as such, no longer should be called FB.h but something
that represents the whole graphics subsystem.
2022-07-23 10:42:08 +01:00
Idan Horowitz
9db10887a1 Kernel: Clean up sys$futex and add support for cross-process futexes 2022-07-21 16:39:22 +02: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
Hendiadyoin1
d783389877 Kernel+LibC: Add posix_fallocate syscall 2022-07-15 12:42:43 +02:00
Tim Schumacher
cf0ad3715e Kernel: Implement sigsuspend using a SignalBlocker
`sigsuspend` was previously implemented using a poll on an empty set of
file descriptors. However, this broke quite a few assumptions in
`SelectBlocker`, as it verifies at least one file descriptor to be
ready after waking up and as it relies on being notified by the file
descriptor.

A bare-bones `sigsuspend` may also be implemented by relying on any of
the `sigwait` functions, but as `sigsuspend` features several (currently
unimplemented) restrictions on how returns work, it is a syscall on its
own.
2022-07-08 22:27:38 +00:00
Tim Schumacher
5efa8e507b Kernel: Implement an axallowed mount option
Similar to `W^X` and `wxallowed`, this allows for anonymous executable
mappings.
2022-07-08 22:27:38 +00:00
Andrew Kaster
455038d6fc Kernel: Add sysconf for IOV_MAX 2022-06-19 09:05:35 +02:00
SeekingBlues
8730e56e88 LibC: Add WIFCONTINUED macro
Like other systems, we can encode the continued state with 0xffff in the
status value. This is needed for some ports.
2022-06-17 10:59:26 +02:00
Timur Sultanov
0a63461341 Kernel: Add s6_addr32 field in in6_addr struct 2022-06-12 00:28:26 +01:00
brapru
7a4e41f8f8 Kernel: Add support for route flags
Previously the routing table did not store the route flags. This
adds basic support and exposes them in the /proc directory so that a
userspace caller can query the route and identify the type of each
route.
2022-05-26 16:33:10 +02:00
Peter Elliott
1c86678a64 Kernel: Change values of SHUT_{RD,WR,RDWR}
For some reason, guile requires these to be specific values.
2022-05-23 00:13:26 +02:00
Ariel Don
9a6bd85924 Kernel+LibC+VFS: Implement utimensat(3)
Create POSIX utimensat() library call and corresponding system call to
update file access and modification times.
2022-05-21 18:15:00 +02:00
Liav A
e301af8352 Everywhere: Purge all support and usage of framebuffer devices
Long live the DisplayConnector object!
2022-05-05 20:55:57 +02:00
Liav A
aad968cc5e Everywhere: Rename fb prefix function names => graphics_connector 2022-05-05 20:55:57 +02:00
Liav A
10adc27eda Everywhere: Rename FB prefix structure names => Graphics 2022-05-05 20:55:57 +02:00
Liav A
d2e93ec50a Everywhere: Rename FB prefix name ioctls => GRAPHICS 2022-05-05 20:55:57 +02:00
Liav A
4ff6150f1b WindowServer: Use FB_IOCTL_FLUSH_HEAD to flush a framebuffer if possible
This ioctl is more appropriate when the hardware supports flushing of
the entire framebuffer, so we use that instead of the previous default
FB_IOCTL_FLUSH_HEAD_BUFFERS ioctl.
2022-05-05 20:55:57 +02:00
Liav A
6d7e2596e0 WindowServer: Implement mechanism to restore safe mode setting
Such mechanism will be used by the Intel Graphics driver, because we
lack support of changing the resolution on this driver currently, so,
when WindowServer will try to mode-set the display then it will fail,
and will use the safe mode-setting call instead to be able to show
something on screen.
2022-05-05 20:55:57 +02:00
Liav A
d9a2706079 DisplaySettings+WindowServer: Add support for display connector devices 2022-05-05 20:55:57 +02:00
Tim Schumacher
0ce43fae9c Kernel: Add IPv4 network class masks 2022-05-05 20:47:38 +02:00
Tim Schumacher
7dd4648565 Kernel: Add IPsec ESP and AH protocol numbers 2022-05-05 20:47:38 +02:00
Tim Schumacher
098af0f846 Kernel: Properly define IOV_MAX 2022-05-05 20:47:38 +02:00
Tim Schumacher
6d59d4d3d9 Kernel: Add the remaining POSIX MADV_* constants 2022-05-05 20:47:38 +02:00
Tim Schumacher
94ab75d3df Kernel: Add O_SYNC into fcntl.h 2022-05-05 20:47:38 +02:00
Patrick Meyer
0bd131ad06 Kernel: Stop requiring working malloc for syscall.h includes
Fixes #13869
2022-05-02 12:44:34 +02:00
brapru
8596b1e0c3 Kernel: Add a global routing table
Previously the system had no concept of assigning different routes for
different destination addresses as the default gateway IP address was
directly assigned to a network adapter. This default gateway was
statically assigned and any update  would remove the previously existing
route.

This patch is a beginning step towards implementing #180. It implements
a simple global routing table that is referenced during the routing
process. With this implementation it is now possible for a user or
service (i.e. DHCP) to dynamically add routes to the table.

The routing table will select the most specific route when possible. It
will select any direct match between the destination and routing entry
addresses. If the destination address overlaps between multiple entries,
the Kernel will use the longest prefix match, or the longest number of
matching bits between the destination address and the routing address.
In the event that there is no entries found for a specific destination
address, this implementation supports entries for a default route to be
set for any specified interface.

This is a small first step towards enhancing the system's routing
capabilities. Future enhancements would include referencing a
configuration file at boot to load pre-defined static routes.
2022-04-28 08:41:11 -07:00
Andreas Kling
20d21fad7b Kernel: Add ESTALE errno code (stale network file handle) 2022-04-26 14:05:49 +02:00
sin-ack
bc7c8879c5 Kernel+LibC+LibCore: Implement the unlinkat(2) syscall 2022-04-23 10:43:32 -07:00
Idan Horowitz
e84bbfed44 Kernel: Remove big lock from sys$mkdir
This syscall doesn't access any unprotected shared data.
2022-04-09 23:46:02 +02:00
Idan Horowitz
165a23b68c Kernel: Remove big lock from sys$rename
This syscall doesn't access any unprotected shared data.
2022-04-09 23:46:02 +02:00
Idan Horowitz
5c064d3e8e Kernel: Remove big lock from sys$rmdir
This syscall doesn't access any unprotected shared data.
2022-04-09 23:46:02 +02:00
Idan Horowitz
d4ce43cf45 Kernel: Remove big lock from sys$statvfs
This syscall doesn't access any unprotected shared data.
2022-04-09 23:46:02 +02:00
Idan Horowitz
4ae93179f1 Kernel: Remove big lock from sys$symlink
This syscall doesn't access any unprotected shared data.
2022-04-09 23:46:02 +02:00
Idan Horowitz
1474b18070 Kernel: Remove big lock from sys$link
This syscall doesn't access any unprotected shared data.
2022-04-09 23:46:02 +02:00
Idan Horowitz
fa360f7d88 Kernel: Remove big lock from sys$unlink
This syscall doesn't access any unprotected shared data.
2022-04-09 23:46:02 +02:00
Idan Horowitz
5a96260e25 Kernel: Remove big lock from sys$setsockopt
This syscall doesn't access any unprotected shared data.
2022-04-09 23:46:02 +02:00
Idan Horowitz
c2372242b1 Kernel: Remove big lock from sys$getsockopt
This syscall doesn't access any unprotected shared data.
2022-04-09 23:46:02 +02:00