1

As I understand it, one restriction of the Ravenscar profile is that tasks should not terminate.

This certainly makes sense on bare metal, however when testing on a native system (as a executable program) it has the side effect that doing a Control-C to exit the main task leaves the program running in the background.

I plan to move my program to bare metal eventually and would like to be able to use the Ravenscar profile -- how can one allow the program to exit correctly when doing something like this? Abort statements are forbidden. If the Ravenscar profile was not applied, I could easily make this work by allowing tasks to terminate. Right now I am doing a killall -9, which works, but doesn't seem very elegant.

jsinglet
  • 1,151
  • 7
  • 8
  • Doing a Control-C kills the process, which includes the main task and any subordinate Ada tasks. At least that is my experience on Linux and Windows with Ravenscar programs. It is similar to doing a kill -9 in that it is a brute force kill. There is no orderly shutdown of the Ada runtime. You'd get a similar effect if you write an Ada Import for the C exit() function and then call it from your Ada program. For Ravenscar apps, I prefer to use the Ctrl-C approach, because at least the program is acting as it should for a Ravenscar program. – B. Moore Dec 05 '19 at 02:23
  • @B.Moore -- I think I found the issue. I was executing the program via a ssh command. Adding the `-t` flag for tty allocation seems to fix the issue. Thank you for the quick response! – jsinglet Dec 05 '19 at 02:46
  • Why not compiling hosted version in full profile? You can apply individual Ravenscar's restrictions to your app as well. – Vovanium Dec 07 '19 at 14:18

1 Answers1

2

As it turns out, the issue had to do with how I was executing the program. In my case I was doing it over a remote ssh command, eg:

ssh myhost "sudo su -c mycommand"

Adding a -t to allocate a tty fixes the issue, that is:

ssh -t myhost "sudo su -c mycommand"

jsinglet
  • 1,151
  • 7
  • 8