summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibC/sys
AgeCommit message (Collapse)Author
2022-05-05Everywhere: Purge all support and usage of framebuffer devicesLiav A
Long live the DisplayConnector object!
2022-05-05Everywhere: Rename FB prefix structure names => GraphicsLiav A
2022-05-05Everywhere: Rename FB prefix name ioctls => GRAPHICSLiav A
2022-05-05DisplaySettings+WindowServer: Add support for display connector devicesLiav A
2022-05-05Kernel/Graphics: Introduce the DisplayConnector classLiav A
The DisplayConnector class is meant to replace the FramebufferDevice class. The advantage of this class over the FramebufferDevice class is: 1. It removes the mmap interface entirely. This interface is unsafe, as multiple processes could try to use it, and when switching to and from text console mode, there's no "good" way to revoke a memory mapping from this interface, let alone when there are multiple processes that call this interface. Therefore, in the DisplayConnector class there's no implementation for this method at all. 2. The class uses a new real-world structure called ModeSetting, which takes into account the fact that real hardware requires more than width, height and pitch settings to mode-set the display resolution. 3. The class assumes all instances should supply some sort of EDID, so it facilitates such mechanism to do so. Even if a given driver does not know what is the actual EDID, it will ask to create default-generic EDID blob. 3. This class shifts the responsibilies of switching between console mode and graphical mode from a GraphicsAdapter to the DisplayConnector class, so when doing the switch, the GraphicsManagement code actually asks each DisplayConnector object to do the switch and doesn't rely on the GraphicsAdapter objects at all.
2022-04-29LibC: Add MIN, MAX and howmany macros to sys/param.hAndreas Kling
2022-04-29Kernel: Support userspace TTY graphics modesettingPeter Elliott
This is a copy of linux's KDSETMODE/KDGETMODE console ioctl(2) interface.
2022-04-26Kernel: Add FIOCLEX and FIONCLEX ioctlsAndreas Kling
These allow you to turn the close-on-exec flag on/off via ioctl().
2022-04-01Everywhere: Run clang-formatIdan Horowitz
2022-03-29LibC: Make prctl() a varargs functionTim Schumacher
2022-03-22Kernel/TTY: Implement TIOCGPTN ioctl for MasterPTYLiav A
This ioctl operation will allow userspace to determine the index number of a MasterPTY after opening /dev/ptmx and actually getting an internal file descriptor of MasterPTY.
2022-03-14Kernel: Sandbox each GPU3DDevice file description into own host contextSahan Fernando
2022-03-09LibC: Add ioctls for VirGLSahan Fernando
2022-03-04Kernel: Add support for SA_SIGINFOAli Mohammad Pur
We currently don't really populate most of the fields, but that can wait :^)
2022-02-28LibC: Define offsetof in stddef.h instead of sys/cdefs.hAndrew Kaster
Just like Dr. POSIX ordered. Move the macro where it belongs, but make sure it's visible to Userland files compiled with -DKERNEL. Parts of LibEDID that are compiled into the Kernel use offsetof to parse the EDID information given to us by hardware.
2022-02-28LibC: Don't export ALWAYS_INLINE from sys/cdefs.hAndrew Kaster
POSIX doesn't tell us to export a macro like this, and it's largely going to never be defined when compiling a serenity-native C++ file, since AK defines it already. This does raise a strange issue where some futex-related helpers in serenity.h are declared with ALWAYS_INLINE. Whether these helpers belong in a C-visible header as file-static methods is questionable, but let's work around the issue but adding some preprocessor magic to make sure these declarations get the behavior they used to have without leaking macros.
2022-01-23Kernel: Add ioctl to get the EDID from a framebufferTom
2022-01-12Kernel+LibC+LibCore+UE: Implement `fchmodat(2)`Daniel Bertalan
This function is an extended version of `chmod(2)` that lets one control whether to dereference symlinks, and specify a file descriptor to a directory that will be used as the base for relative paths.
2022-01-09Everywhere: Add `serenity_dev_{makedev,major,minor}`Michel Hermier
Add them in `<Kernel/API/Device.h>` and use these to provides `{makedev,major,minor}` in `<sys/sysmacros.h>`. It aims to be more in line with other Unix implementations and avoid code duplication in user land.
2022-01-08LibC+LibDl: Declare functions taking no arguments as taking voidDaniel Bertalan
In C++, a function declaration with an empty parameter list means that the function takes no arguments. In C, however, it means that the function takes an unspecified number of parameters. What we did previously was therefore non-conforming. This caused a config check to fail in the curl port, as it was able to redeclare `rand` as taking an int parameter.
2022-01-07Everywhere: Fix spelling mistakesmjz19910
2022-01-04Userland: Locally suppress -Wc99-designator and re-enable globallyAndrew Kaster
There's only two places where we're using the C99 feature of array designated initalizers. This feature seemingly wasn't included with C++20 designated initalizers for classes and structs. The only two places we were using this feature are suitably old and isolated that it makes sense to just suppress the warning at the usage sites while discouraging future array designated intializers in new code.
2021-12-29LibC: Make regs.h work with compilers without conceptsBrian Gianforcaro
This allows the gdb port to compile with our `regs.h`.
2021-12-23Kernel+UE+LibC: Store address as void* in SC_m{re,}map_paramsDaniel Bertalan
Most other syscalls pass address arguments as `void*` instead of `uintptr_t`, so let's do that here too. Besides improving consistency, this commit makes `strace` correctly pretty-print these arguments in hex.
2021-12-22LibC: Add support for `posix_madvise(..)`Brian Gianforcaro
Add the `posix_madvise(..)` LibC implementation that just forwards to the normal `madvise(..)` implementation. Also define a few POSIX_MADV_DONTNEED and POSIX_MADV_NORMAL as they are part of the POSIX API for `posix_madvise(..)`. This is needed by the `fio` port.
2021-12-22LibC: Stub out munlock()Idan Horowitz
This function is supposed to unlock memory ranges that were locked by mlock, but since mlock is stubbed out right now, this is a no-op.
2021-12-21LibC: Add POSIX spec comments for select APIsBrian Gianforcaro
2021-12-21LibC: Add POSIX spec comments for memory management APIsBrian Gianforcaro
2021-12-21LibC: Add POSIX spec comments for socket APIsBrian Gianforcaro
2021-12-12LibC: Rewrite pselect() as a wrapper for ppoll()Jean-Baptiste Boric
2021-12-05LibCore: Implement new ptrace_peekbuf wrapper for PT_PEEKBUF syscallBen Wiederhake
2021-12-05Kernel+strace: Remove unnecessary indirection for PEEKBen Wiederhake
Also, remove incomplete, superfluous check. Incomplete, because only the byte at the provided address was checked; this misses the last bytes of the "jerk page". Superfluous, because it is already correctly checked by peek_user_data (which calls copy_from_user). The caller/tracer should not typically attempt to read non-userspace addresses, we don't need to "hot-path" it either.
2021-12-05Kernel: Add the SIOCATMARK ioctl request macroIdan Horowitz
This is not actually implemented at the moment, as we do not support sending or receiving out-of-band data at all currently, but it is required for some ports to compile.
2021-11-21LibC: Remove commented-out main() prototype from sys/cdefs.hAndreas Kling
2021-11-21Everywhere: Fix spelling of "offsetted"Andreas Kling
This word is actually pretty awkward in context, but this patch merely fixes the spelling instead of finding a better word.
2021-11-21Kernel+LibC: Fix misspelled "VERTICAL" in framebuffer ioctlsAndreas Kling
2021-11-20Kernel+LibC: Fix ptrace for 64-bitItamar
This makes the types used in the PT_PEEK and PT_POKE actions suitable for 64-bit platforms as well.
2021-11-17Kernel+LibC: Add msync() system callAndreas Kling
This allows userspace to trigger a full (FIXME) flush of a shared file mapping to disk. We iterate over all the mapped pages in the VMObject and write them out to the underlying inode, one by one. This is rather naive, and there's lots of room for improvement. Note that shared file mappings are currently not possible since mmap() returns ENOTSUP for PROT_WRITE+MAP_SHARED. That restriction will be removed in a subsequent commit. :^)
2021-11-11LibC: Avoid unnecessary mprotect during program initializationBen Wiederhake
For 'true', this shaves off about 69 syscalls, as measured by strace.
2021-10-28LibC+LibELF: Move getauxval and AT_* flags to sys/auxv.hIdan Horowitz
2021-10-28LibC: Change the type of FBProperties' fields from bool to unsigned charIdan Horowitz
The bool type is not available in C89.
2021-10-27Kernel + WindowServer: Re-define the interface to framebuffer devicesLiav A
We create a base class called GenericFramebufferDevice, which defines all the virtual functions that must be implemented by a FramebufferDevice. Then, we make the VirtIO FramebufferDevice and other FramebufferDevice implementations inherit from it. The most important consequence of rearranging the classes is that we now have one IOCTL method, so all drivers should be committed to not override the IOCTL method or make their own IOCTLs of FramebufferDevice. All graphical IOCTLs are known to all FramebufferDevices, and it's up to the specific implementation whether to support them or discard them (so we require extensive usage of KResult and KResultOr, together with virtual characteristic functions). As a result, the interface is much cleaner and understandable to read.
2021-10-25Kernel+LibC: Default to 8-bit characters in TTYDaniel Bertalan
Some ports (like `bc` with history enabled) sensibly set the termios character size to 8 bits. Previously, we left the character size value (given by the bitmask CSIZE) as zero by default (meaning 5 bits per character), and returned ENOTIMPL whenever someone modified it. This was dumb.
2021-10-09Kernel: Add ioctl request for getting a storage device's block sizeDavid Isaksson
2021-10-09Kernel: Add STORAGE_DEVICE_GET_SIZE ioctl requestDavid Isaksson
This ioctl request makes it possible to get the size of a storage device that has not yet been mounted.
2021-10-06LibC: Fix redeclaration in x86_64/regs.hBen Wiederhake
In QtCreator (and under weird configurations with gcc), this used to fail with the error messages like: "error: member of anonymous union redeclares '___'". This patch gives each member a unique name.
2021-10-06LibC: Make sure ARCH macro is available before useBen Wiederhake
2021-10-04Everywhere: Fix more Copyright header inconsistenciesTim Schumacher
2021-09-23LibC: Add getpriority() and setpriority() stubsJelle Raaijmakers
Expected behavior left as a FIXME is outlined here: https://pubs.opengroup.org/onlinepubs/7908799/xsh/getpriority.html
2021-09-20LibC+DynamicLoader: Store the auxiliary vector address at startupItamar
Previously, getauxval() got the address of the auxiliary vector by traversing to the end of the `environ` pointer. The assumption that the auxiliary vector comes after the environment array is true at program startup, however the environment array may be re-allocated and change its address during runtime which would cause getauxval() to work with an incorrect auxiliary vector address. To fix this, we now get the address of the auxiliary vector once in __libc_init and store it in a libc-internal pointer which is then used by getauxval(). Fixes #10087.