什么是“tty”?在 FreeBSD 上?
“uprintf() 函数输出到当前进程的控制 tty”
这是 Freebsd MAN 中对 uprintf() 的描述。 我不明白tty是什么? 谢谢。假期愉快!
"uprintf() function outputs to the current process' controlling tty"
This is description of uprintf() from Freebsd MAN.
I don't understand what is tty?
Thanks.Nice holiday!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
tty 是字符 I/O 设备的抽象模型。它最直接的是一个系统接口,有相应的应用程序接口。
从前有一家名为Teletype的公司。他们制造了硬拷贝自动打字机设备,几十年来一直用作通信终端,然后重新用作硬拷贝计算机终端。电传打字机被概括为电传打字机或电传打印机,以避免使用品牌名称。
最初它们很实用,但相当丑陋...
但后来的型号(这个型号 43 来自 1970 年代末)是相当漂亮...
微处理器使视频显示终端变得实用,以前,硬复印终端要便宜得多,而且更受欢迎。碰巧的是,Unix tty 抽象对于视频终端也非常有效。
而且,它对于 xterm Windows 和 xterm 的子项(通常称为 Terminal)运行得很好,这些子项将在 Linux、Mac 和 Unix 的其他后代上找到......
A tty is an abstract model of a character I/O device. It is most directly a system interface, with corresponding application program interfaces.
Once upon a time there was a corporation named Teletype. They made hardcopy automatic typewriter devices that were used as communications terminals for decades and then repurposed as hardcopy computer terminals. Teletype was generalized to teletypewriter or teleprinter in order to avoid using a brand name.
Originally they were functional but rather ugly...
But later models (this model 43 is from the late 1970's) were quite beautiful...
The microprocessor made video display terminals practical, previously, the hard copy terminals were quite a bit cheaper and vastly more popular. As it happens, the Unix tty abstraction worked great for video terminals as well.
And, it worked just fine for xterm windows, and xterm's children (usually called Terminal) that will be found on Linux, Mac, and other descendants of Unix...
“控制 tty”的概念具有现代含义,但“tty”一词是一个非常古老的概念。 tty = 电传打字机,这是人们与计算机进行通信的方式。 FreeBSD 手册页中“tty”的概念是指接受程序用户输入的设备。
现在,Windows 等也接受用户输入。但这并不是“tty”的确切含义。只有某些窗口有与其关联的 tty。一般来说,例如大多数 shell 窗口。在这种情况下,tty 称为伪终端,也称为“pty”。它是一个“伪”终端,因为它不与特定设备关联。事实上,它是由一个伪装成终端的程序控制的。如果是窗口,则为显示窗口的程序。
在 Unices 中,tty 在程序中具有特殊的作用。大多数进程都有一个“控制 tty”或“控制终端”。无论进程拥有什么权限,该 tty 都可以向它们发送某些类型的信号。例如,SIGTSTP。
The concept of 'controlling tty' has a modern meaning, but the word 'tty' is a very old concept. tty = teletype, and it's how people used to communicate with computers. The concept of 'tty' in the FreeBSD man page is referring to the device that is accepting user input for the program.
Now, windows and such are accepting user input too. But that's not what a 'tty' refers to exactly. Only certain windows have a tty associated with them. Generally, for example, most shell windows. In that case the tty is known as a psuedo-terminal, and is also called a 'pty'. It's a 'pseudo' terminal because it isn't associated with a specific device. In fact, it's controlled by a program that's pretending to be a terminal. In the case of a window, the program that displays the window.
In Unices, a tty has a special role in a program. Most processes have a 'controlling tty' or 'controlling terminal'. This tty is allowed to send them certain kinds of signals, regardless of what privileges the process has. For example, SIGTSTP.
根据维基百科,这个名字来自电传打字机,缩写为“TTY”。直接打印到 tty 意味着它将消息直接打印到控制台,即使 STDOUT 已重定向到文件或另一个进程。
According to Wikipedia, the name comes from teletypewriter, abbreviated “TTY”. Printing directly to the tty means that it prints a message directly to the console, even if STDOUT has been redirected to a file or another process.
实际上是系统中当前输入设备的名称......在大多数情况下是键盘。
这意味着您的键盘是设备 ttys001
Actually is the name of your current input device from your system... in most cases your keyboard.
this means that your keyboard is the device ttys001