shutdown apps


I want to write a custom shutdown command, which kills all apps and drivers (harddisk etc…), but let herself running.

After the shutdown, the app should switch a relay which is connected to a serial interface. (the relay switch the PC off)

Is this possible ?
How should I shutdown all apps and drivers from my C source ?

Is it right, that the following processes must run after my “shutdown” ?:

  • procnto
  • pci-bios

Which other processes are needed for in8/out8 ?

My system is x86 PC which runs a standard QNX 6.2.1 installation.

Best regards


You can send a signal to all process with signal ( pid, SIGPWR ) and signal ( pid, SIGTERM ).

However I find this method to be a little to violent. First kill all your own process then umount all devices, no need to kill the drivers, unmouting them is a lot cleaner and safe.

You don’t need any other processes to use in8 out8. However most program have stdin/stdout/stderr, so the program that kills everything must close all handles first before killing such process as devc-con (which I don’t see any reason to kill in the first place). Your program should also start its own session otherwise kill the parent shell will kill your program as well (but again I don’t see the point in killing the shells)

Hello mario,

I only want to prevent a corrupt filesystem while switching off.

I tried to unmount “/”, but I get only Resource busy…
How should I do that ?

What is the right way to shutdown the root filesystem ?

Thank you very much for your help !

Best regards


you can’t unmount / because it has more then the filesystem.

I beleive umount /dev/hd0.* will do the job.

Hello mario,

I can’t also unmount /dev/hd0t79, because there are processes which have open file which starts e.g /pkgs/ .

The following drivers/apps have open files:

  • procnto
  • Photon
  • dev-hirun
  • io-graphics

How can I unmount the partition from where the OS is running ?
How does this the “shutdown” command ?

Best regards


Hi Fiffi

What about calling function:
[color=darkred] system(“shutdown -fb”); :bulb:
command shutdowns system in time approx. 2 seconds. So you can before calling this send command to serial interface. Your serial interface must wait for 3 seconds before switching your relay to switch computer OFF. You can use famous integrated circuit “555” do wait 3 seconds…


Hello kastiel,

your idea is great !

Thanks a lot !

Best regards