Standard Input, Standard Output
Posted: Thu Mar 11, 2004 3:21 am
I have quite some troubles to understand the concept behind standard input and standard output in the correct way.
Until now, I do Input and output by having the processes talk directly to the console driver. This is of course not a really appreciated solution for it requires lots of hacks and ugly kludges - and it doesn't faciliate spawning off processes at different consoles.
I am thinking about the following: The file service keeps the file descriptor lists- a list for each process. So it is plain and clear, that fs service needs to be notified, if a process is forked - to register it and create the file descriptors for standard input and standard output. These two are by default also known to the process - as Defines or entries in the fd array it keeps in some library. So they would be fd 1 and fd 2.
Upon fork, fs service instantiates a new object of kind fs_proc and attaches these two standard files to it.
Am I wrong with this?
Well ... that's it for now, I need to do some thinking to get a solution for it. Some sketch will help, thats for sure. And as soon as I get round this, it will maybe faciliate redirecting of stdinput and stdoutput. Well, lets see.
stay safe
Until now, I do Input and output by having the processes talk directly to the console driver. This is of course not a really appreciated solution for it requires lots of hacks and ugly kludges - and it doesn't faciliate spawning off processes at different consoles.
I am thinking about the following: The file service keeps the file descriptor lists- a list for each process. So it is plain and clear, that fs service needs to be notified, if a process is forked - to register it and create the file descriptors for standard input and standard output. These two are by default also known to the process - as Defines or entries in the fd array it keeps in some library. So they would be fd 1 and fd 2.
Upon fork, fs service instantiates a new object of kind fs_proc and attaches these two standard files to it.
Am I wrong with this?
Well ... that's it for now, I need to do some thinking to get a solution for it. Some sketch will help, thats for sure. And as soon as I get round this, it will maybe faciliate redirecting of stdinput and stdoutput. Well, lets see.
stay safe