… | |
… | |
276 | static int |
276 | static int |
277 | control_tty (int fd_tty) |
277 | control_tty (int fd_tty) |
278 | { |
278 | { |
279 | setsid (); |
279 | setsid (); |
280 | |
280 | |
281 | # if defined(PTYS_ARE_PTMX) && defined(I_PUSH) |
281 | #if defined(PTYS_ARE_PTMX) && defined(I_PUSH) |
282 | /* |
282 | /* |
283 | * Push STREAMS modules: |
283 | * Push STREAMS modules: |
284 | * ptem: pseudo-terminal hardware emulation module. |
284 | * ptem: pseudo-terminal hardware emulation module. |
285 | * ldterm: standard terminal line discipline. |
285 | * ldterm: standard terminal line discipline. |
286 | * ttcompat: V7, 4BSD and XENIX STREAMS compatibility module. |
286 | * ttcompat: V7, 4BSD and XENIX STREAMS compatibility module. |
… | |
… | |
294 | * documentation is really unclear about whether it is any close () on |
294 | * documentation is really unclear about whether it is any close () on |
295 | * the master side or the last close () - i.e. a proper STREAMS dismantling |
295 | * the master side or the last close () - i.e. a proper STREAMS dismantling |
296 | * close () - on the master side which causes a hang up to be sent |
296 | * close () - on the master side which causes a hang up to be sent |
297 | * through - Geoff Wing |
297 | * through - Geoff Wing |
298 | */ |
298 | */ |
299 | # ifdef HAVE_ISASTREAM |
299 | # ifdef HAVE_ISASTREAM |
300 | if (isastream (fd_tty) == 1) |
300 | if (isastream (fd_tty) == 1) |
301 | # endif |
301 | # endif |
302 | { |
302 | { |
303 | ioctl (fd_tty, I_PUSH, "ptem"); |
303 | ioctl (fd_tty, I_PUSH, "ptem"); |
304 | ioctl (fd_tty, I_PUSH, "ldterm"); |
304 | ioctl (fd_tty, I_PUSH, "ldterm"); |
305 | ioctl (fd_tty, I_PUSH, "ttcompat"); |
305 | ioctl (fd_tty, I_PUSH, "ttcompat"); |
306 | } |
306 | } |
307 | # endif |
307 | #endif |
308 | |
308 | |
309 | ioctl (fd_tty, TIOCSCTTY, NULL); |
309 | ioctl (fd_tty, TIOCSCTTY, NULL); |
310 | |
310 | |
311 | int fd = open ("/dev/tty", O_WRONLY); |
311 | int fd = open ("/dev/tty", O_WRONLY); |
312 | if (fd < 0) |
312 | if (fd < 0) |