douglas@dcc1.UUCP (Douglas B. Jones) (05/24/87)
Hi UWs,
I need some help here. The below shar file has the problem in it.
Here is a description of the porblem:
After compiling (instruction in program) the program below, I
execute it with:
%a.out username
%^D (now in users csh shell)
(I typed in the control-d above and exited back to my shell).
After leaving the shell, I get the message that my a.out program
is stopped due to tty output. I must then do a:
%fg
to get it to continue the program. Well, I don't want this to happen,
but I want to go on and execute the rest of the program without this
interuption.
This program is actually a small example of a much bigger program. In
the bigger program, I have input afterwords. So, I can't do a:
signal(SIGTTOU,SIG_IGN)
in the program, because it (the program) will go into an inifinite loop
trying to read from the terminal. I don't know why, but it does happen.
I even try running this from the 'sh' under my csh login, the csh
suspended both the sh and the a.out with the tty output message.
The interuption (tty output stop) is pointed output in the below
program by the DO_IOCTL flag. If this is not defined, then the
program will run fine. If you define this, you get the stop message.
It appears, then, that when some ioctl() is done that the csh gets
a SIGTTOU signal. I'm not really sure here, but I could sure use
some help.
You will also notice that I have a rlogin line commented out. If
you use the rlogin command instead of the su command, everything
works ok (even with DO_IOCTL defined).
About the rlogin command below:
This program was written on machince dcc2, so I am doing an rlogin
on to the machine I am on when I wrote this program. I am mailing
this mail from another machince (dcc1). If you decide not to reply
to the net, but to me, please mail to me on dcc1.
Well, I hope my above comments are explanatory enough.
Thanks for any help in advance,
Douglas
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
U.S. MAIL | UUCP
Douglas B. Jones | |akgua----\
Academic Computer Center | |cbosgd----\
DeKalb College | ...!|hplabs---->!gatech!{dcc1,dcc2}!douglas
555 N. Indian Creek Drive | |ihnp4---- / or
Clarkston, Georgia 30021 | |seismo---/ douglas@dcc1
| |ulysses-/ douglas@dcc2
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
# t.c
# This archive created: Sat May 23 21:27:22 1987
# By: Douglas B. Jones (DeKalb College, Clarkston GA)
export PATH; PATH=/bin:$PATH
echo shar: extracting "'t.c'" '(457 characters)'
if test -f 't.c'
then
echo shar: will not over-write existing file "'t.c'"
else
sed 's/^X//' << \SHAR_EOF > 't.c'
X#include <curses.h>
X/* %cc -DDO_IOCTL t.c -lcurses -ltermcap */
X
Xmain(argc,argv)
Xint argc;
Xchar *argv[];
X{
Xchar buf[80];
X
Xif (argc != 2) {
X fprintf(stderr,"usage: t login_name\n");
X exit(1);
X}
X
Xinitscr();
X
Xsprintf(buf,"/bin/su %s",argv[1]);
X/*sprintf(buf,"/usr/ucb/rlogin dcc2 -l %s",argv[1]);*/
Xsystem(buf);
X
X#ifdef DO_IOCTL
Xraw();
Xnoecho();
Xnoraw();
Xecho();
X#endif DO_IOCTL
Xclear();
Xmove(LINES-2,0);
Xprintw("BYE");
Xmove(LINES-1,0);
Xrefresh();
Xendwin();
X}
SHAR_EOF
if test 457 -ne "`wc -c < 't.c'`"
then
echo shar: error transmitting "'t.c'" '(should have been 457 characters)'
fi
fi # end of overwriting check
# End of shell archive
exit 0
haral@unisol.UUCP (05/26/87)
> douglas@dcc1.UUCP (Douglas B. Jones) writes: > After compiling (instruction in program) the program below, I > execute it with: > %a.out username > %^D> > > > (now in users csh shell) > (I typed in the control-d above and exited back to my shell). > After leaving the shell, I get the message that my a.out program > is stopped due to tty output. I must then do a: > %fg > to get it to continue the program. > ... >Xsprintf(buf,"/bin/su %s",argv[1]); Your problem will go away if you execute the user's shell directly and don't use "su" or other programs that set the first character of the shell to "-" as in "-csh" to signify a login shell. I am not sure why this is true but you will notice the same problem when you set argv[0] to "-anything" as part of the exec system call. I first noticed this on the Mt. Xinu 4.3 release and I guess is part of the standard 4.3 release. I don't think the problem (or feature) existed in 4.2. Note that if you don't call "su" you have to "setuid" and maybe "setgid" (in a sub-process) to get the same effect. --Haral Tsitsivas UniSolutions Associates (213) 641-6739 ...!seismo!scgvaxd!ashtate!unisol!haral