Losing /dev/tty in a process

Kevin P. Kleinfelter kevin at msa3b.UUCP
Thu Oct 19 03:14:05 AEST 1989


Is this a bug in AIX or a bug in my brain?

Consider the following code fragment:

	pid = getpid ();
	setpgrp ();
	ioctl (2, TIOCSPGRP, &pid);

I assert that this should create a new process group with the
current process as the "process group leader," and attach the process
group to the terminal (file handle 2 = stderr = the tty).

However, after executing the above code, the following fragment
produces "open failed:No such device or address" as output.

	f = fopen ("/dev/tty", "r");
	if (f == NULL) perror ("open failed");

If this is not a bug, please suggest how one should create a new process
group, and attach it to the terminal.  I can't believe this is really a
bug in AIX, because "csh" must do something similar to this.

HHHHHEEEEELLLLLLPPPPPPP!!!!!

-- 
Kevin Kleinfelter @ Management Science America, Inc (404) 239-2347
gatech!nanovx!msa3b!kevin



More information about the Comp.unix.aix mailing list