linux - DISPLAY 环境变量的语法是什么?

标签 linux x11

我正在为 linux 在 x86-64 程序集中编写程序,它将仅使用通过 syscall 指令调用的系统调用来创建 X11 窗口。根据 DISPLAY 环境变量的内容,我必须创建 tcp 或 unix 套接字。在 linux 手册“man 7 X”中写道:

The hostname part of the display name should be the empty string. For example: :0, :1, and :0.1. The most efficient local transport will be chosen.

但是我从 https://en.wikibooks.org/wiki/X_Window_Programming/XCB 编译了 C 代码示例并使用更改后的 DISPLAY 环境变量在 GDB 中运行已编译的可执行文件。当我将 DISPLAY 环境变量从 DISPLAY=:0 更改为 DISPLAY=unix:0 或 DISPLAY=unix/:0 或 DISPLAY=unix/abc:0 时,仍会创建窗口。是不是linux手册有误,DISPLAY环境变量的真正语法是什么?

最佳答案

简短回答:X11 可以在多个传输上运行。该评论与“本地”连接有关。

长答案:

您包含的引用是指“本地”连接。 X11 系统可以运行在几个 tarnsport 层上。在我的系统上:

       local
               The hostname part of the display name should be the empty string.  For example:  :0, :1, and :0.1.  The most effi‐
               cient local transport will be chosen.

       TCPIP
               The hostname part of the display name should be the server machine's hostname or IP address.  Full Internet names,
               abbreviated names, IPv4 addresses, and IPv6 addresses are all allowed.  For  example:  x.org:0,  expo:0,  [::1]:0,
               198.112.45.11:0, bigmachine:1, and hydra:0.1.

此外,许多系统支持在 unix 套接字上运行,这(至少在过去)比 TCP 连接更有效。

关于linux - DISPLAY 环境变量的语法是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58385887/

相关文章:

linux - 第一列中相同值的第二列和第三列之和

linux - 如何使用 Tibco BW 执行命令

linux - UNIX 中的 splitpcap Windows 工具命令

tcl - WordNet 3.0 无法安装在 OS X Mountain Lion (10.8) 上

c++ - 未定义对新 NCURSES 6.1 函数的引用(alloc_pair、reset_color_pairs)

window - 如何在 xcb 中使用 shm pixmap?

linux - 在 Linux 上运行 GUI 应用程序,而不显示图形用户界面?

python - 在 Linux 上获取鼠标位置,纯 Python

c - 在linux中显示来自C的gif gif87a图像的最佳方法

Linux多核负载均衡