v2: switch to C and atexit (suggested by Gert) Signed-off-by: Chia-I Wu <olvaffe@gmail.com> Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org> (v1) Reviewed-by: Ryan Neph <ryanneph@google.com> (v1)