condition: add CPUFeature

Taking a stab at implementing #14479.

Add {Condition,Assert}CPUFeature to `systemd-analyze` & friends. Implement it
by executing the CPUID instruction. Add tables for common x86/i386
features.

Tested via unit tests + checked that commands such as:

```bash
systemd-analyze condition 'AssertCPUFeature = rdrand'
```

Succeed as expected and that commands such as

```bash
systemd-analyze condition 'AssertCPUFeature = foobar'
```

Fail as expected. Finally, I have amended the `systemd.unit` manual page
with the new condition and the list of all currently supported flags.
This commit is contained in:
Giedrius Statkevičius
2021-02-17 15:31:29 +09:00
committed by Yu Watanabe
parent b1b4e9204c
commit 68337e55f6
6 changed files with 224 additions and 0 deletions
+1
View File
@@ -19,6 +19,7 @@ typedef enum ConditionType {
CONDITION_MEMORY,
CONDITION_CPUS,
CONDITION_ENVIRONMENT,
CONDITION_CPU_FEATURE,
CONDITION_NEEDS_UPDATE,
CONDITION_FIRST_BOOT,