replace nob with ms' build, move disk creation to build.bat, major comment cleanup, remove old and stupid tests, overhaul interrupt management with per-CPU vector allocation, affinity migration and safe teardown, add proper IOAPIC routing and PCI MSI/MSI-X/INTx support, migrate drivers to the new interrupt API, integrate ACPICA with a proper OS services layer, move ACPI firmware events, power button handling and S5 shutdown into acpi.sys, add parallel driver startup and atomic publication, replace PnP arrays with dynamic lists, redesign service startup again to be asynchronous, add delayed startup mode for services, allow omitting keys in services.ini, fix acpi ec deferred work handling, fix kernel threads having garbage exit code.
This commit is contained in:
1 parent
d36f19509c
commit
36eef8f58d
696 files changed
+147281
-7530
No files matched your search
@@ -1,19 +1,26 @@
|
||||
// Service restart budget: three automatic attempts in any sliding five-minute interval.
|
||||
// A per-service sliding restart budget with explicit count and time window.
|
||||
|
||||
#pragma once
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define INIT_RESTART_MAX_ATTEMPTS 16u
|
||||
|
||||
typedef struct INIT_RESTART_BUDGET {
|
||||
uint64_t Attempts[3];
|
||||
uint64_t Attempts[INIT_RESTART_MAX_ATTEMPTS];
|
||||
uint32_t Count;
|
||||
} INIT_RESTART_BUDGET;
|
||||
|
||||
static inline bool InitConsumeRestartBudget(INIT_RESTART_BUDGET* budget,
|
||||
uint64_t now, uint64_t frequency) {
|
||||
if (!budget || !frequency || budget->Count > 3u ||
|
||||
frequency > UINT64_MAX / 300u) return false;
|
||||
uint64_t window = frequency * 300u;
|
||||
uint64_t now, uint64_t frequency,
|
||||
uint32_t limit, uint32_t windowMilliseconds) {
|
||||
if (!budget || !frequency || !limit || limit > INIT_RESTART_MAX_ATTEMPTS ||
|
||||
!windowMilliseconds || budget->Count > INIT_RESTART_MAX_ATTEMPTS ||
|
||||
frequency > UINT64_MAX / windowMilliseconds)
|
||||
return false;
|
||||
uint64_t window = frequency * windowMilliseconds;
|
||||
window = window / 1000u + (window % 1000u != 0u);
|
||||
if (!window) window = 1;
|
||||
uint32_t keep = 0;
|
||||
for (uint32_t i = 0; i < budget->Count; ++i) {
|
||||
uint64_t started = budget->Attempts[i];
|
||||
@@ -21,7 +28,7 @@ static inline bool InitConsumeRestartBudget(INIT_RESTART_BUDGET* budget,
|
||||
budget->Attempts[keep++] = started;
|
||||
}
|
||||
budget->Count = keep;
|
||||
if (keep == 3u) return false;
|
||||
if (keep >= limit) return false;
|
||||
budget->Attempts[budget->Count++] = now;
|
||||
return true;
|
||||
}
|
||||
Reference in new issue
Block a user