Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!tut.cis.ohio-state.edu!ucbvax!hplabs!hp-pcd!hpfcso!hpfcdc!rml From: rml@hpfcdc.HP.COM (Bob Lenk) Newsgroups: comp.sys.hp Subject: Re: Device drivers for Hewlet Packard HP-UX version 7 Message-ID: <5570392@hpfcdc.HP.COM> Date: 28 Mar 90 03:15:40 GMT References: <1054@vision.UUCP> Organization: HP Ft. Collins, Co. Lines: 38 In message <1054@vision.UUCP> chas@vision.UUCP (Charles Hirst) writes: > I traced the problem to the failure of the TIOCSPGRP ioctl issued by the > csh. > ... > However if I pass the TIOCSPGRP ioctl down it fails with error 25, > ENOTTY. As a fix I trap it myself and simply fill the tty t_pgrp field > in with the supplied argument ( the requested pid to set process group > to ). > > Can anybody tell me what fields need filling in, in a tty structure > during the open routine. Looking at the tty struct does not help as HP > have played with it a lot to get POSIX compatibility. I currently treat > it like a BSD structure. > > The driver used to work with version 3 of HP-UX, if that helps. Most likely the problem is due to POSIX security requirements on the ioctl call (actually the POSIX tcsetpgrp() call, which is the same thing). POSIX requires that the tty be the controlling tty of the calling process and that the tty be associated with the session of the calling process. Your solution is essentially defeating these checks; note that it could cause security problems in some environments. Earlier versions of HP-UX used different checks based on uids instead. The check probably is based on fields in the proc or user structure, as well as the tty structure that point to or otherwise identify each other. If I understand your "driver" to be a user process at the master end of a pty, it shouldn't be handling these directly. The best way to handle this is probably to make sure that the session in the window is initialized properly to create the affiliations. This requires that the session leader (probably whatever exec's csh) be the first to open the slave, and that it call setsid(2) or setpgrp(2) before opening the slave (details on termio(7)). Bob Lenk rml@hpfcla.hp.com hplabs!hpfcla!rml