m/p/watchdog: add watchdog package
This adds the watchdog package for interfacing with devices implementing
the Linux watchdog API. There is one alternative implementation at
github.com/mdlayher/watchdog but it is too minimal for our use case.
The kernel API contains a bunch of weird status bits only relevant for
physical watchdog cards which are not made accessible through the
Go package.
Sadly there are no integration tests for this package as ktest wouldn't
work for this because a) no watchdog HW and b) the test success depends
on a condition outside the kernel.
Change-Id: If138a97bc655025da4426665f8cbf1f093cc3bb1
Reviewed-on: https://review.monogon.dev/c/monogon/+/2142
Reviewed-by: Serge Bazanski <serge@monogon.tech>
Tested-by: Jenkins CI
diff --git a/metropolis/pkg/watchdog/BUILD.bazel b/metropolis/pkg/watchdog/BUILD.bazel
new file mode 100644
index 0000000..0363883
--- /dev/null
+++ b/metropolis/pkg/watchdog/BUILD.bazel
@@ -0,0 +1,9 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_library")
+
+go_library(
+ name = "watchdog",
+ srcs = ["watchdog.go"],
+ importpath = "source.monogon.dev/metropolis/pkg/watchdog",
+ visibility = ["//visibility:public"],
+ deps = ["@org_golang_x_sys//unix"],
+)