|
|
||
|---|---|---|
| client.c | use linux code format | |
| client.h | use linux code format | |
| common.h | use linux code format | |
| LICENSE | use gpl v2 | |
| main.c | use linux code format | |
| Makefile | zora | |
| netlink.c | use linux code format | |
| netlink.h | use linux code format | |
| proc.c | use linux code format | |
| proc.h | use linux code format | |
| README.md | use gpl v2 | |
| thermal.c | use linux code format | |
| thermal.h | use linux code format | |
Zora
a Temperature Monitor Kernel Module with Multi-Daemon Netlink Support
Name Meaning
Zora is derived from the Slavic word "Zora", meaning "dawn" or "sunrise". The name symbolizes clarity, new beginnings, and illumination, reflecting the module’s purpose: to provide clear, real-time visibility into system thermal conditions. Just as dawn brings light to the day, Zora brings transparency and monitoring insight to Linux thermal zones.
Overview
This Linux kernel module provides advanced thermal zone monitoring with multi-daemon Netlink support. It monitors system temperature sensors and broadcasts temperature changes to registered user-space daemons via a custom Netlink protocol.
Features
- Supports up to 256 thermal zones
- Exposes monitoring data via
/proc/temp_monitor - Real-time temperature change detection
- Netlink-based communication with up to 32 clients
- Automatic client cleanup and heartbeat monitoring
- Provides detailed sensor descriptions and trip point information
- Broadcasts temperature changes only when threshold exceeded
Netlink Protocol
- Protocol Number:
31(defined asNETLINK_THERMAL) - Supported Message Types:
THERMAL_MSG_REGISTER (3)— Register clientTHERMAL_MSG_UNREGISTER (4)— Unregister clientTHERMAL_MSG_TEMP_CHANGE (1)— Temperature change notificationTHERMAL_MSG_ZONE_UPDATE (2)— Full zone updateTHERMAL_MSG_CLIENT_LIST (5)— ReservedTHERMAL_MSG_HEARTBEAT (6)— Keep-aliveTHERMAL_MSG_ZONE_STATUS (7) — Request: send current status of all zones
/proc Interface
After loading the module, /proc/temp_monitor will be created. It displays:
- Summary of detected thermal zones
- Netlink status
- Connected client information
- Detailed sensor readings, descriptions, and trip points
Sample output:
\==========================================
Temperature Monitor with Multi-Daemon
=====================================
?? Detected thermal zones: 4
?? Netlink monitoring: ENABLED
?? Connected clients: 1/32
?? Polling interval: 2 seconds
??? Change threshold: 1.0°C
?? Connected Clients:
• my\_daemon (PID: 12345) - Messages: 8, Connected: 30 sec ago
??? Zone: thermal\_zone0
?? Sensor Type: x86\_pkg\_temp
?? Description: CPU temperature sensor - monitors processor core temperature
??? Current Temperature: 55.2°C (131.4°F)
?? Raw Value: 55200 millidegrees
?? Trip points: 95.0°C, 100.0°C
?? Broadcast monitoring: ACTIVE
?? Last notified temp: 55.2°C
Building and Installing
make
make install
To remove the module:
make uninstall
Client Communication
Clients must use Netlink to:
- Register themselves (send a struct with
msg_type = 3) - Receive broadcast temperature changes
- Send heartbeat messages to stay active
- Unregister gracefully
Clients receive:
- Initial zone info upon registration
- Real-time notifications if temperature change exceeds threshold
Notes
- Temperature threshold for notifications is 1000 millidegrees (1.0°C)
- Polling interval is 2 seconds
- Max 32 concurrent clients; exceeding this will reject new clients
- Stale clients are cleaned up after 60 seconds of inactivity
Known Limitations
- Only works with systems that support
/sys/class/thermal - Assumes temperature readings are in millidegrees
Acknowledgments
Thanks to the Linux kernel community and documentation that made this possible.
Contact
For bug reports, feedback, or contributions:
Developer: Ali Miracle Email: alimiracle@riseup.net
License
This module is licensed under the GPL v2 License - see the LICENSE file for details.