xorg: added -uds option

ulab-original
Jay Sorg 13 years ago
parent 90a359dadb
commit ffa5149a8f

@ -192,6 +192,8 @@ int
g_tcp_socket(void);
int
g_tcp_local_socket_dgram(void);
int
g_tcp_local_socket_stream(void);
void
g_memcpy(void* d_ptr, const void* s_ptr, int size);
int

@ -45,6 +45,11 @@ DeviceIntPtr g_keyboard = 0;
Bool g_wrapWindow = 0;
Bool g_wrapPixmap = 0;
/* if true, use a unix domain socket instead of a tcp socket */
int g_use_uds = 0;
char g_uds_data[256] = ""; /* data */
char g_uds_cont[256] = ""; /* control */
/* set all these at once, use function set_bpp */
int g_bpp = 16;
int g_Bpp = 2;
@ -503,7 +508,7 @@ ddxProcessArgument(int argc, char** argv, int i)
}
return 2;
}
if (strcmp (argv[i], "-depth") == 0)
if (strcmp(argv[i], "-depth") == 0)
{
if (i + 1 >= argc)
{
@ -516,6 +521,11 @@ ddxProcessArgument(int argc, char** argv, int i)
}
return 2;
}
if (strcmp(argv[i], "-uds") == 0)
{
g_use_uds = 1;
return 1;
}
return 0;
}
@ -613,7 +623,7 @@ InitInput(int argc, char** argv)
void
ddxGiveUp(void)
{
char unixSocketName[64];
char unixSocketName[128];
ErrorF("ddxGiveUp:\n");
g_free(g_rdpScreen.pfbMemory);
@ -623,6 +633,10 @@ ddxGiveUp(void)
unlink(unixSocketName);
sprintf(unixSocketName, "/tmp/.xrdp/xrdp_disconnect_display_%s", display);
unlink(unixSocketName);
if(g_uds_data[0] != 0)
{
unlink(g_uds_data);
}
}
}
@ -670,6 +684,7 @@ ddxUseMsg(void)
ErrorF("X11rdp specific options\n");
ErrorF("-geometry WxH set framebuffer width & height\n");
ErrorF("-depth D set framebuffer depth\n");
ErrorF("-uds create and listen on /tmp/.xrdp/xrdp_display_x\n");
ErrorF("\n");
exit(1);
}

@ -263,6 +263,13 @@ g_tcp_local_socket_dgram(void)
return socket(AF_UNIX, SOCK_DGRAM, 0);
}
/*****************************************************************************/
int
g_tcp_local_socket_stream(void)
{
return socket(AF_UNIX, SOCK_STREAM, 0);
}
/*****************************************************************************/
void
g_memcpy(void* d_ptr, const void* s_ptr, int size)

@ -80,7 +80,7 @@ rdpRRGetInfo(ScreenPtr pScreen, Rotation* pRotations)
}
/******************************************************************************/
/* for lack of a better way, a window is created that covers a the area and
/* for lack of a better way, a window is created that covers the area and
when its deleted, it's invalidated */
static int
rdpInvalidateArea(ScreenPtr pScreen, int x, int y, int cx, int cy)

@ -51,6 +51,10 @@ extern int g_Bpp; /* from rdpmain.c */
extern int g_Bpp_mask; /* from rdpmain.c */
extern rdpScreenInfoRec g_rdpScreen; /* from rdpmain.c */
/* true is to use unix domain socket */
extern int g_use_uds; /* in rdpmain.c */
extern char g_uds_data[]; /* in rdpmain.c */
/*
0 GXclear, 0
1 GXnor, DPon
@ -457,7 +461,6 @@ rdpup_init(void)
{
return 0;
}
g_sprintf(text, "62%2.2d", i);
if (g_in_s == 0)
{
make_stream(g_in_s);
@ -468,6 +471,24 @@ rdpup_init(void)
make_stream(g_out_s);
init_stream(g_out_s, 8192 * g_Bpp + 100);
}
if (g_use_uds)
{
g_sprintf(g_uds_data, "/tmp/.xrdp/xrdp_display_%s", display);
if (g_listen_sck == 0)
{
g_listen_sck = g_tcp_local_socket_stream();
if (g_tcp_local_bind(g_listen_sck, g_uds_data) != 0)
{
ErrorF("rdpup_init: g_tcp_local_bind failed\n");
return 0;
}
g_tcp_listen(g_listen_sck);
AddEnabledDevice(g_listen_sck);
}
}
else
{
g_sprintf(text, "62%2.2d", i);
if (g_listen_sck == 0)
{
g_listen_sck = g_tcp_socket();
@ -478,6 +499,7 @@ rdpup_init(void)
g_tcp_listen(g_listen_sck);
AddEnabledDevice(g_listen_sck);
}
}
g_dis_listen_sck = g_tcp_local_socket_dgram();
if (g_dis_listen_sck != 0)
{

Loading…
Cancel
Save