]> git.ipfire.org Git - thirdparty/systemd.git/commit
condition: add CPUFeature
authorGiedrius Statkevičius <giedriuswork@gmail.com>
Wed, 11 Nov 2020 20:45:58 +0000 (22:45 +0200)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 17 Feb 2021 06:31:29 +0000 (15:31 +0900)
commit68337e55f62cf49b7bdfb73dc5662e23b0ea17fa
tree494f0944d4b54579df479c6a9dd06ef0809376a3
parentb1b4e9204c8260956825e2b9733c95903e215e31
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.
man/systemd.unit.xml
src/basic/virt.c
src/basic/virt.h
src/shared/condition.c
src/shared/condition.h
src/test/test-condition.c