[comp.sys.hp] Need help for TIOCNOTTY on HP9K400

rocky@polyof.poly.edu (A1 rocky shiotsuki (staff) ) (02/06/91)

   I need to compile a program on HP 9000 Series 400 which
use TIOCNOTTY.
   In the file /usr/include/sys/ioctl.h, a TIOCNOTTY is defined
as followed:

#ifdef __hp9000s800
/*
 * tty ioctl commands
  */

  #ifdef  notdef
  #define TIOCNOTTY       _IO('t', 113)           /* void tty association */
  #endif /* notdef */

So, On Series 800, a TIOCNOTTY is defined, but not Series 400.
Some one can give me clue what to do.

  Thanks

-----------------------------------------------------------------------
Rocky Shiotsuki				Internet: rocky@puscs.poly.edu
Systems Programmer					128.238.5.8
Polytechnic University
333 Jay Street, Brooklyn, New York 11201

tml@tik.vtt.fi (Tor Lillqvist) (02/06/91)

In article <1991Feb5.201415.22555@polyof.poly.edu> rocky@polyof.poly.edu (A1 rocky shiotsuki (staff) ) writes:
      I need to compile a program on HP 9000 Series 400 which
   use TIOCNOTTY.
      In the file /usr/include/sys/ioctl.h, a TIOCNOTTY is defined
   as followed:

   #ifdef __hp9000s800
   /*
    * tty ioctl commands
     */

     #ifdef  notdef
     #define TIOCNOTTY       _IO('t', 113)           /* void tty association */
     #endif /* notdef */

   So, On Series 800, a TIOCNOTTY is defined, but not Series 400.

No it isn't defined on s800.  Note the #ifdef notdef.  Anyway, to get
the desired effect (detach from controlling terminal), use the
setsid() system call.  Then do signal(SIGHUP, SIG_IGN) and fork(), and
continue in the child, or else you might acquire a new controlling
terminal if and when you happen to open a terminal device file.
--
Tor Lillqvist,
working, but not speaking, for the Technical Research Centre of Finland

ash@hpindda.cup.hp.com (Art Harkin) (02/08/91)

A possible alternative to TIOCNOTTY is the following:

                        f=open("/dev/tty",O_RDWR);
#ifdef hpux
                        setpgrp();
#else
                        (void)ioctl(f, (int)TIOCNOTTY, (char *)0);
#endif


The command setpgrp() does disassociate with the process's tty.  
See setpgrp(2) for more information.

Art Harkin
HP