1. SysV.4 Streams and Modules programming problem: 1
I have a problem with Streams, as follows. I'm working on a SysV.4
system which, if I interpret the release numbers right, is ICL's
version 6 level 3 of AT&T i386 V.4.0 release 3.0.
There exists on this system an old executable program which is
hard-coded for a particular terminal type. I'm writing a front end for
it which will interpret the screen codes and, using Curses, translate
them to work on other video types.
My program works by creating a pipe and forking/execvping the old
program. One end of the pipe is the program's stdin/stdout. The other
end is read/written in my program. This all works fine for ordinary
I need to catch the program's IOCTLs in order to know when it wants me
to echo keyboard input and when I mustn't. I read up on Streams and
modules and thought I could do it by creating a pipe like this:
myprog <--> pckt <--> ptem <--> ldterm <--> ttycompat <--> oldprog
I do it as follows: after I fork the child but before I exec, I push
ptem, ldterm and ttycompat onto its end of the pipe, then dup it to
stdin and stdout. After I fork the parent, I push pckt onto *its* end.
The parent reads with getmsg() and I expect the control portion of
returned messages to be M_DATA or M_IOCTL. But I only ever see M_DATA,
except for one final ioctl when the pipe is being closed. If I replace
'oldprog' by a shell script which contains stty commands, then I *do*
see M_IOCTLs for it.
I have also tried pushing 'pipemod' both before pushing pckt and before
ptem. The manual was most unclear on whether this was Essential,
Optional or a Bad Idea. But it didn't make any difference, anyway :-(
It may or may not be relevant that there seems to be a timing problem.
The child starts writing to stdout before the parent has pushed pckt. I
tried avoiding this by doing all the pushed before the fork, but it
appears that pushed modules are not inherited by the child. I don't
really want to use a semaphore, but I fear it may be unavoidable.
It's more likely, though, that I've misinterpretted the manual. I'd
really appreciate any help. I'm the only person I know who's gone into
Streams at this depth and I'm having to learn to swim real fast :-) All
suggestions, either for the Streams problem or for better ways of doing
it, gratefully welcomed.
"Politician! Where's your credibility ?
You promised to lay down your life to set your people free" - Hugh Masekela.
2. Scrambled screen with Diamond Stealth VRAM ISA
3. Any PCI Ethernet Cards working under Linux ?
4. stream module programming problem...
5. Boot hangs after POST
6. Is it OK to boot to an ext. fs?
7. What happens if a stream module is pushed onto multiple stream driver?
8. Solaris x86 failure to push streams module into network stream
9. How to push STREAMS module into socket stream
10. SysV Streams & Linux
11. Streams and Critical Regions on SYSV 4.0