Thank you for replies. I will do this huge change:
Code: Select all
#include <stdio.h>
/* #include <unistd.h> */
Background information: I have currently implemented many virtual consoles and they can be activated by pressing F1, F2, F3, etc. Every console runs a command-line interpreter called Admin Console. It is a built-in process that cannot be terminated. It runs in user space but it has some special privileges when compared to normal processes. It can do some system calls that are otherwise forbidden.
Every process has its own input buffer. There is always just one process that receives keyboard input. Keyboard driver puts characters to that input buffer. When I change my virtual console, the active process is changed also to the "active process of that virtual console." When I want to start a program, the command is something like
start program. The new process is then active (for keyboard input) to that virtual console. This works well when there is only one process per virtual console (in addition to Admin Console). When the program exits, the active process is Admin Console again. Simple.
I am now finding the best solution to handle this "active process thing" when the "real process" creates another process. I know my system is not even close to be POSIX compliant. However, I like this very simple behaviour. I am already thinking whether I should allow the process creation at all for normal programs... It could be that only my Admin Console can start programs. Then there is no traditional "parent-child tree". It would be simply something like that:
Code: Select all
- Admin Console 1 (Active Program: 3)
- Program 1
- Program 2
- Program 3
- Program 4
- Admin Console 2 (Active Program: 6)
- Program 5
- Program 6
- Program 7
- Program 8
Then there should be some user-friendly way to change the active process inside the virtual console. Maybe something like:
Code: Select all
Press Esc to activate Admin Console. Then type "activate < program>"
I am sorry that this post is not very well structured. This is
stream of thoughts.