瀏覽代碼

Kernel+Userland: Move LibC/sys/ioctl_numbers to Kernel/API/Ioctl.h

This header has always been fundamentally a Kernel API file. Move it
where it belongs. Include it directly in Kernel files, and make
Userland applications include it via sys/ioctl.h rather than directly.
Andrew Kaster 2 年之前
父節點
當前提交
100fb38c3e

+ 6 - 4
Userland/Libraries/LibC/sys/ioctl_numbers.h → Kernel/API/Ioctl.h

@@ -7,9 +7,9 @@
 
 
 #pragma once
 #pragma once
 
 
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 
 struct winsize {
 struct winsize {
     unsigned short ws_row;
     unsigned short ws_row;
@@ -76,7 +76,9 @@ enum ConsoleModes {
     KD_GRAPHICS = 0x01,
     KD_GRAPHICS = 0x01,
 };
 };
 
 
-__END_DECLS
+#ifdef __cplusplus
+}
+#endif
 
 
 enum IOCtlNumber {
 enum IOCtlNumber {
     TIOCGPGRP,
     TIOCGPGRP,

+ 1 - 1
Kernel/Devices/Audio/Channel.cpp

@@ -4,12 +4,12 @@
  * SPDX-License-Identifier: BSD-2-Clause
  * SPDX-License-Identifier: BSD-2-Clause
  */
  */
 
 
+#include <Kernel/API/Ioctl.h>
 #include <Kernel/Devices/Audio/Management.h>
 #include <Kernel/Devices/Audio/Management.h>
 #include <Kernel/Devices/DeviceManagement.h>
 #include <Kernel/Devices/DeviceManagement.h>
 #include <Kernel/Devices/RandomDevice.h>
 #include <Kernel/Devices/RandomDevice.h>
 #include <Kernel/Random.h>
 #include <Kernel/Random.h>
 #include <Kernel/Sections.h>
 #include <Kernel/Sections.h>
-#include <LibC/sys/ioctl_numbers.h>
 
 
 namespace Kernel {
 namespace Kernel {
 
 

+ 1 - 1
Kernel/Devices/HID/KeyboardDevice.cpp

@@ -8,10 +8,10 @@
 
 
 #include <AK/Assertions.h>
 #include <AK/Assertions.h>
 #include <AK/Types.h>
 #include <AK/Types.h>
+#include <Kernel/API/Ioctl.h>
 #include <Kernel/Devices/HID/KeyboardDevice.h>
 #include <Kernel/Devices/HID/KeyboardDevice.h>
 #include <Kernel/Sections.h>
 #include <Kernel/Sections.h>
 #include <Kernel/TTY/VirtualConsole.h>
 #include <Kernel/TTY/VirtualConsole.h>
-#include <LibC/sys/ioctl_numbers.h>
 
 
 namespace Kernel {
 namespace Kernel {
 
 

+ 1 - 1
Kernel/Devices/KCOVDevice.cpp

@@ -6,11 +6,11 @@
 
 
 #include <AK/Assertions.h>
 #include <AK/Assertions.h>
 #include <AK/NonnullOwnPtr.h>
 #include <AK/NonnullOwnPtr.h>
+#include <Kernel/API/Ioctl.h>
 #include <Kernel/Devices/DeviceManagement.h>
 #include <Kernel/Devices/DeviceManagement.h>
 #include <Kernel/Devices/KCOVDevice.h>
 #include <Kernel/Devices/KCOVDevice.h>
 #include <Kernel/Devices/KCOVInstance.h>
 #include <Kernel/Devices/KCOVInstance.h>
 #include <Kernel/FileSystem/OpenFileDescription.h>
 #include <Kernel/FileSystem/OpenFileDescription.h>
-#include <LibC/sys/ioctl_numbers.h>
 
 
 #include <Kernel/Panic.h>
 #include <Kernel/Panic.h>
 
 

+ 1 - 1
Kernel/FileSystem/InodeFile.cpp

@@ -5,6 +5,7 @@
  */
  */
 
 
 #include <AK/StringView.h>
 #include <AK/StringView.h>
+#include <Kernel/API/Ioctl.h>
 #include <Kernel/API/POSIX/errno.h>
 #include <Kernel/API/POSIX/errno.h>
 #include <Kernel/FileSystem/Inode.h>
 #include <Kernel/FileSystem/Inode.h>
 #include <Kernel/FileSystem/InodeFile.h>
 #include <Kernel/FileSystem/InodeFile.h>
@@ -13,7 +14,6 @@
 #include <Kernel/Memory/PrivateInodeVMObject.h>
 #include <Kernel/Memory/PrivateInodeVMObject.h>
 #include <Kernel/Memory/SharedInodeVMObject.h>
 #include <Kernel/Memory/SharedInodeVMObject.h>
 #include <Kernel/Process.h>
 #include <Kernel/Process.h>
-#include <LibC/sys/ioctl_numbers.h>
 
 
 namespace Kernel {
 namespace Kernel {
 
 

+ 1 - 1
Kernel/Graphics/DisplayConnector.cpp

@@ -4,13 +4,13 @@
  * SPDX-License-Identifier: BSD-2-Clause
  * SPDX-License-Identifier: BSD-2-Clause
  */
  */
 
 
+#include <Kernel/API/Ioctl.h>
 #include <Kernel/FileSystem/SysFS/Subsystems/DeviceIdentifiers/CharacterDevicesDirectory.h>
 #include <Kernel/FileSystem/SysFS/Subsystems/DeviceIdentifiers/CharacterDevicesDirectory.h>
 #include <Kernel/FileSystem/SysFS/Subsystems/Devices/Graphics/DisplayConnector/DeviceDirectory.h>
 #include <Kernel/FileSystem/SysFS/Subsystems/Devices/Graphics/DisplayConnector/DeviceDirectory.h>
 #include <Kernel/FileSystem/SysFS/Subsystems/Devices/Graphics/DisplayConnector/Directory.h>
 #include <Kernel/FileSystem/SysFS/Subsystems/Devices/Graphics/DisplayConnector/Directory.h>
 #include <Kernel/Graphics/DisplayConnector.h>
 #include <Kernel/Graphics/DisplayConnector.h>
 #include <Kernel/Graphics/GraphicsManagement.h>
 #include <Kernel/Graphics/GraphicsManagement.h>
 #include <Kernel/Memory/MemoryManager.h>
 #include <Kernel/Memory/MemoryManager.h>
-#include <LibC/sys/ioctl_numbers.h>
 
 
 namespace Kernel {
 namespace Kernel {
 
 

+ 1 - 1
Kernel/Graphics/DisplayConnector.h

@@ -7,9 +7,9 @@
 #pragma once
 #pragma once
 
 
 #include <AK/Types.h>
 #include <AK/Types.h>
+#include <Kernel/API/Ioctl.h>
 #include <Kernel/Devices/CharacterDevice.h>
 #include <Kernel/Devices/CharacterDevice.h>
 #include <Kernel/Memory/SharedFramebufferVMObject.h>
 #include <Kernel/Memory/SharedFramebufferVMObject.h>
-#include <LibC/sys/ioctl_numbers.h>
 #include <LibEDID/EDID.h>
 #include <LibEDID/EDID.h>
 
 
 namespace Kernel {
 namespace Kernel {

+ 1 - 1
Kernel/Graphics/VirtIOGPU/GPU3DDevice.cpp

@@ -4,6 +4,7 @@
  * SPDX-License-Identifier: BSD-2-Clause
  * SPDX-License-Identifier: BSD-2-Clause
  */
  */
 
 
+#include <Kernel/API/Ioctl.h>
 #include <Kernel/API/VirGL.h>
 #include <Kernel/API/VirGL.h>
 #include <Kernel/Graphics/GraphicsManagement.h>
 #include <Kernel/Graphics/GraphicsManagement.h>
 #include <Kernel/Graphics/VirtIOGPU/Console.h>
 #include <Kernel/Graphics/VirtIOGPU/Console.h>
@@ -11,7 +12,6 @@
 #include <Kernel/Graphics/VirtIOGPU/GraphicsAdapter.h>
 #include <Kernel/Graphics/VirtIOGPU/GraphicsAdapter.h>
 #include <Kernel/Graphics/VirtIOGPU/Protocol.h>
 #include <Kernel/Graphics/VirtIOGPU/Protocol.h>
 #include <Kernel/Random.h>
 #include <Kernel/Random.h>
-#include <LibC/sys/ioctl_numbers.h>
 
 
 namespace Kernel {
 namespace Kernel {
 
 

+ 1 - 1
Kernel/Net/IPv4Socket.cpp

@@ -6,6 +6,7 @@
 
 
 #include <AK/Singleton.h>
 #include <AK/Singleton.h>
 #include <AK/StringBuilder.h>
 #include <AK/StringBuilder.h>
+#include <Kernel/API/Ioctl.h>
 #include <Kernel/API/POSIX/errno.h>
 #include <Kernel/API/POSIX/errno.h>
 #include <Kernel/Debug.h>
 #include <Kernel/Debug.h>
 #include <Kernel/FileSystem/OpenFileDescription.h>
 #include <Kernel/FileSystem/OpenFileDescription.h>
@@ -22,7 +23,6 @@
 #include <Kernel/Net/UDPSocket.h>
 #include <Kernel/Net/UDPSocket.h>
 #include <Kernel/Process.h>
 #include <Kernel/Process.h>
 #include <Kernel/UnixTypes.h>
 #include <Kernel/UnixTypes.h>
-#include <LibC/sys/ioctl_numbers.h>
 
 
 namespace Kernel {
 namespace Kernel {
 
 

+ 1 - 1
Kernel/Net/LocalSocket.cpp

@@ -6,6 +6,7 @@
 
 
 #include <AK/Singleton.h>
 #include <AK/Singleton.h>
 #include <AK/StringBuilder.h>
 #include <AK/StringBuilder.h>
+#include <Kernel/API/Ioctl.h>
 #include <Kernel/API/POSIX/errno.h>
 #include <Kernel/API/POSIX/errno.h>
 #include <Kernel/Debug.h>
 #include <Kernel/Debug.h>
 #include <Kernel/FileSystem/OpenFileDescription.h>
 #include <Kernel/FileSystem/OpenFileDescription.h>
@@ -16,7 +17,6 @@
 #include <Kernel/Process.h>
 #include <Kernel/Process.h>
 #include <Kernel/StdLib.h>
 #include <Kernel/StdLib.h>
 #include <Kernel/UnixTypes.h>
 #include <Kernel/UnixTypes.h>
-#include <LibC/sys/ioctl_numbers.h>
 
 
 namespace Kernel {
 namespace Kernel {
 
 

+ 1 - 1
Kernel/Storage/StorageDevice.cpp

@@ -5,6 +5,7 @@
  */
  */
 
 
 #include <AK/StringView.h>
 #include <AK/StringView.h>
+#include <Kernel/API/Ioctl.h>
 #include <Kernel/Debug.h>
 #include <Kernel/Debug.h>
 #include <Kernel/Devices/DeviceManagement.h>
 #include <Kernel/Devices/DeviceManagement.h>
 #include <Kernel/FileSystem/OpenFileDescription.h>
 #include <Kernel/FileSystem/OpenFileDescription.h>
@@ -14,7 +15,6 @@
 #include <Kernel/FileSystem/SysFS/Subsystems/Devices/Storage/Directory.h>
 #include <Kernel/FileSystem/SysFS/Subsystems/Devices/Storage/Directory.h>
 #include <Kernel/Storage/StorageDevice.h>
 #include <Kernel/Storage/StorageDevice.h>
 #include <Kernel/Storage/StorageManagement.h>
 #include <Kernel/Storage/StorageManagement.h>
-#include <LibC/sys/ioctl_numbers.h>
 
 
 namespace Kernel {
 namespace Kernel {
 
 

+ 1 - 1
Kernel/Syscalls/ioctl.cpp

@@ -5,9 +5,9 @@
  */
  */
 
 
 #include <AK/Userspace.h>
 #include <AK/Userspace.h>
+#include <Kernel/API/Ioctl.h>
 #include <Kernel/FileSystem/OpenFileDescription.h>
 #include <Kernel/FileSystem/OpenFileDescription.h>
 #include <Kernel/Process.h>
 #include <Kernel/Process.h>
-#include <LibC/sys/ioctl_numbers.h>
 
 
 namespace Kernel {
 namespace Kernel {
 
 

+ 1 - 1
Kernel/Syscalls/jail.cpp

@@ -5,11 +5,11 @@
  */
  */
 
 
 #include <AK/Userspace.h>
 #include <AK/Userspace.h>
+#include <Kernel/API/Ioctl.h>
 #include <Kernel/Jail.h>
 #include <Kernel/Jail.h>
 #include <Kernel/JailManagement.h>
 #include <Kernel/JailManagement.h>
 #include <Kernel/Process.h>
 #include <Kernel/Process.h>
 #include <Kernel/StdLib.h>
 #include <Kernel/StdLib.h>
-#include <LibC/sys/ioctl_numbers.h>
 
 
 namespace Kernel {
 namespace Kernel {
 
 

+ 1 - 1
Kernel/TTY/MasterPTY.cpp

@@ -4,6 +4,7 @@
  * SPDX-License-Identifier: BSD-2-Clause
  * SPDX-License-Identifier: BSD-2-Clause
  */
  */
 
 
+#include <Kernel/API/Ioctl.h>
 #include <Kernel/API/POSIX/errno.h>
 #include <Kernel/API/POSIX/errno.h>
 #include <Kernel/API/POSIX/signal_numbers.h>
 #include <Kernel/API/POSIX/signal_numbers.h>
 #include <Kernel/Debug.h>
 #include <Kernel/Debug.h>
@@ -12,7 +13,6 @@
 #include <Kernel/TTY/MasterPTY.h>
 #include <Kernel/TTY/MasterPTY.h>
 #include <Kernel/TTY/PTYMultiplexer.h>
 #include <Kernel/TTY/PTYMultiplexer.h>
 #include <Kernel/TTY/SlavePTY.h>
 #include <Kernel/TTY/SlavePTY.h>
-#include <LibC/sys/ioctl_numbers.h>
 
 
 namespace Kernel {
 namespace Kernel {
 
 

+ 1 - 1
Kernel/TTY/TTY.cpp

@@ -7,13 +7,13 @@
 
 
 #include <AK/ScopeGuard.h>
 #include <AK/ScopeGuard.h>
 #include <AK/StringView.h>
 #include <AK/StringView.h>
+#include <Kernel/API/Ioctl.h>
 #include <Kernel/API/POSIX/errno.h>
 #include <Kernel/API/POSIX/errno.h>
 #include <Kernel/API/POSIX/signal_numbers.h>
 #include <Kernel/API/POSIX/signal_numbers.h>
 #include <Kernel/Debug.h>
 #include <Kernel/Debug.h>
 #include <Kernel/InterruptDisabler.h>
 #include <Kernel/InterruptDisabler.h>
 #include <Kernel/Process.h>
 #include <Kernel/Process.h>
 #include <Kernel/TTY/TTY.h>
 #include <Kernel/TTY/TTY.h>
-#include <LibC/sys/ioctl_numbers.h>
 #define TTYDEFCHARS
 #define TTYDEFCHARS
 #include <LibC/sys/ttydefaults.h>
 #include <LibC/sys/ttydefaults.h>
 #undef TTYDEFCHARS
 #undef TTYDEFCHARS

+ 0 - 1
Userland/Libraries/LibC/stdlib.cpp

@@ -28,7 +28,6 @@
 #include <string.h>
 #include <string.h>
 #include <sys/internals.h>
 #include <sys/internals.h>
 #include <sys/ioctl.h>
 #include <sys/ioctl.h>
-#include <sys/ioctl_numbers.h>
 #include <sys/mman.h>
 #include <sys/mman.h>
 #include <sys/stat.h>
 #include <sys/stat.h>
 #include <sys/sysmacros.h>
 #include <sys/sysmacros.h>

+ 1 - 1
Userland/Libraries/LibC/sys/ioctl.h

@@ -6,8 +6,8 @@
 
 
 #pragma once
 #pragma once
 
 
+#include <Kernel/API/Ioctl.h>
 #include <sys/cdefs.h>
 #include <sys/cdefs.h>
-#include <sys/ioctl_numbers.h>
 
 
 __BEGIN_DECLS
 __BEGIN_DECLS
 
 

+ 1 - 1
Userland/Libraries/LibVirtGPU/CommandBufferBuilder.cpp

@@ -8,7 +8,7 @@
 
 
 #include <AK/StringView.h>
 #include <AK/StringView.h>
 #include <Kernel/API/VirGL.h>
 #include <Kernel/API/VirGL.h>
-#include <sys/ioctl_numbers.h>
+#include <sys/ioctl.h>
 
 
 #include <LibVirtGPU/CommandBufferBuilder.h>
 #include <LibVirtGPU/CommandBufferBuilder.h>
 #include <LibVirtGPU/Commands.h>
 #include <LibVirtGPU/Commands.h>

+ 1 - 1
Userland/Libraries/LibVirtGPU/CommandBufferBuilder.h

@@ -13,7 +13,7 @@
 #include <LibGfx/Size.h>
 #include <LibGfx/Size.h>
 #include <LibVirtGPU/Commands.h>
 #include <LibVirtGPU/Commands.h>
 #include <LibVirtGPU/VirGLProtocol.h>
 #include <LibVirtGPU/VirGLProtocol.h>
-#include <sys/ioctl_numbers.h>
+#include <sys/ioctl.h>
 
 
 namespace VirtGPU {
 namespace VirtGPU {
 
 

+ 1 - 1
Userland/Services/WindowServer/HardwareScreenBackend.h

@@ -11,7 +11,7 @@
 #include <AK/DeprecatedString.h>
 #include <AK/DeprecatedString.h>
 #include <AK/Error.h>
 #include <AK/Error.h>
 #include <AK/Span.h>
 #include <AK/Span.h>
-#include <sys/ioctl_numbers.h>
+#include <sys/ioctl.h>
 
 
 namespace WindowServer {
 namespace WindowServer {
 class HardwareScreenBackend : public ScreenBackend {
 class HardwareScreenBackend : public ScreenBackend {

+ 1 - 1
Userland/Services/WindowServer/ScreenBackend.h

@@ -10,7 +10,7 @@
 #include <AK/Error.h>
 #include <AK/Error.h>
 #include <AK/Span.h>
 #include <AK/Span.h>
 #include <LibGfx/Color.h>
 #include <LibGfx/Color.h>
-#include <sys/ioctl_numbers.h>
+#include <sys/ioctl.h>
 
 
 namespace WindowServer {
 namespace WindowServer {
 
 

+ 0 - 1
Userland/Services/WindowServer/VirtualScreenBackend.h

@@ -11,7 +11,6 @@
 #include <AK/DeprecatedString.h>
 #include <AK/DeprecatedString.h>
 #include <AK/Error.h>
 #include <AK/Error.h>
 #include <AK/Span.h>
 #include <AK/Span.h>
-#include <sys/ioctl_numbers.h>
 
 
 namespace WindowServer {
 namespace WindowServer {
 
 

+ 0 - 1
Userland/Utilities/kcov-example.cpp

@@ -9,7 +9,6 @@
 #include <fcntl.h>
 #include <fcntl.h>
 #include <stdio.h>
 #include <stdio.h>
 #include <sys/ioctl.h>
 #include <sys/ioctl.h>
-#include <sys/ioctl_numbers.h>
 #include <sys/kcov.h>
 #include <sys/kcov.h>
 #include <sys/mman.h>
 #include <sys/mman.h>
 #include <unistd.h>
 #include <unistd.h>