什么是“tty”?在 FreeBSD 上?

发布于 2024-10-09 15:32:22 字数 97 浏览 7 评论 0原文

“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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

つ低調成傷 2024-10-16 15:32:22

tty 是字符 I/O 设备的抽象模型。它最直接的是一个系统接口,有相应的应用程序接口。

从前有一家名为Teletype的公司。他们制造了硬拷贝自动打字机设备,几十年来一直用作通信终端,然后重新用作硬拷贝计算机终端。电传打字机被概括为电传打字机或电传打印机,以避免使用品牌名称。

最初它们很实用,但相当丑陋...

alt text

但后来的型号(这个型号 43 来自 1970 年代末)是相当漂亮...

alt text

微处理器使视频显示终端变得实用,以前,硬复印终端要便宜得多,而且更受欢迎。碰巧的是,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...

alt text

But later models (this model 43 is from the late 1970's) were quite beautiful...

alt text

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...

酒与心事 2024-10-16 15:32:22

“控制 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.

猫弦 2024-10-16 15:32:22

根据维基百科,这个名字来自电传打字机,缩写为“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.

夜唯美灬不弃 2024-10-16 15:32:22

实际上是系统中当前输入设备的名称......在大多数情况下是键盘。

mac-user:~$ tty
    /dev/ttys001

这意味着您的键盘是设备 ttys001

Actually is the name of your current input device from your system... in most cases your keyboard.

mac-user:~$ tty
    /dev/ttys001

this means that your keyboard is the device ttys001

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文