blob: 0601e69fc58ab6f603a185d79e677230ad832d52 [file] [log] [blame]
Damien Millerd4a8b7e1999-10-27 13:42:43 +10001/*
Damien Miller95def091999-11-25 00:26:21 +11002 *
3 * pty.h
4 *
5 * Author: Tatu Ylonen <ylo@cs.hut.fi>
6 *
7 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
8 * All rights reserved
9 *
10 * Created: Fri Mar 17 05:03:28 1995 ylo
11 *
12 * Functions for allocating a pseudo-terminal and making it the controlling
13 * tty.
14 */
Damien Millerd4a8b7e1999-10-27 13:42:43 +100015
Damien Miller5428f641999-11-25 11:54:57 +110016/* RCSID("$Id: pty.h,v 1.3 1999/11/25 00:54:59 damien Exp $"); */
Damien Millerd4a8b7e1999-10-27 13:42:43 +100017
18#ifndef PTY_H
19#define PTY_H
20
Damien Miller5428f641999-11-25 11:54:57 +110021/*
22 * Allocates and opens a pty. Returns 0 if no pty could be allocated, or
23 * nonzero if a pty was successfully allocated. On success, open file
24 * descriptors for the pty and tty sides and the name of the tty side are
25 * returned (the buffer must be able to hold at least 64 characters).
26 */
Damien Miller95def091999-11-25 00:26:21 +110027int pty_allocate(int *ptyfd, int *ttyfd, char *ttyname);
Damien Millerd4a8b7e1999-10-27 13:42:43 +100028
Damien Miller5428f641999-11-25 11:54:57 +110029/*
30 * Releases the tty. Its ownership is returned to root, and permissions to
31 * 0666.
32 */
Damien Miller95def091999-11-25 00:26:21 +110033void pty_release(const char *ttyname);
Damien Millerd4a8b7e1999-10-27 13:42:43 +100034
Damien Miller5428f641999-11-25 11:54:57 +110035/*
36 * Makes the tty the processes controlling tty and sets it to sane modes.
37 * This may need to reopen the tty to get rid of possible eavesdroppers.
38 */
Damien Miller95def091999-11-25 00:26:21 +110039void pty_make_controlling_tty(int *ttyfd, const char *ttyname);
Damien Millerd4a8b7e1999-10-27 13:42:43 +100040
41/* Changes the window size associated with the pty. */
Damien Miller95def091999-11-25 00:26:21 +110042void
43pty_change_window_size(int ptyfd, int row, int col,
44 int xpixel, int ypixel);
Damien Millerd4a8b7e1999-10-27 13:42:43 +100045
Damien Miller95def091999-11-25 00:26:21 +110046#endif /* PTY_H */