How high do X11 display numbers go?

2019-06-17 07:17发布

The displayno is part of the X11 display name.

I have seen several definitions that explain it is a number from 0 upwards, but I haven't seen any documents that explain if there is a maximum display number.

What is the highest display number? Where is it defined?


The background for this question is that I am trying to understand the Display number allocation algorithm of PyVirtualDisplay. I haven't understood the role of the /tmp/.X*lock files yet, but it looks like the allocation routine will choose always increasing display numbers, suggesting at some stage of repeatedly being invoked it might hit the limit and fall over, especially if it is small.

标签: x11
1条回答
别忘想泡老子
2楼-- · 2019-06-17 08:02

Short answer: it's not well defined.

Longer answer: it depends on the stream protocol you happen to be using. In TCP it happens to be simply added to the base port number of 6000, which means the server will fail to launch somewhere around display number 59535. Over unix domain sockets it's just an integer appended to the socket name under /tmp/.X11-unix (so if you're launching the server with -nolisten tcp you can have a few billion or so). In DECnet... well, I don't know, but if you ever find yourself in a situation to care, I'm very sorry.

Possibly better answer for posterity: if you're using a sufficiently new X server, you can use the -displayfd <n> argument to tell the server to simply pick an available display number, and write it back to you on that file descriptor. Think that's new in xserver 1.13, which should be out late 2012.

查看更多
登录 后发表回答