home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / sys / apple2 / gno / 421 < prev    next >
Encoding:
Text File  |  1992-11-21  |  3.1 KB  |  66 lines

  1. Newsgroups: comp.sys.apple2.gno
  2. Path: sparky!uunet!cis.ohio-state.edu!tortoise.cis.ohio-state.edu!meekins
  3. From: meekins@tortoise.cis.ohio-state.edu (Tim Meekins)
  4. Subject: Re: [1] + Stopped (tty input)
  5. Message-ID: <1992Nov22.025212.29361@cis.ohio-state.edu>
  6. Sender: news@cis.ohio-state.edu (NETnews        )
  7. Organization: The Ohio State University Dept. of Computer and Info. Science
  8. References: <By1C80.5t0@CAM.ORG>
  9. Date: Sun, 22 Nov 1992 02:52:12 GMT
  10. Lines: 54
  11.  
  12. In article <By1C80.5t0@CAM.ORG> vandry@CAM.ORG (Phillip Vandry) writes:
  13. >That program I posted a while ago that forks a process and crashes when that
  14. >process finishes -- well, I got it working. Turns out I was doing something
  15. >that seems legal, but causes a crash much later.
  16. >
  17.  
  18. Cool, I'll hold up on looking at your code then.
  19.  
  20. >But I have another problem now: After the child process dies, the main program
  21. >reads from Standard Input, and I get a [1] + Stopped (tty input)
  22. >
  23. >There are two reasons why this should not occur:
  24. >
  25. >1. It's running in the foreground. Why stop a foreground process because it
  26. >   wants to read from Stamdard in?
  27. >2. Standard input under normal circumstances (I run it from the console to
  28. >   debug but it's supposed to run off the modem port) is the modem port. Hey!
  29. >   I'd like to read from the modem port, please!
  30. >
  31. >Something weird: the child process itself runs a child process: gsh, and resumeswhen gsh quits. If I remove the code to run gsh (thus making the program pretty
  32. >useless, but still :)) it never mentions [1] + Stopped (tty input)
  33. >
  34. >Because of this, it seems as though gsh somehow changes the environment of its
  35. >parent process. Under no circumstances should a child be able to do that!
  36. >
  37. >Jawaid, you suggested creating a new process group, but (1) I don't see how thatwould help, and (2) How would that be done anyway?
  38. >
  39.  
  40.  
  41.  
  42. when you get a stopped (tty input), in means a process not belonging to 
  43. foreground process group is trying to read input from the console. This
  44. is protection to keep two programs from both trying to simultaneously
  45. trying to read from the same input stream (standard input, in this case).
  46.  
  47. I suspect that your forked process is starting a 'gsh', but your main
  48. process controls the tty. what you need to do is give your forked
  49. process (which exeve's gsh) access to the tty by adding it to the process
  50. group.
  51.  
  52. This is quite simple to do, since I already did it in the scriupt.asm
  53. you were using as a base. You'll want to duplicate all the process group
  54. calls in script.asm and use them in your program. The process group
  55. call are calls such as tcnewgroup and similar...just find where they're
  56. called in script.asm and use them in a similar or identical manner
  57. in your program. when you do this, your process will join the process
  58. group and will be able to legally use the standard i/o.
  59.  
  60. TIM MEEKINS                    Ask me about GNO/ME! - MultiTasking on a IIGS!
  61. meekins@cis.ohio-state.edu     Procyon, Inc., 11738 Aqueduct Drive
  62. AOL: GNO Tim2 (@aol.com)       Littleton, CO 80127   (303) 933-4649
  63.                           
  64.       "Computers aren't intelligent, they just think they are."
  65.  
  66.