Linux系统编程:终端操作与进程间通信
1. 创建伪终端(PTY)
1.1 操作步骤
- 编译程序 :
$> make my-pty
gcc -Wall -Wextra -pedantic -std=c99 my-pty.c -o my-pty
- 运行程序并记录从设备路径 :
$> ./my-pty
Slave: /dev/pts/31
- 检查设备 :
$> ls -l /dev/pts/31
crw--w---- 1 jake tty 136, 31 jan 3 20:32 /dev/pts/31
$> file /dev/pts/31
/dev/pts/31: character special (136/31)
- 连接从设备 :打开新终端,使用
screen
连接从设备路径。
$> scre