[comp.sys.hp] why is TIOCNOTTY not defined? what is TIOCNOTTY?

lynch@batcomputer.tn.cornell.edu (Tim Lynch) (08/26/89)

I notice that in my ioctl.h file (in /usr/include/sys) that the
definition for TIOCNOTTY is ifdef'ed out.  Anybody know why?

I've built code, specifically the kip code for managing an
Appletalk network, that requires TIOCNOTTY by simply removing
the conditional ifdef, thus, making TIOCNOTTY defined.  Everything
works.  But I have to admit, I don't understand what's going
on here.   Any light that can be shed on this issue would be
most appreciated.

Thanks,

Tim Lynch, Chemistry Dept.  Cornell U.   lynch@chemres.tn.cornell.edu

rer@hpfcdc.HP.COM (Rob Robason) (08/29/89)

> I notice that in my ioctl.h file (in /usr/include/sys) that the
> definition for TIOCNOTTY is ifdef'ed out.  Anybody know why?

> I've built code, specifically the kip code for managing an
> Appletalk network, that requires TIOCNOTTY by simply removing
> the conditional ifdef, thus, making TIOCNOTTY defined.  Everything
> works.  But I have to admit, I don't understand what's going
> on here.   Any light that can be shed on this issue would be
> most appreciated.

The BSD reference says:

"A process can remove the association it has with its controlling
terminal by opening the file /dev/tty and issuing an

	ioctl(f, TIOCNOTTY, 0);

This is often desirable in server processes."

This same function may be accomplished in HP-UX with setpgrp(2).

I wouldn't bet that "Everything Works" in my application, if I were you.
Terminal affiliation is pretty confusing, and there may be side effects
you haven't noticed *yet*.

If the function described above is what your application needs,
I would suggest that you ifdef your code something like:

#ifdef TIOCNOTTY
	ioctl(f, TIOCNOTTY, 0);
#else
	setpgrp();
#endif

Rob Robason