Skip to content

daemon purpose

The Tumultuous Unicorn Of Darkness edited this page Dec 14, 2024 · 6 revisions

Daemon purpose

You may be wondering what is the --daemon argument (command line) and the Start daemon button (GUI). You are on the right page to know everything you need!

CPU-X UI is intended to run as regular user. However, some data needs root privileges. Here is the daemon's role: do action as root.

Server side

The cpu-x-daemon binary can do following actions:

  • read CPU model-specific registers (MSRs) libcpuid reads MSRs to provide following data:
    • CPU minimum multiplier
    • CPU maximum multiplier
    • bus frequency (FSB/BCLK)
    • CPU voltage
    • CPU temperature (Intel CPUs only)
  • read DMI table
    dmidecode reads DMI table (from /sys/firmware/dmi/tables/smbios_entry_point or /dev/mem on Linux) to provide following data:
    • motherboard information (manufacturer, model, revision)
    • BIOS information (brand, version, date, ROM size)
    • chipset information (vendor, model)
    • memory information (vendor, model, capacity, speed...)
  • access PCI devices (FreeBSD only)
    CPU-X tries to detect PCI devices (from /dev/pci) like:
    • chipset
    • graphic cards
  • access DRI devices (Linux only)
    CPU-X tries to read DRI debug data (from /sys/kernel/debug/dri) to provide:
    • GPU monitoring information (AMD GPU with radeon kernel module (prior Graphics Core Next (GCN) family) or NVIDIA GPU with nouveau kernel module)
  • load kernel modules
    CPU-X may load kernel modules if required like:
    • MSR module
    • sensors module

Daemon's source code (server side) is available here: https://github.com/TheTumultuousUnicornOfDarkness/CPU-X/blob/master/src/daemon_server.cpp

Client side

The client can start the daemon by using the pkexec command. pkexec command prompts user's password. The PolKit action is io.github.thetumultuousunicornofdarkness.cpu-x-daemon.

Please note that a running PolKit agent is required to use pkexec command (you can refer distro-related documentation about PolKit, e.g. Arch Linux / Gentoo / Ubuntu).

Daemon's source code (client side) is available here: https://github.com/TheTumultuousUnicornOfDarkness/CPU-X/blob/master/src/daemon_client.cpp

Note: you can start the daemon without prompting a password (read Start daemon without asking password).

Communication between clients and server

When the daemon is started (by using --daemon argument on cpu-x command line or by clicking the Start daemon button in the GUI), communication between processes is performed through inter processus communication (IPC). CPU-X uses an Unix domain socket.

Notes: if the daemon is not started, some labels may be empty (read Why some labels are empty?).