serenity/Userland/Services/CMakeLists.txt
Liav A 446200d6f3 Kernel+Services: Enable barebones hot-plug handling capabilities
Userspace initially didn't have any sort of mechanism to handle
device hotplug (either removing or inserting a device).
This meant that after a short term of scanning all known devices, by
fetching device events (DeviceEvent packets) from /dev/devctl, we
basically never try to read it again after SystemServer initialization
code.

To accommodate hotplug needs, we change SystemServer by ensuring it will
generate a known set of device nodes at their location during the its
main initialization code. This includes devices like /dev/mem, /dev/zero
and /dev/full, etc.

The actual responsible userspace program to handle hotplug events is a
new userspace program called DeviceMapper, with following key points:
- Its current task is to to constantly read the /dev/devctl device node.
  Because we already created generic devices, we only handle devices
  that are dynamically-generated in nature, like storage devices, audio
  channels, etc.

- Since dynamically-generated device nodes could have an infinite minor
  numbers, but major numbers are decoded to a device type, we create an
  internal registry based on two structures - DeviceNodeFamily, and
  RegisteredDeviceNode. DeviceNodeFamily objects are attached in the
  main logic code, when handling a DeviceEvent device insertion packet.
  A DeviceNodeFamily object has an internal HashTable to hold objects of
  RegisteredDeviceNode class.

- Because some device nodes could still share the same major number (TTY
  and serial TTY devices), we have two modes of allocation - limited
  allocation (so a range is defined for a major number), or infinite
  range. Therefore, two (or more) separate DeviceNodeFamily objects can
  can exist albeit sharing the same major number, but they are required
  to allocate from a different minor numbers' range to ensure there are
  no collisions.

- As for KCOV, we handle this device differently. In case the user
  compiled the kernel with such support - this happens to be a singular
  device node that we usually don't need, so it's dynamically-generated
  too, and because it has only one instance, we don't register it in our
  internal registry to not make it complicated needlessly.

The Kernel code is modified to allow proper blocking in case of no
events in the DeviceControlDevice class, because otherwise we will need
to poll periodically the device to check if a new event is available,
which would waste CPU time for no good reason.
2023-09-07 11:50:50 -06:00

32 lines
980 B
CMake

add_subdirectory(ConfigServer)
add_subdirectory(EchoServer)
add_subdirectory(FileOperation)
add_subdirectory(ImageDecoder)
add_subdirectory(LookupServer)
add_subdirectory(WebServer)
if (SERENITYOS)
add_subdirectory(AudioServer)
add_subdirectory(ChessEngine)
add_subdirectory(Clipboard)
add_subdirectory(CrashDaemon)
add_subdirectory(DeviceMapper)
add_subdirectory(DHCPClient)
add_subdirectory(FileSystemAccessServer)
add_subdirectory(KeyboardPreferenceLoader)
add_subdirectory(LaunchServer)
add_subdirectory(LoginServer)
add_subdirectory(NetworkServer)
add_subdirectory(NotificationServer)
add_subdirectory(RequestServer)
add_subdirectory(SpiceAgent)
add_subdirectory(SQLServer)
add_subdirectory(SystemServer)
add_subdirectory(Taskbar)
add_subdirectory(TelnetServer)
add_subdirectory(WebContent)
add_subdirectory(WebDriver)
add_subdirectory(WebSocket)
add_subdirectory(WindowServer)
endif()