0

I am using PPODMAN systemd based podman containers and to kill the container I just execute the command systemctl halt and the container gets killed. I execute following steps:

Create Container

podman create -t -i \
--restart=always \
--systemd=true \
--name test \
oraclelinux:7 /usr/sbin/init

Start the Container

podman start test

Kill the container

podman exec -i -t test /bin/bash
systemctl halt

I want to directly call the system call which basically called by the systemctl halt command. How can I call the API using C?

BMitch
  • 231,797
  • 42
  • 475
  • 450
drifter
  • 389
  • 1
  • 5
  • 17
  • [systemctl-compat-halt.c](https://github.com/systemd/systemd/blob/5709c7fe4e5c0a5c53b543f3d79cba7fc0ace065/src/systemctl/systemctl-compat-halt.c#L144) on github – Matt May 25 '21 at 03:39
  • and `halt_now` in [systemctl-util.c](https://github.com/systemd/systemd/blob/ed056c560b47f84a0aa0289151f4ec91f786d24a/src/systemctl/systemctl-util.c) – Matt May 25 '21 at 03:49
  • and [reboot](https://man7.org/linux/man-pages/man2/reboot.2.html) – Matt May 25 '21 at 03:49
  • Thanks for the input. Is there any in the library to call halt_now from C function? – drifter May 25 '21 at 15:25

0 Answers0