Repository navigation
Port to C - #3
Merged
Merged
Conversation
ReadFanSpeeds and SetSpeed previously created their own context.Background(), making them unresponsive to cancellation. Now they accept and use the caller's context so SIGINT/SIGTERM aborts in-flight IPMI calls immediately. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Decouples suggestion receipt from fan speed application. The apply block only runs when a sensor has posted a new speed since the last set, preventing redundant SetSpeed calls from the fan-log ticker or other non-sensor select cases. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- TempReader now returns map[string]float64 (CPU uses IPMI sensor name, GPU uses gpu0/gpu1/... index keys); Poll returns the map alongside the rolling aggregate - Log "sensor temperature" includes latest_temps map and aggregate_temp - "current fan speed" reverts to one log line per fan (map format was unreadable); Percent field removed, RPM and delta remain Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- make install: skip copying frostd.yaml if /etc/frostd.yaml already exists - make uninstall_clean: runs uninstall then removes /etc/frostd.yaml and the log file defined within it Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Rotates /var/log/frostd/frostd.log daily, retains 7 days, uses copytruncate since frostd holds the log file open without reload support. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- SensorMonitor.Poll now records the max temp across sensor IDs each
iteration rather than the average
- Add log_format config field ("text" or "json", default "text");
frostd.yaml sets json for production
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…g reference Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Rename frostd_device_* metrics to frostd_sensor_* - Drop _celsius suffix from temperature metric names - Rename frostd_actual_fan_speed_rpm to frostd_actual_fan_rpm - Use "Temp" as GPU sensor key to match IPMI naming convention Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Each sensor ID now maintains its own rolling sample buffer instead of a single buffer fed by the per-poll maximum. Suggested fan speed is derived from the max aggregate across all IDs. The Prometheus frostd_sensor_aggregate_temperature metric gains an "id" label to expose the individual aggregates. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- service.c: create the speed-bus condvar with CLOCK_MONOTONIC so pthread_cond_timedwait's deadline matches the clock used to compute it. Previously the default CLOCK_REALTIME wait clock combined with a CLOCK_MONOTONIC deadline made every wait return ETIMEDOUT instantly, spinning the fan-log loop with no delay. - ipmi.c: fix the sensor iterator loop condition. ipmi_monitoring_sensor_iterator_next() returns 1 on successful advance (0 means end of list), not 0 on success as the header comment implies. The old `== 0` check ended iteration after the first sensor of any type, so only one CPU/fan sensor was ever seen regardless of how many were present. - ipmi.c: fix real_raw_command() to prepend the command byte to the request buffer passed to ipmi_cmd_raw(), which expects it as the first byte of the request rather than as a separate parameter. The command byte was previously discarded, so Dell OEM raw commands (enable manual fan control, set fan speed) never reached the BMC correctly and fans stayed at automatic/idle speed. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KxtPMuWLTmsYMMwwbtMtFi
SIGTERM/SIGINT is delivered to a single thread of the process, and neither clock_nanosleep nor pthread_cond_timedwait wake up early on signal delivery (per POSIX/NPTL semantics). Previously, whichever thread didn't receive the signal kept blocking until its own next natural wakeup (up to sample_interval or fan_log_interval away, and compounding with real IPMI call latency when fan control is active) before it rechecked g_shutdown, so Ctrl-C could take up to that long, or longer, to actually stop the service. Cap every wait to a short poll granularity (1s) so any thread notices g_shutdown promptly regardless of which thread the signal landed on, while still only firing sample/fan-log actions on their real deadlines. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KxtPMuWLTmsYMMwwbtMtFi
The Requirements section still listed the Go build toolchain from before the port to C. Replace it with the actual build requirements (GCC, make, and the C dev libraries) matching CLAUDE.md's Developer Prerequisites. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KxtPMuWLTmsYMMwwbtMtFi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Switching from Golang to C builds a smaller executable and runs with much less memory utilization.
Stats on Ubuntu 24.04:
Golang version
C version