Hi, In our environment, we have users that run persistent VNC sessions, and on request through inetd. For ease of reminding, I like to give the persistent users a low display number (e.g. 1-20). The problem is that a new persistent user may have its display blocked by an inetd session.
Therefor I like to specify a display range that inetd can use. The following patch allows an optional argument for inetd: Xvnc -inetd 20-100; % uses displays 20-100 Xvnc -inetd; % uses the default 1-99 Greetings, Sebastiaan Ps: while testing incorrect input, I noticed that incorrect input is ignored by default. E.g. Xvnc -screen -1 10x20x24 only gives a message and the usage options, but runs Xvnc ignoring the incorrect argument. --- ../../../../unix/xserver/hw/vnc/xvnc.cc 2011-02-21 16:05:15.000000000 +0100 +++ xvnc.cc 2011-03-03 13:58:06.209531786 +0100 @@ -289,7 +289,8 @@ ErrorF("-geometry WxH set screen 0's width, height\n"); ErrorF("-depth D set screen 0's depth\n"); ErrorF("-pixelformat fmt set pixel format (rgbNNN or bgrNNN)\n"); - ErrorF("-inetd has been launched from inetd\n"); + ErrorF("-inetd [Start-End] has been launched from inetd\n"); + ErrorF(" Optionally, a display range can be given.\n"); ErrorF("-interface IP_address listen on specified interface\n"); ErrorF("-noclipboard disable clipboard settings modification via vncconfig utility\n"); ErrorF("\nVNC parameters:\n"); @@ -532,26 +533,43 @@ if (strcmp(argv[i], "-inetd") == 0) { + /* Check for optional argument */ + int DisplayStart=1, DisplayEnd=99; + int argsread = 1; + + if ((i+1<argc) && (sscanf(argv[i+1],"%d-%d",&DisplayStart, + &DisplayEnd) == 2)) + { + /* Display range argument was specified, check range */ + if (DisplayStart<0 || DisplayStart>MAXSCREENS || DisplayEnd<0 || DisplayEnd > MAXSCREENS || DisplayStart>DisplayEnd) + { + ErrorF("Invalid inetd port range %s\n", argv[i+1]); + UseMsg(); + } + argsread = 2; + } + dup2(0,3); vncInetdSock = 3; close(2); - + if (!displaySpecified) { int port = network::TcpSocket::getSockPort(vncInetdSock); int displayNum = port - 5900; - if (displayNum < 0 || displayNum > 99 || !displayNumFree(displayNum)) { - for (displayNum = 1; displayNum < 100; displayNum++) + if (displayNum < DisplayStart || displayNum > DisplayEnd || !displayNumFree(displayNum)) { + for (displayNum = DisplayStart; displayNum < DisplayEnd; displayNum++) if (displayNumFree(displayNum)) break; - if (displayNum == 100) + if (displayNum == DisplayEnd+1) FatalError("Xvnc error: no free display number for -inetd"); } display = displayNumStr; sprintf(displayNumStr, "%d", displayNum); + } - - return 1; + return argsread; } if (strcmp(argv[i], "-interface") == 0 || ------------------------------------------------------------------------------ Free Software Download: Index, Search & Analyze Logs and other IT data in Real-Time with Splunk. Collect, index and harness all the fast moving IT data generated by your applications, servers and devices whether physical, virtual or in the cloud. Deliver compliance at lower cost and gain new business insights. http://p.sf.net/sfu/splunk-dev2dev _______________________________________________ Tigervnc-devel mailing list Tigervnc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tigervnc-devel