ioctl question

ioctl question

Post by Tim Weilkien » Fri, 12 Jul 1996 04:00:00



Hi,

I have written a program which runs as a daemon.
To lose the controlling tty, I call ioctl():

            if ( (fd = open("/dev/tty", O_RDWR)) >= 0) {
                ioctl(fd, TIOCNOTTY, (char *)NULL); /* lose controlling tty */
                close(fd);

I can compile the program under Linux and NeXT. But I also want to
compile it under SunOS 5.5. The compiler returns the error message,
that TIOCNOTTY is unknow. I can't find out how to use the ioctl function
with Sun operating system.

Thanks for any hints.

Tim

--
'All of my life - in a world so unfair' (GENESIS 1992)
******************************************************
* Tim Weilkiens, Kiel, Germany                       *

******************************************************

 
 
 

ioctl question

Post by Kurt Fran » Sat, 13 Jul 1996 04:00:00



|> Hi,
|>
|> I have written a program which runs as a daemon.
|> To lose the controlling tty, I call ioctl():
|>
|>             if ( (fd = open("/dev/tty", O_RDWR)) >= 0) {
|>                 ioctl(fd, TIOCNOTTY, (char *)NULL); /* lose controlling tty */
|>                 close(fd);
|>
|> I can compile the program under Linux and NeXT. But I also want to
|> compile it under SunOS 5.5. The compiler returns the error message,
|> that TIOCNOTTY is unknow. I can't find out how to use the ioctl function
|> with Sun operating system.
...

the TIOCNOTTY cannot be used in this manner.
its designed to prevent a terminal device become the control terminal
of a process when it is opened. if a process has no control terminal
the normal behaviour for a terminal device is to become it when opened.

to loose your control terminal you have to call setsid() to create a
new session. if your systems lacks setsid() you may use setpgrp() if it
is a posix like call on your system or setpgrp(0, 0) if it is a
bsd like call on your system to get the same effect.

kf

--

 
 
 

1. ioctl questions

I'm trying to record with a SoundBlaster using the July 2 version of
-current.  However, I'm getting a lot of clicks and the sampling rate is
too low.  I think I need to use ioctl() to set parameters like sampling
rate, etc.; but, I'm not sure.  I'd appreciate any comments on the issue
of controlling the SB.

Thanks in advance.

//////////////////////////////////////////////////////////////

/Information Networking Institute                            /
/Carnegie Mellon University  Office: (412) 268-8128, 268-3029/  
/                                                            /
/"God help us we're in the hands of engineers."                    /
/          -Jeff Goldblum as Dr. Ian Malcolm in Jurassic Park/
//////////////////////////////////////////////////////////////

2. "Activation State Mismatched"

3. stty/gtty vs ioctl question

4. Help: Internet Connection Prob.

5. Irix 6.5 ioctl() question

6. X, AGP Viper330, Deawoo 17" Monitor. HELP!!!

7. evms ioctl question

8. OSR5; WINDOWS FAT32 PROBLEM

9. IOCTL question in linux device driver

10. 4.2BSD / System V ioctl questions

11. Serial I/O ioctl() question

12. dm-ioctl.h - device-mapper ioctl packet fixes

13. getting 'ioctl failed: Inappropriate ioctl for device'