xref: /OK3568_Linux_fs/external/xserver/dix/main.c (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /***********************************************************
2*4882a593Smuzhiyun 
3*4882a593Smuzhiyun Copyright 1987, 1998  The Open Group
4*4882a593Smuzhiyun 
5*4882a593Smuzhiyun Permission to use, copy, modify, distribute, and sell this software and its
6*4882a593Smuzhiyun documentation for any purpose is hereby granted without fee, provided that
7*4882a593Smuzhiyun the above copyright notice appear in all copies and that both that
8*4882a593Smuzhiyun copyright notice and this permission notice appear in supporting
9*4882a593Smuzhiyun documentation.
10*4882a593Smuzhiyun 
11*4882a593Smuzhiyun The above copyright notice and this permission notice shall be included in
12*4882a593Smuzhiyun all copies or substantial portions of the Software.
13*4882a593Smuzhiyun 
14*4882a593Smuzhiyun THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15*4882a593Smuzhiyun IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16*4882a593Smuzhiyun FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
17*4882a593Smuzhiyun OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18*4882a593Smuzhiyun AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19*4882a593Smuzhiyun CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20*4882a593Smuzhiyun 
21*4882a593Smuzhiyun Except as contained in this notice, the name of The Open Group shall not be
22*4882a593Smuzhiyun used in advertising or otherwise to promote the sale, use or other dealings
23*4882a593Smuzhiyun in this Software without prior written authorization from The Open Group.
24*4882a593Smuzhiyun 
25*4882a593Smuzhiyun Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
26*4882a593Smuzhiyun 
27*4882a593Smuzhiyun                         All Rights Reserved
28*4882a593Smuzhiyun 
29*4882a593Smuzhiyun Permission to use, copy, modify, and distribute this software and its
30*4882a593Smuzhiyun documentation for any purpose and without fee is hereby granted,
31*4882a593Smuzhiyun provided that the above copyright notice appear in all copies and that
32*4882a593Smuzhiyun both that copyright notice and this permission notice appear in
33*4882a593Smuzhiyun supporting documentation, and that the name of Digital not be
34*4882a593Smuzhiyun used in advertising or publicity pertaining to distribution of the
35*4882a593Smuzhiyun software without specific, written prior permission.
36*4882a593Smuzhiyun 
37*4882a593Smuzhiyun DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
38*4882a593Smuzhiyun ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
39*4882a593Smuzhiyun DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
40*4882a593Smuzhiyun ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
41*4882a593Smuzhiyun WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
42*4882a593Smuzhiyun ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
43*4882a593Smuzhiyun SOFTWARE.
44*4882a593Smuzhiyun 
45*4882a593Smuzhiyun ******************************************************************/
46*4882a593Smuzhiyun 
47*4882a593Smuzhiyun /* The panoramix components contained the following notice */
48*4882a593Smuzhiyun /*****************************************************************
49*4882a593Smuzhiyun 
50*4882a593Smuzhiyun Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts.
51*4882a593Smuzhiyun 
52*4882a593Smuzhiyun Permission is hereby granted, free of charge, to any person obtaining a copy
53*4882a593Smuzhiyun of this software and associated documentation files (the "Software"), to deal
54*4882a593Smuzhiyun in the Software without restriction, including without limitation the rights
55*4882a593Smuzhiyun to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
56*4882a593Smuzhiyun copies of the Software.
57*4882a593Smuzhiyun 
58*4882a593Smuzhiyun The above copyright notice and this permission notice shall be included in
59*4882a593Smuzhiyun all copies or substantial portions of the Software.
60*4882a593Smuzhiyun 
61*4882a593Smuzhiyun THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
62*4882a593Smuzhiyun IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
63*4882a593Smuzhiyun FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
64*4882a593Smuzhiyun DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
65*4882a593Smuzhiyun BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY,
66*4882a593Smuzhiyun WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
67*4882a593Smuzhiyun IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
68*4882a593Smuzhiyun 
69*4882a593Smuzhiyun Except as contained in this notice, the name of Digital Equipment Corporation
70*4882a593Smuzhiyun shall not be used in advertising or otherwise to promote the sale, use or other
71*4882a593Smuzhiyun dealings in this Software without prior written authorization from Digital
72*4882a593Smuzhiyun Equipment Corporation.
73*4882a593Smuzhiyun 
74*4882a593Smuzhiyun ******************************************************************/
75*4882a593Smuzhiyun 
76*4882a593Smuzhiyun #ifdef HAVE_DIX_CONFIG_H
77*4882a593Smuzhiyun #include <dix-config.h>
78*4882a593Smuzhiyun #include <version-config.h>
79*4882a593Smuzhiyun #endif
80*4882a593Smuzhiyun 
81*4882a593Smuzhiyun #include <X11/X.h>
82*4882a593Smuzhiyun #include <X11/Xos.h>            /* for unistd.h  */
83*4882a593Smuzhiyun #include <X11/Xproto.h>
84*4882a593Smuzhiyun #include <pixman.h>
85*4882a593Smuzhiyun #include "scrnintstr.h"
86*4882a593Smuzhiyun #include "misc.h"
87*4882a593Smuzhiyun #include "os.h"
88*4882a593Smuzhiyun #include "windowstr.h"
89*4882a593Smuzhiyun #include "resource.h"
90*4882a593Smuzhiyun #include "dixstruct.h"
91*4882a593Smuzhiyun #include "gcstruct.h"
92*4882a593Smuzhiyun #include "extension.h"
93*4882a593Smuzhiyun #include "colormap.h"
94*4882a593Smuzhiyun #include "colormapst.h"
95*4882a593Smuzhiyun #include "cursorstr.h"
96*4882a593Smuzhiyun #include "selection.h"
97*4882a593Smuzhiyun #include <X11/fonts/font.h>
98*4882a593Smuzhiyun #include <X11/fonts/fontstruct.h>
99*4882a593Smuzhiyun #include <X11/fonts/libxfont2.h>
100*4882a593Smuzhiyun #include "opaque.h"
101*4882a593Smuzhiyun #include "servermd.h"
102*4882a593Smuzhiyun #include "hotplug.h"
103*4882a593Smuzhiyun #include "site.h"
104*4882a593Smuzhiyun #include "dixfont.h"
105*4882a593Smuzhiyun #include "extnsionst.h"
106*4882a593Smuzhiyun #include "privates.h"
107*4882a593Smuzhiyun #include "registry.h"
108*4882a593Smuzhiyun #include "client.h"
109*4882a593Smuzhiyun #include "exevents.h"
110*4882a593Smuzhiyun #ifdef PANORAMIX
111*4882a593Smuzhiyun #include "panoramiXsrv.h"
112*4882a593Smuzhiyun #else
113*4882a593Smuzhiyun #include "dixevents.h"          /* InitEvents() */
114*4882a593Smuzhiyun #endif
115*4882a593Smuzhiyun 
116*4882a593Smuzhiyun #ifdef DPMSExtension
117*4882a593Smuzhiyun #include <X11/extensions/dpmsconst.h>
118*4882a593Smuzhiyun #include "dpmsproc.h"
119*4882a593Smuzhiyun #endif
120*4882a593Smuzhiyun 
121*4882a593Smuzhiyun extern void Dispatch(void);
122*4882a593Smuzhiyun 
123*4882a593Smuzhiyun CallbackListPtr RootWindowFinalizeCallback = NULL;
124*4882a593Smuzhiyun 
125*4882a593Smuzhiyun int
dix_main(int argc,char * argv[],char * envp[])126*4882a593Smuzhiyun dix_main(int argc, char *argv[], char *envp[])
127*4882a593Smuzhiyun {
128*4882a593Smuzhiyun     int i;
129*4882a593Smuzhiyun     HWEventQueueType alwaysCheckForInput[2];
130*4882a593Smuzhiyun 
131*4882a593Smuzhiyun     display = "0";
132*4882a593Smuzhiyun 
133*4882a593Smuzhiyun     InitRegions();
134*4882a593Smuzhiyun 
135*4882a593Smuzhiyun     CheckUserParameters(argc, argv, envp);
136*4882a593Smuzhiyun 
137*4882a593Smuzhiyun     CheckUserAuthorization();
138*4882a593Smuzhiyun 
139*4882a593Smuzhiyun     InitConnectionLimits();
140*4882a593Smuzhiyun 
141*4882a593Smuzhiyun     ProcessCommandLine(argc, argv);
142*4882a593Smuzhiyun 
143*4882a593Smuzhiyun     alwaysCheckForInput[0] = 0;
144*4882a593Smuzhiyun     alwaysCheckForInput[1] = 1;
145*4882a593Smuzhiyun     while (1) {
146*4882a593Smuzhiyun         serverGeneration++;
147*4882a593Smuzhiyun         ScreenSaverTime = defaultScreenSaverTime;
148*4882a593Smuzhiyun         ScreenSaverInterval = defaultScreenSaverInterval;
149*4882a593Smuzhiyun         ScreenSaverBlanking = defaultScreenSaverBlanking;
150*4882a593Smuzhiyun         ScreenSaverAllowExposures = defaultScreenSaverAllowExposures;
151*4882a593Smuzhiyun 
152*4882a593Smuzhiyun         InitBlockAndWakeupHandlers();
153*4882a593Smuzhiyun         /* Perform any operating system dependent initializations you'd like */
154*4882a593Smuzhiyun         OsInit();
155*4882a593Smuzhiyun         if (serverGeneration == 1) {
156*4882a593Smuzhiyun             CreateWellKnownSockets();
157*4882a593Smuzhiyun             for (i = 1; i < LimitClients; i++)
158*4882a593Smuzhiyun                 clients[i] = NullClient;
159*4882a593Smuzhiyun             serverClient = calloc(sizeof(ClientRec), 1);
160*4882a593Smuzhiyun             if (!serverClient)
161*4882a593Smuzhiyun                 FatalError("couldn't create server client");
162*4882a593Smuzhiyun             InitClient(serverClient, 0, (void *) NULL);
163*4882a593Smuzhiyun         }
164*4882a593Smuzhiyun         else
165*4882a593Smuzhiyun             ResetWellKnownSockets();
166*4882a593Smuzhiyun         clients[0] = serverClient;
167*4882a593Smuzhiyun         currentMaxClients = 1;
168*4882a593Smuzhiyun 
169*4882a593Smuzhiyun         /* clear any existing selections */
170*4882a593Smuzhiyun         InitSelections();
171*4882a593Smuzhiyun 
172*4882a593Smuzhiyun         /* Initialize privates before first allocation */
173*4882a593Smuzhiyun         dixResetPrivates();
174*4882a593Smuzhiyun 
175*4882a593Smuzhiyun         /* Initialize server client devPrivates, to be reallocated as
176*4882a593Smuzhiyun          * more client privates are registered
177*4882a593Smuzhiyun          */
178*4882a593Smuzhiyun         if (!dixAllocatePrivates(&serverClient->devPrivates, PRIVATE_CLIENT))
179*4882a593Smuzhiyun             FatalError("failed to create server client privates");
180*4882a593Smuzhiyun 
181*4882a593Smuzhiyun         if (!InitClientResources(serverClient)) /* for root resources */
182*4882a593Smuzhiyun             FatalError("couldn't init server resources");
183*4882a593Smuzhiyun 
184*4882a593Smuzhiyun         SetInputCheck(&alwaysCheckForInput[0], &alwaysCheckForInput[1]);
185*4882a593Smuzhiyun         screenInfo.numScreens = 0;
186*4882a593Smuzhiyun 
187*4882a593Smuzhiyun         InitAtoms();
188*4882a593Smuzhiyun         InitEvents();
189*4882a593Smuzhiyun         xfont2_init_glyph_caching();
190*4882a593Smuzhiyun         dixResetRegistry();
191*4882a593Smuzhiyun         InitFonts();
192*4882a593Smuzhiyun         InitCallbackManager();
193*4882a593Smuzhiyun         InitOutput(&screenInfo, argc, argv);
194*4882a593Smuzhiyun 
195*4882a593Smuzhiyun         if (screenInfo.numScreens < 1)
196*4882a593Smuzhiyun             FatalError("no screens found");
197*4882a593Smuzhiyun         InitExtensions(argc, argv);
198*4882a593Smuzhiyun 
199*4882a593Smuzhiyun         for (i = 0; i < screenInfo.numGPUScreens; i++) {
200*4882a593Smuzhiyun             ScreenPtr pScreen = screenInfo.gpuscreens[i];
201*4882a593Smuzhiyun             if (!CreateScratchPixmapsForScreen(pScreen))
202*4882a593Smuzhiyun                 FatalError("failed to create scratch pixmaps");
203*4882a593Smuzhiyun             if (pScreen->CreateScreenResources &&
204*4882a593Smuzhiyun                 !(*pScreen->CreateScreenResources) (pScreen))
205*4882a593Smuzhiyun                 FatalError("failed to create screen resources");
206*4882a593Smuzhiyun         }
207*4882a593Smuzhiyun 
208*4882a593Smuzhiyun         for (i = 0; i < screenInfo.numScreens; i++) {
209*4882a593Smuzhiyun             ScreenPtr pScreen = screenInfo.screens[i];
210*4882a593Smuzhiyun 
211*4882a593Smuzhiyun             if (!CreateScratchPixmapsForScreen(pScreen))
212*4882a593Smuzhiyun                 FatalError("failed to create scratch pixmaps");
213*4882a593Smuzhiyun             if (pScreen->CreateScreenResources &&
214*4882a593Smuzhiyun                 !(*pScreen->CreateScreenResources) (pScreen))
215*4882a593Smuzhiyun                 FatalError("failed to create screen resources");
216*4882a593Smuzhiyun             if (!CreateGCperDepth(i))
217*4882a593Smuzhiyun                 FatalError("failed to create scratch GCs");
218*4882a593Smuzhiyun             if (!CreateDefaultStipple(i))
219*4882a593Smuzhiyun                 FatalError("failed to create default stipple");
220*4882a593Smuzhiyun             if (!CreateRootWindow(pScreen))
221*4882a593Smuzhiyun                 FatalError("failed to create root window");
222*4882a593Smuzhiyun             CallCallbacks(&RootWindowFinalizeCallback, pScreen);
223*4882a593Smuzhiyun         }
224*4882a593Smuzhiyun 
225*4882a593Smuzhiyun         if (SetDefaultFontPath(defaultFontPath) != Success) {
226*4882a593Smuzhiyun             ErrorF("[dix] failed to set default font path '%s'",
227*4882a593Smuzhiyun                    defaultFontPath);
228*4882a593Smuzhiyun         }
229*4882a593Smuzhiyun         if (!SetDefaultFont(defaultTextFont)) {
230*4882a593Smuzhiyun             FatalError("could not open default font '%s'", defaultTextFont);
231*4882a593Smuzhiyun         }
232*4882a593Smuzhiyun 
233*4882a593Smuzhiyun         if (!(rootCursor = CreateRootCursor(NULL, 0))) {
234*4882a593Smuzhiyun             FatalError("could not open default cursor font '%s'",
235*4882a593Smuzhiyun                        defaultCursorFont);
236*4882a593Smuzhiyun         }
237*4882a593Smuzhiyun 
238*4882a593Smuzhiyun #ifdef PANORAMIX
239*4882a593Smuzhiyun         /*
240*4882a593Smuzhiyun          * Consolidate window and colourmap information for each screen
241*4882a593Smuzhiyun          */
242*4882a593Smuzhiyun         if (!noPanoramiXExtension)
243*4882a593Smuzhiyun             PanoramiXConsolidate();
244*4882a593Smuzhiyun #endif
245*4882a593Smuzhiyun 
246*4882a593Smuzhiyun         for (i = 0; i < screenInfo.numScreens; i++)
247*4882a593Smuzhiyun             InitRootWindow(screenInfo.screens[i]->root);
248*4882a593Smuzhiyun 
249*4882a593Smuzhiyun         InitCoreDevices();
250*4882a593Smuzhiyun         InitInput(argc, argv);
251*4882a593Smuzhiyun         InitAndStartDevices();
252*4882a593Smuzhiyun         ReserveClientIds(serverClient);
253*4882a593Smuzhiyun 
254*4882a593Smuzhiyun         dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
255*4882a593Smuzhiyun 
256*4882a593Smuzhiyun         dixCloseRegistry();
257*4882a593Smuzhiyun 
258*4882a593Smuzhiyun #ifdef PANORAMIX
259*4882a593Smuzhiyun         if (!noPanoramiXExtension) {
260*4882a593Smuzhiyun             if (!PanoramiXCreateConnectionBlock()) {
261*4882a593Smuzhiyun                 FatalError("could not create connection block info");
262*4882a593Smuzhiyun             }
263*4882a593Smuzhiyun         }
264*4882a593Smuzhiyun         else
265*4882a593Smuzhiyun #endif
266*4882a593Smuzhiyun         {
267*4882a593Smuzhiyun             if (!CreateConnectionBlock()) {
268*4882a593Smuzhiyun                 FatalError("could not create connection block info");
269*4882a593Smuzhiyun             }
270*4882a593Smuzhiyun         }
271*4882a593Smuzhiyun 
272*4882a593Smuzhiyun         NotifyParentProcess();
273*4882a593Smuzhiyun 
274*4882a593Smuzhiyun         InputThreadInit();
275*4882a593Smuzhiyun 
276*4882a593Smuzhiyun         Dispatch();
277*4882a593Smuzhiyun 
278*4882a593Smuzhiyun         UndisplayDevices();
279*4882a593Smuzhiyun         DisableAllDevices();
280*4882a593Smuzhiyun 
281*4882a593Smuzhiyun         /* Now free up whatever must be freed */
282*4882a593Smuzhiyun         if (screenIsSaved == SCREEN_SAVER_ON)
283*4882a593Smuzhiyun             dixSaveScreens(serverClient, SCREEN_SAVER_OFF, ScreenSaverReset);
284*4882a593Smuzhiyun         FreeScreenSaverTimer();
285*4882a593Smuzhiyun         CloseDownExtensions();
286*4882a593Smuzhiyun 
287*4882a593Smuzhiyun #ifdef PANORAMIX
288*4882a593Smuzhiyun         {
289*4882a593Smuzhiyun             Bool remember_it = noPanoramiXExtension;
290*4882a593Smuzhiyun 
291*4882a593Smuzhiyun             noPanoramiXExtension = TRUE;
292*4882a593Smuzhiyun             FreeAllResources();
293*4882a593Smuzhiyun             noPanoramiXExtension = remember_it;
294*4882a593Smuzhiyun         }
295*4882a593Smuzhiyun #else
296*4882a593Smuzhiyun         FreeAllResources();
297*4882a593Smuzhiyun #endif
298*4882a593Smuzhiyun 
299*4882a593Smuzhiyun         CloseInput();
300*4882a593Smuzhiyun 
301*4882a593Smuzhiyun         InputThreadFini();
302*4882a593Smuzhiyun 
303*4882a593Smuzhiyun         for (i = 0; i < screenInfo.numScreens; i++)
304*4882a593Smuzhiyun             screenInfo.screens[i]->root = NullWindow;
305*4882a593Smuzhiyun 
306*4882a593Smuzhiyun         CloseDownDevices();
307*4882a593Smuzhiyun 
308*4882a593Smuzhiyun         CloseDownEvents();
309*4882a593Smuzhiyun 
310*4882a593Smuzhiyun         for (i = screenInfo.numGPUScreens - 1; i >= 0; i--) {
311*4882a593Smuzhiyun             ScreenPtr pScreen = screenInfo.gpuscreens[i];
312*4882a593Smuzhiyun             FreeScratchPixmapsForScreen(pScreen);
313*4882a593Smuzhiyun             (*pScreen->CloseScreen) (pScreen);
314*4882a593Smuzhiyun             dixFreeScreenSpecificPrivates(pScreen);
315*4882a593Smuzhiyun             dixFreePrivates(pScreen->devPrivates, PRIVATE_SCREEN);
316*4882a593Smuzhiyun             free(pScreen);
317*4882a593Smuzhiyun             screenInfo.numGPUScreens = i;
318*4882a593Smuzhiyun         }
319*4882a593Smuzhiyun 
320*4882a593Smuzhiyun         for (i = screenInfo.numScreens - 1; i >= 0; i--) {
321*4882a593Smuzhiyun             FreeScratchPixmapsForScreen(screenInfo.screens[i]);
322*4882a593Smuzhiyun             FreeGCperDepth(i);
323*4882a593Smuzhiyun             FreeDefaultStipple(i);
324*4882a593Smuzhiyun             (*screenInfo.screens[i]->CloseScreen) (screenInfo.screens[i]);
325*4882a593Smuzhiyun             dixFreeScreenSpecificPrivates(screenInfo.screens[i]);
326*4882a593Smuzhiyun             dixFreePrivates(screenInfo.screens[i]->devPrivates, PRIVATE_SCREEN);
327*4882a593Smuzhiyun             free(screenInfo.screens[i]);
328*4882a593Smuzhiyun             screenInfo.numScreens = i;
329*4882a593Smuzhiyun         }
330*4882a593Smuzhiyun 
331*4882a593Smuzhiyun         ReleaseClientIds(serverClient);
332*4882a593Smuzhiyun         dixFreePrivates(serverClient->devPrivates, PRIVATE_CLIENT);
333*4882a593Smuzhiyun         serverClient->devPrivates = NULL;
334*4882a593Smuzhiyun 
335*4882a593Smuzhiyun 	dixFreeRegistry();
336*4882a593Smuzhiyun 
337*4882a593Smuzhiyun         FreeFonts();
338*4882a593Smuzhiyun 
339*4882a593Smuzhiyun         FreeAllAtoms();
340*4882a593Smuzhiyun 
341*4882a593Smuzhiyun         FreeAuditTimer();
342*4882a593Smuzhiyun 
343*4882a593Smuzhiyun         DeleteCallbackManager();
344*4882a593Smuzhiyun 
345*4882a593Smuzhiyun         ClearWorkQueue();
346*4882a593Smuzhiyun 
347*4882a593Smuzhiyun         if (dispatchException & DE_TERMINATE) {
348*4882a593Smuzhiyun             CloseWellKnownConnections();
349*4882a593Smuzhiyun         }
350*4882a593Smuzhiyun 
351*4882a593Smuzhiyun         OsCleanup((dispatchException & DE_TERMINATE) != 0);
352*4882a593Smuzhiyun 
353*4882a593Smuzhiyun         if (dispatchException & DE_TERMINATE) {
354*4882a593Smuzhiyun             ddxGiveUp(EXIT_NO_ERROR);
355*4882a593Smuzhiyun             break;
356*4882a593Smuzhiyun         }
357*4882a593Smuzhiyun 
358*4882a593Smuzhiyun         free(ConnectionInfo);
359*4882a593Smuzhiyun         ConnectionInfo = NULL;
360*4882a593Smuzhiyun     }
361*4882a593Smuzhiyun     return 0;
362*4882a593Smuzhiyun }
363