Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nx-libs
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dimbor
nx-libs
Commits
d409b566
You need to sign in or sign up before continuing.
Commit
d409b566
authored
Nov 07, 2018
by
Ulrich Sibiller
Committed by
Mike Gabriel
Jan 06, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
os: unifdef WIN32
parent
74270d6b
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
6 additions
and
306 deletions
+6
-306
WaitFor.c
nx-X11/programs/Xserver/os/WaitFor.c
+0
-48
access.c
nx-X11/programs/Xserver/os/access.c
+0
-19
auth.c
nx-X11/programs/Xserver/os/auth.c
+0
-3
connection.c
nx-X11/programs/Xserver/os/connection.c
+0
-144
io.c
nx-X11/programs/Xserver/os/io.c
+0
-35
log.c
nx-X11/programs/Xserver/os/log.c
+0
-8
osdep.h
nx-X11/programs/Xserver/os/osdep.h
+0
-18
osinit.c
nx-X11/programs/Xserver/os/osinit.c
+3
-3
utils.c
nx-X11/programs/Xserver/os/utils.c
+3
-16
xdmcp.c
nx-X11/programs/Xserver/os/xdmcp.c
+0
-12
No files found.
nx-X11/programs/Xserver/os/WaitFor.c
View file @
d409b566
...
@@ -82,9 +82,6 @@ SOFTWARE.
...
@@ -82,9 +82,6 @@ SOFTWARE.
#include <dix-config.h>
#include <dix-config.h>
#endif
#endif
#ifdef WIN32
#include <nx-X11/Xwinsock.h>
#endif
#include <nx-X11/Xos.h>
/* for strings, fcntl, time */
#include <nx-X11/Xos.h>
/* for strings, fcntl, time */
#include <errno.h>
#include <errno.h>
#include <stdio.h>
#include <stdio.h>
...
@@ -105,22 +102,9 @@ static unsigned long startTimeInMillis;
...
@@ -105,22 +102,9 @@ static unsigned long startTimeInMillis;
#endif
#endif
#ifdef WIN32
/* Error codes from windows sockets differ from fileio error codes */
#undef EINTR
#define EINTR WSAEINTR
#undef EINVAL
#define EINVAL WSAEINVAL
#undef EBADF
#define EBADF WSAENOTSOCK
/* Windows select does not set errno. Use GetErrno as wrapper for
WSAGetLastError */
#define GetErrno WSAGetLastError
#else
/* This is just a fallback to errno to hide the differences between unix and
/* This is just a fallback to errno to hide the differences between unix and
Windows in the code */
Windows in the code */
#define GetErrno() errno
#define GetErrno() errno
#endif
/* modifications by raphael */
/* modifications by raphael */
int
int
...
@@ -484,30 +468,12 @@ WaitForSomething(int *pClientsReady)
...
@@ -484,30 +468,12 @@ WaitForSomething(int *pClientsReady)
if
(
XFD_ANYSET
(
&
clientsReadable
))
if
(
XFD_ANYSET
(
&
clientsReadable
))
break
;
break
;
#ifdef WIN32
/* Windows keyboard and mouse events are added to the input queue
in Block- and WakupHandlers. There is no device to check if
data is ready. So check here if new input is available */
#if defined(NX_TRANS_SOCKET)
if
(
*
checkForInput
[
0
]
!=
*
checkForInput
[
1
])
{
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG)
fprintf
(
stderr
,
"WaitForSomething: Returning 0 because of (*checkForInput[0] != *checkForInput[1]).
\n
"
);
#endif
return
0
;
}
#else
if
(
*
checkForInput
[
0
]
!=
*
checkForInput
[
1
])
return
0
;
#endif
#endif
}
}
}
}
nready
=
0
;
nready
=
0
;
if
(
XFD_ANYSET
(
&
clientsReadable
))
if
(
XFD_ANYSET
(
&
clientsReadable
))
{
{
#ifndef WIN32
for
(
i
=
0
;
i
<
howmany
(
XFD_SETSIZE
,
NFDBITS
);
i
++
)
for
(
i
=
0
;
i
<
howmany
(
XFD_SETSIZE
,
NFDBITS
);
i
++
)
{
{
while
(
clientsReadable
.
fds_bits
[
i
])
while
(
clientsReadable
.
fds_bits
[
i
])
...
@@ -517,23 +483,9 @@ WaitForSomething(int *pClientsReady)
...
@@ -517,23 +483,9 @@ WaitForSomething(int *pClientsReady)
curclient
=
ffs
(
clientsReadable
.
fds_bits
[
i
])
-
1
;
curclient
=
ffs
(
clientsReadable
.
fds_bits
[
i
])
-
1
;
client_index
=
/* raphael: modified */
client_index
=
/* raphael: modified */
ConnectionTranslation
[
curclient
+
(
i
*
(
sizeof
(
fd_mask
)
*
8
))];
ConnectionTranslation
[
curclient
+
(
i
*
(
sizeof
(
fd_mask
)
*
8
))];
#else
fd_set
savedClientsReadable
;
XFD_COPYSET
(
&
clientsReadable
,
&
savedClientsReadable
);
for
(
i
=
0
;
i
<
XFD_SETCOUNT
(
&
savedClientsReadable
);
i
++
)
{
int
client_priority
,
client_index
;
curclient
=
XFD_FD
(
&
savedClientsReadable
,
i
);
client_index
=
GetConnectionTranslation
(
curclient
);
#endif
pClientsReady
[
nready
++
]
=
client_index
;
pClientsReady
[
nready
++
]
=
client_index
;
#ifndef WIN32
clientsReadable
.
fds_bits
[
i
]
&=
~
(((
fd_mask
)
1L
)
<<
curclient
);
clientsReadable
.
fds_bits
[
i
]
&=
~
(((
fd_mask
)
1L
)
<<
curclient
);
}
}
#else
FD_CLR
(
curclient
,
&
clientsReadable
);
#endif
}
}
}
}
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG)
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG)
...
...
nx-X11/programs/Xserver/os/access.c
View file @
d409b566
...
@@ -58,9 +58,6 @@ SOFTWARE.
...
@@ -58,9 +58,6 @@ SOFTWARE.
#include <dix-config.h>
#include <dix-config.h>
#endif
#endif
#ifdef WIN32
#include <nx-X11/Xwinsock.h>
#endif
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
...
@@ -75,7 +72,6 @@ SOFTWARE.
...
@@ -75,7 +72,6 @@ SOFTWARE.
#include "site.h"
#include "site.h"
#include <errno.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/types.h>
#ifndef WIN32
#include <sys/socket.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <sys/ioctl.h>
#include <ctype.h>
#include <ctype.h>
...
@@ -141,7 +137,6 @@ SOFTWARE.
...
@@ -141,7 +137,6 @@ SOFTWARE.
/* #endif */
/* #endif */
#endif
#endif
#endif
/* WIN32 */
#ifndef PATH_MAX
#ifndef PATH_MAX
#include <sys/param.h>
#include <sys/param.h>
...
@@ -474,13 +469,7 @@ DefineSelf (int fd)
...
@@ -474,13 +469,7 @@ DefineSelf (int fd)
int
family
;
int
family
;
register
HOST
*
host
;
register
HOST
*
host
;
#ifndef WIN32
struct
utsname
name
;
struct
utsname
name
;
#else
struct
{
char
nodename
[
512
];
}
name
;
#endif
register
struct
hostent
*
hp
;
register
struct
hostent
*
hp
;
...
@@ -504,11 +493,7 @@ DefineSelf (int fd)
...
@@ -504,11 +493,7 @@ DefineSelf (int fd)
* uname() lets me access to the whole string (it smashes release, you
* uname() lets me access to the whole string (it smashes release, you
* see), whereas gethostname() kindly truncates it for me.
* see), whereas gethostname() kindly truncates it for me.
*/
*/
#ifndef WIN32
uname
(
&
name
);
uname
(
&
name
);
#else
gethostname
(
name
.
nodename
,
sizeof
(
name
.
nodename
));
#endif
hp
=
_XGethostbyname
(
name
.
nodename
,
hparams
);
hp
=
_XGethostbyname
(
name
.
nodename
,
hparams
);
if
(
hp
!=
NULL
)
if
(
hp
!=
NULL
)
...
@@ -1692,10 +1677,6 @@ ConvertAddr (
...
@@ -1692,10 +1677,6 @@ ConvertAddr (
return
FamilyLocal
;
return
FamilyLocal
;
#if defined(TCPCONN)
#if defined(TCPCONN)
case
AF_INET
:
case
AF_INET
:
#ifdef WIN32
if
(
16777343
==
*
(
long
*
)
&
((
struct
sockaddr_in
*
)
saddr
)
->
sin_addr
)
return
FamilyLocal
;
#endif
*
len
=
sizeof
(
struct
in_addr
);
*
len
=
sizeof
(
struct
in_addr
);
*
addr
=
(
void
*
)
&
(((
struct
sockaddr_in
*
)
saddr
)
->
sin_addr
);
*
addr
=
(
void
*
)
&
(((
struct
sockaddr_in
*
)
saddr
)
->
sin_addr
);
return
FamilyInternet
;
return
FamilyInternet
;
...
...
nx-X11/programs/Xserver/os/auth.c
View file @
d409b566
...
@@ -71,9 +71,6 @@ from The Open Group.
...
@@ -71,9 +71,6 @@ from The Open Group.
#define _SECURITY_SERVER
#define _SECURITY_SERVER
# include <nx-X11/extensions/security.h>
# include <nx-X11/extensions/security.h>
#endif
#endif
#ifdef WIN32
#include <nx-X11/Xw32defs.h>
#endif
struct
protocol
{
struct
protocol
{
unsigned
short
name_length
;
unsigned
short
name_length
;
...
...
nx-X11/programs/Xserver/os/connection.c
View file @
d409b566
...
@@ -65,9 +65,6 @@ SOFTWARE.
...
@@ -65,9 +65,6 @@ SOFTWARE.
#include <dix-config.h>
#include <dix-config.h>
#endif
#endif
#ifdef WIN32
#include <nx-X11/Xwinsock.h>
#endif
#include <nx-X11/X.h>
#include <nx-X11/X.h>
#include <nx-X11/Xproto.h>
#include <nx-X11/Xproto.h>
#define XSERV_t
#define XSERV_t
...
@@ -81,7 +78,6 @@ SOFTWARE.
...
@@ -81,7 +78,6 @@ SOFTWARE.
#include <stdlib.h>
#include <stdlib.h>
#include <unistd.h>
#include <unistd.h>
#ifndef WIN32
#include <sys/socket.h>
#include <sys/socket.h>
#if defined(TCPCONN)
#if defined(TCPCONN)
...
@@ -104,7 +100,6 @@ SOFTWARE.
...
@@ -104,7 +100,6 @@ SOFTWARE.
#endif
#endif
#include <sys/uio.h>
#include <sys/uio.h>
#endif
/* WIN32 */
#include "misc.h"
#include "misc.h"
#include "osdep.h"
#include "osdep.h"
#include <nx-X11/Xpoll.h>
#include <nx-X11/Xpoll.h>
...
@@ -155,98 +150,7 @@ int GrabInProgress = 0;
...
@@ -155,98 +150,7 @@ int GrabInProgress = 0;
static
void
static
void
QueueNewConnections
(
int
curconn
,
int
ready
,
void
*
data
);
QueueNewConnections
(
int
curconn
,
int
ready
,
void
*
data
);
#if !defined(WIN32)
int
*
ConnectionTranslation
=
NULL
;
int
*
ConnectionTranslation
=
NULL
;
#else
/*
* On NT fds are not between 0 and MAXSOCKS, they are unrelated, and there is
* not even a known maximum value, so use something quite arbitrary for now.
* Do storage is a hash table of size 256. Collisions are handled in a linked
* list.
*/
#undef MAXSOCKS
#define MAXSOCKS 500
#undef MAXSELECT
#define MAXSELECT 500
#define MAXFD 500
struct
_ct_node
{
struct
_ct_node
*
next
;
int
key
;
int
value
;
};
struct
_ct_node
*
ct_head
[
256
];
void
InitConnectionTranslation
(
void
)
{
bzero
(
ct_head
,
sizeof
(
ct_head
));
}
int
GetConnectionTranslation
(
int
conn
)
{
struct
_ct_node
*
node
=
ct_head
[
conn
&
0xff
];
while
(
node
!=
NULL
)
{
if
(
node
->
key
==
conn
)
return
node
->
value
;
node
=
node
->
next
;
}
return
0
;
}
void
SetConnectionTranslation
(
int
conn
,
int
client
)
{
struct
_ct_node
**
node
=
ct_head
+
(
conn
&
0xff
);
if
(
client
==
0
)
/* remove entry */
{
while
(
*
node
!=
NULL
)
{
if
((
*
node
)
->
key
==
conn
)
{
struct
_ct_node
*
temp
=
*
node
;
*
node
=
(
*
node
)
->
next
;
free
(
temp
);
return
;
}
node
=
&
((
*
node
)
->
next
);
}
return
;
}
else
{
while
(
*
node
!=
NULL
)
{
if
((
*
node
)
->
key
==
conn
)
{
(
*
node
)
->
value
=
client
;
return
;
}
node
=
&
((
*
node
)
->
next
);
}
*
node
=
(
struct
_ct_node
*
)
malloc
(
sizeof
(
struct
_ct_node
));
(
*
node
)
->
next
=
NULL
;
(
*
node
)
->
key
=
conn
;
(
*
node
)
->
value
=
client
;
return
;
}
}
void
ClearConnectionTranslation
(
void
)
{
unsigned
i
;
for
(
i
=
0
;
i
<
256
;
i
++
)
{
struct
_ct_node
*
node
=
ct_head
[
i
];
while
(
node
!=
NULL
)
{
struct
_ct_node
*
temp
=
node
;
node
=
node
->
next
;
free
(
temp
);
}
}
}
#endif
XtransConnInfo
*
ListenTransConns
=
NULL
;
XtransConnInfo
*
ListenTransConns
=
NULL
;
int
*
ListenTransFds
=
NULL
;
int
*
ListenTransFds
=
NULL
;
...
@@ -318,11 +222,7 @@ InitConnectionLimits(void)
...
@@ -318,11 +222,7 @@ InitConnectionLimits(void)
ErrorF
(
"InitConnectionLimits: MaxClients = %d
\n
"
,
MaxClients
);
ErrorF
(
"InitConnectionLimits: MaxClients = %d
\n
"
,
MaxClients
);
#endif
#endif
#if !defined(WIN32)
ConnectionTranslation
=
(
int
*
)
xnfalloc
(
sizeof
(
int
)
*
(
lastfdesc
+
1
));
ConnectionTranslation
=
(
int
*
)
xnfalloc
(
sizeof
(
int
)
*
(
lastfdesc
+
1
));
#else
InitConnectionTranslation
();
#endif
}
}
/*
/*
...
@@ -341,7 +241,6 @@ InitConnectionLimits(void)
...
@@ -341,7 +241,6 @@ InitConnectionLimits(void)
static
void
static
void
InitParentProcess
(
void
)
InitParentProcess
(
void
)
{
{
#if !defined(WIN32)
OsSigHandlerPtr
handler
;
OsSigHandlerPtr
handler
;
handler
=
OsSignal
(
SIGUSR1
,
SIG_IGN
);
handler
=
OsSignal
(
SIGUSR1
,
SIG_IGN
);
if
(
handler
==
SIG_IGN
)
if
(
handler
==
SIG_IGN
)
...
@@ -357,13 +256,11 @@ InitParentProcess(void)
...
@@ -357,13 +256,11 @@ InitParentProcess(void)
*/
*/
ParentProcess
=
GetPPID
(
ParentProcess
);
ParentProcess
=
GetPPID
(
ParentProcess
);
#endif
/* __UNIXOS2__ */
#endif
/* __UNIXOS2__ */
#endif
}
}
void
void
NotifyParentProcess
(
void
)
NotifyParentProcess
(
void
)
{
{
#if !defined(WIN32)
if
(
displayfd
>=
0
)
{
if
(
displayfd
>=
0
)
{
#ifdef NXAGENT_SERVER
#ifdef NXAGENT_SERVER
if
(
displayfd
==
STDERR_FILENO
)
if
(
displayfd
==
STDERR_FILENO
)
...
@@ -385,7 +282,6 @@ NotifyParentProcess(void)
...
@@ -385,7 +282,6 @@ NotifyParentProcess(void)
kill
(
ParentProcess
,
SIGUSR1
);
kill
(
ParentProcess
,
SIGUSR1
);
}
}
}
}
#endif
}
}
static
Bool
static
Bool
...
@@ -416,11 +312,7 @@ CreateWellKnownSockets(void)
...
@@ -416,11 +312,7 @@ CreateWellKnownSockets(void)
FD_ZERO
(
&
LastSelectMask
);
FD_ZERO
(
&
LastSelectMask
);
FD_ZERO
(
&
ClientsWithInput
);
FD_ZERO
(
&
ClientsWithInput
);
#if !defined(WIN32)
for
(
i
=
0
;
i
<
MaxClients
;
i
++
)
ConnectionTranslation
[
i
]
=
0
;
for
(
i
=
0
;
i
<
MaxClients
;
i
++
)
ConnectionTranslation
[
i
]
=
0
;
#else
ClearConnectionTranslation
();
#endif
/* display is initialized to "0" by main(). It is then set to the display
/* display is initialized to "0" by main(). It is then set to the display
* number if specified on the command line. */
* number if specified on the command line. */
...
@@ -473,10 +365,8 @@ CreateWellKnownSockets(void)
...
@@ -473,10 +365,8 @@ CreateWellKnownSockets(void)
if
(
ListenTransCount
==
0
&&
!
NoListenAll
)
if
(
ListenTransCount
==
0
&&
!
NoListenAll
)
FatalError
(
"Cannot establish any listening sockets - Make sure an X server isn't already running"
);
FatalError
(
"Cannot establish any listening sockets - Make sure an X server isn't already running"
);
#if !defined(WIN32)
OsSignal
(
SIGPIPE
,
SIG_IGN
);
OsSignal
(
SIGPIPE
,
SIG_IGN
);
OsSignal
(
SIGHUP
,
AutoResetServer
);
OsSignal
(
SIGHUP
,
AutoResetServer
);
#endif
OsSignal
(
SIGINT
,
GiveUp
);
OsSignal
(
SIGINT
,
GiveUp
);
OsSignal
(
SIGTERM
,
GiveUp
);
OsSignal
(
SIGTERM
,
GiveUp
);
ResetHosts
(
display
);
ResetHosts
(
display
);
...
@@ -802,11 +692,7 @@ AllocNewConnection (XtransConnInfo trans_conn, int fd, CARD32 conn_time)
...
@@ -802,11 +692,7 @@ AllocNewConnection (XtransConnInfo trans_conn, int fd, CARD32 conn_time)
ClientPtr
client
;
ClientPtr
client
;
if
(
if
(
#ifndef WIN32
fd
>=
lastfdesc
fd
>=
lastfdesc
#else
XFD_SETCOUNT
(
&
AllClients
)
>=
MaxClients
#endif
)
)
return
NullClient
;
return
NullClient
;
oc
=
(
OsCommPtr
)
malloc
(
sizeof
(
OsCommRec
));
oc
=
(
OsCommPtr
)
malloc
(
sizeof
(
OsCommRec
));
...
@@ -825,11 +711,7 @@ AllocNewConnection (XtransConnInfo trans_conn, int fd, CARD32 conn_time)
...
@@ -825,11 +711,7 @@ AllocNewConnection (XtransConnInfo trans_conn, int fd, CARD32 conn_time)
}
}
client
->
local
=
ComputeLocalClient
(
client
);
client
->
local
=
ComputeLocalClient
(
client
);
{
{
#if !defined(WIN32)
ConnectionTranslation
[
fd
]
=
client
->
index
;
ConnectionTranslation
[
fd
]
=
client
->
index
;
#else
SetConnectionTranslation
(
fd
,
client
->
index
);
#endif
if
(
GrabInProgress
)
if
(
GrabInProgress
)
{
{
FD_SET
(
fd
,
&
SavedAllClients
);
FD_SET
(
fd
,
&
SavedAllClients
);
...
@@ -893,11 +775,7 @@ EstablishNewConnections(ClientPtr clientUnused, void * closure)
...
@@ -893,11 +775,7 @@ EstablishNewConnections(ClientPtr clientUnused, void * closure)
if
(
newconn
<
lastfdesc
)
{
if
(
newconn
<
lastfdesc
)
{
int
clientid
;
int
clientid
;
#if !defined(WIN32)
clientid
=
ConnectionTranslation
[
newconn
];
clientid
=
ConnectionTranslation
[
newconn
];
#else
clientid
=
GetConnectionTranslation
(
newconn
);
#endif
if
(
clientid
&&
(
client
=
clients
[
clientid
]))
if
(
clientid
&&
(
client
=
clients
[
clientid
]))
CloseDownClient
(
client
);
CloseDownClient
(
client
);
}
}
...
@@ -990,11 +868,7 @@ CloseDownFileDescriptor(OsCommPtr oc)
...
@@ -990,11 +868,7 @@ CloseDownFileDescriptor(OsCommPtr oc)
}
}
FreeOsBuffers
(
oc
);
FreeOsBuffers
(
oc
);
free
(
oc
);
free
(
oc
);
#ifndef WIN32
ConnectionTranslation
[
connection
]
=
0
;
ConnectionTranslation
[
connection
]
=
0
;
#else
SetConnectionTranslation
(
connection
,
0
);
#endif
FD_CLR
(
connection
,
&
AllSockets
);
FD_CLR
(
connection
,
&
AllSockets
);
FD_CLR
(
connection
,
&
AllClients
);
FD_CLR
(
connection
,
&
AllClients
);
FD_CLR
(
connection
,
&
ClientsWithInput
);
FD_CLR
(
connection
,
&
ClientsWithInput
);
...
@@ -1023,22 +897,16 @@ CloseDownFileDescriptor(OsCommPtr oc)
...
@@ -1023,22 +897,16 @@ CloseDownFileDescriptor(OsCommPtr oc)
void
void
CheckConnections
(
void
)
CheckConnections
(
void
)
{
{
#ifndef WIN32
fd_mask
mask
;
fd_mask
mask
;
#endif
fd_set
tmask
;
fd_set
tmask
;
int
curclient
,
curoff
;
int
curclient
,
curoff
;
int
i
;
int
i
;
struct
timeval
notime
;
struct
timeval
notime
;
int
r
;
int
r
;
#ifdef WIN32
fd_set
savedAllClients
;
#endif
notime
.
tv_sec
=
0
;
notime
.
tv_sec
=
0
;
notime
.
tv_usec
=
0
;
notime
.
tv_usec
=
0
;
#ifndef WIN32
for
(
i
=
0
;
i
<
howmany
(
XFD_SETSIZE
,
NFDBITS
);
i
++
)
for
(
i
=
0
;
i
<
howmany
(
XFD_SETSIZE
,
NFDBITS
);
i
++
)
{
{
mask
=
AllClients
.
fds_bits
[
i
];
mask
=
AllClients
.
fds_bits
[
i
];
...
@@ -1054,18 +922,6 @@ CheckConnections(void)
...
@@ -1054,18 +922,6 @@ CheckConnections(void)
mask
&=
~
((
fd_mask
)
1
<<
curoff
);
mask
&=
~
((
fd_mask
)
1
<<
curoff
);
}
}
}
}
#else
XFD_COPYSET
(
&
AllClients
,
&
savedAllClients
);
for
(
i
=
0
;
i
<
XFD_SETCOUNT
(
&
savedAllClients
);
i
++
)
{
curclient
=
XFD_FD
(
&
savedAllClients
,
i
);
FD_ZERO
(
&
tmask
);
FD_SET
(
curclient
,
&
tmask
);
r
=
Select
(
curclient
+
1
,
&
tmask
,
NULL
,
NULL
,
&
notime
);
if
(
r
<
0
)
CloseDownClient
(
clients
[
GetConnectionTranslation
(
curclient
)]);
}
#endif
}
}
...
...
nx-X11/programs/Xserver/os/io.c
View file @
d409b566
...
@@ -60,9 +60,6 @@ SOFTWARE.
...
@@ -60,9 +60,6 @@ SOFTWARE.
#if 0
#if 0
#define DEBUG_COMMUNICATION
#define DEBUG_COMMUNICATION
#endif
#endif
#ifdef WIN32
#include <nx-X11/Xwinsock.h>
#endif
#include <stdio.h>
#include <stdio.h>
#define XSERV_t
#define XSERV_t
#define TRANS_SERVER
#define TRANS_SERVER
...
@@ -70,9 +67,7 @@ SOFTWARE.
...
@@ -70,9 +67,7 @@ SOFTWARE.
#include <nx-X11/Xtrans/Xtrans.h>
#include <nx-X11/Xtrans/Xtrans.h>
#include <nx-X11/Xmd.h>
#include <nx-X11/Xmd.h>
#include <errno.h>
#include <errno.h>
#if !defined(WIN32)
#include <sys/uio.h>
#include <sys/uio.h>
#endif
#include <nx-X11/X.h>
#include <nx-X11/X.h>
#include <nx-X11/Xproto.h>
#include <nx-X11/Xproto.h>
#include "os.h"
#include "os.h"
...
@@ -88,7 +83,6 @@ CallbackListPtr FlushCallback;
...
@@ -88,7 +83,6 @@ CallbackListPtr FlushCallback;
/* check for both EAGAIN and EWOULDBLOCK, because some supposedly POSIX
/* check for both EAGAIN and EWOULDBLOCK, because some supposedly POSIX
* systems are broken and return EWOULDBLOCK when they should return EAGAIN
* systems are broken and return EWOULDBLOCK when they should return EAGAIN
*/
*/
#ifndef WIN32
#if defined(EAGAIN) && defined(EWOULDBLOCK)
#if defined(EAGAIN) && defined(EWOULDBLOCK)
#define ETEST(err) (err == EAGAIN || err == EWOULDBLOCK)
#define ETEST(err) (err == EAGAIN || err == EWOULDBLOCK)
#else
#else
...
@@ -98,9 +92,6 @@ CallbackListPtr FlushCallback;
...
@@ -98,9 +92,6 @@ CallbackListPtr FlushCallback;
#define ETEST(err) (err == EWOULDBLOCK)
#define ETEST(err) (err == EWOULDBLOCK)
#endif
#endif
#endif
#endif
#else
/* WIN32 The socket errorcodes differ from the normal errors*/
#define ETEST(err) (err == EAGAIN || err == WSAEWOULDBLOCK)
#endif
Bool
CriticalOutputPending
;
Bool
CriticalOutputPending
;
int
timesThisConnection
=
0
;
int
timesThisConnection
=
0
;
...
@@ -777,9 +768,6 @@ FlushAllOutput(void)
...
@@ -777,9 +768,6 @@ FlushAllOutput(void)
OsCommPtr
oc
;
OsCommPtr
oc
;
register
ClientPtr
client
;
register
ClientPtr
client
;
Bool
newoutput
=
NewOutputPending
;
Bool
newoutput
=
NewOutputPending
;
#if defined(WIN32)
fd_set
newOutputPending
;
#endif
if
(
!
newoutput
)
if
(
!
newoutput
)
return
;
return
;
...
@@ -792,7 +780,6 @@ FlushAllOutput(void)
...
@@ -792,7 +780,6 @@ FlushAllOutput(void)
CriticalOutputPending
=
FALSE
;
CriticalOutputPending
=
FALSE
;
NewOutputPending
=
FALSE
;
NewOutputPending
=
FALSE
;
#ifndef WIN32
for
(
base
=
0
;
base
<
howmany
(
XFD_SETSIZE
,
NFDBITS
);
base
++
)
for
(
base
=
0
;
base
<
howmany
(
XFD_SETSIZE
,
NFDBITS
);
base
++
)
{
{
mask
=
OutputPending
.
fds_bits
[
base
];
mask
=
OutputPending
.
fds_bits
[
base
];
...
@@ -817,28 +804,6 @@ FlushAllOutput(void)
...
@@ -817,28 +804,6 @@ FlushAllOutput(void)
(
void
)
FlushClient
(
client
,
oc
,
(
char
*
)
NULL
,
0
);
(
void
)
FlushClient
(
client
,
oc
,
(
char
*
)
NULL
,
0
);
}
}
}
}
#else
/* WIN32 */
FD_ZERO
(
&
newOutputPending
);
for
(
base
=
0
;
base
<
XFD_SETCOUNT
(
&
OutputPending
);
base
++
)
{
index
=
XFD_FD
(
&
OutputPending
,
base
);
if
((
index
=
GetConnectionTranslation
(
index
))
==
0
)
continue
;
client
=
clients
[
index
];
if
(
client
->
clientGone
)
continue
;
oc
=
(
OsCommPtr
)
client
->
osPrivate
;
if
(
FD_ISSET
(
oc
->
fd
,
&
ClientsWithInput
))
{
FD_SET
(
oc
->
fd
,
&
newOutputPending
);
/* set the bit again */
NewOutputPending
=
TRUE
;
}
else
(
void
)
FlushClient
(
client
,
oc
,
(
char
*
)
NULL
,
0
);
}
XFD_COPYSET
(
&
newOutputPending
,
&
OutputPending
);
#endif
/* WIN32 */
}
}
void
void
...
...
nx-X11/programs/Xserver/os/log.c
View file @
d409b566
...
@@ -117,10 +117,6 @@ OR PERFORMANCE OF THIS SOFTWARE.
...
@@ -117,10 +117,6 @@ OR PERFORMANCE OF THIS SOFTWARE.
#include "site.h"
#include "site.h"
#include "opaque.h"
#include "opaque.h"
#ifdef WIN32
#include <process.h>
#define getpid(x) _getpid(x)
#endif
#ifdef NX_TRANS_SOCKET
#ifdef NX_TRANS_SOCKET
...
@@ -268,9 +264,7 @@ LogInit(const char *fname, const char *backup)
...
@@ -268,9 +264,7 @@ LogInit(const char *fname, const char *backup)
if
(
saveBuffer
&&
bufferSize
>
0
)
{
if
(
saveBuffer
&&
bufferSize
>
0
)
{
fwrite
(
saveBuffer
,
bufferPos
,
1
,
logFile
);
fwrite
(
saveBuffer
,
bufferPos
,
1
,
logFile
);
fflush
(
logFile
);
fflush
(
logFile
);
#ifndef WIN32
fsync
(
fileno
(
logFile
));
fsync
(
fileno
(
logFile
));
#endif
}
}
}
}
...
@@ -398,10 +392,8 @@ LogVWrite(int verb, const char *f, va_list args)
...
@@ -398,10 +392,8 @@ LogVWrite(int verb, const char *f, va_list args)
fwrite
(
tmpBuffer
,
len
,
1
,
logFile
);
fwrite
(
tmpBuffer
,
len
,
1
,
logFile
);
if
(
logFlush
)
{
if
(
logFlush
)
{
fflush
(
logFile
);
fflush
(
logFile
);
#ifndef WIN32
if
(
logSync
)
if
(
logSync
)
fsync
(
fileno
(
logFile
));
fsync
(
fileno
(
logFile
));
#endif
}
}
}
else
if
(
needBuffer
)
{
}
else
if
(
needBuffer
)
{
/*
/*
...
...
nx-X11/programs/Xserver/os/osdep.h
View file @
d409b566
...
@@ -69,11 +69,6 @@ SOFTWARE.
...
@@ -69,11 +69,6 @@ SOFTWARE.
#undef _POSIX_SOURCE
#undef _POSIX_SOURCE
#endif
#endif
#else
/* X_NOT_POSIX */
#else
/* X_NOT_POSIX */
#ifdef WIN32
#define _POSIX_
#include <limits.h>
#undef _POSIX_
#endif
#endif
/* X_NOT_POSIX */
#endif
/* X_NOT_POSIX */
#ifndef OPEN_MAX
#ifndef OPEN_MAX
...
@@ -85,11 +80,7 @@ SOFTWARE.
...
@@ -85,11 +80,7 @@ SOFTWARE.
#if defined(NOFILE) && !defined(NOFILES_MAX)
#if defined(NOFILE) && !defined(NOFILES_MAX)
#define OPEN_MAX NOFILE
#define OPEN_MAX NOFILE
#else
#else
#if !defined(WIN32)
#define OPEN_MAX NOFILES_MAX
#define OPEN_MAX NOFILES_MAX
#else
#define OPEN_MAX 256
#endif
#endif
#endif
#endif
#endif
#endif
#endif
...
@@ -213,13 +204,7 @@ extern fd_set ClientsWriteBlocked;
...
@@ -213,13 +204,7 @@ extern fd_set ClientsWriteBlocked;
extern
fd_set
OutputPending
;
extern
fd_set
OutputPending
;
extern
fd_set
IgnoredClientsWithInput
;
extern
fd_set
IgnoredClientsWithInput
;
#ifndef WIN32
extern
int
*
ConnectionTranslation
;
extern
int
*
ConnectionTranslation
;
#else
extern
int
GetConnectionTranslation
(
int
conn
);
extern
void
SetConnectionTranslation
(
int
conn
,
int
client
);
extern
void
ClearConnectionTranslation
();
#endif
extern
Bool
NewOutputPending
;
extern
Bool
NewOutputPending
;
extern
Bool
AnyWritesPending
;
extern
Bool
AnyWritesPending
;
...
@@ -234,9 +219,6 @@ extern OsCommPtr AvailableInput;
...
@@ -234,9 +219,6 @@ extern OsCommPtr AvailableInput;
extern
WorkQueuePtr
workQueue
;
extern
WorkQueuePtr
workQueue
;
/* added by raphael */
/* added by raphael */
#ifdef WIN32
typedef
long
int
fd_mask
;
#endif
#define ffs mffs
#define ffs mffs
extern
int
mffs
(
fd_mask
);
extern
int
mffs
(
fd_mask
);
...
...
nx-X11/programs/Xserver/os/osinit.c
View file @
d409b566
...
@@ -66,7 +66,7 @@ SOFTWARE.
...
@@ -66,7 +66,7 @@ SOFTWARE.
#endif
#endif
#if !defined(SYSV)
&& !defined(WIN32)
#if !defined(SYSV)
#include <sys/resource.h>
#include <sys/resource.h>
#endif
#endif
...
@@ -131,7 +131,7 @@ OsInit(void)
...
@@ -131,7 +131,7 @@ OsInit(void)
dup2
(
fileno
(
err
),
2
);
dup2
(
fileno
(
err
),
2
);
fclose
(
err
);
fclose
(
err
);
}
}
#if defined(SYSV) || defined(SVR4) || defined(
WIN32) || defined(
__CYGWIN__)
#if defined(SYSV) || defined(SVR4) || defined(__CYGWIN__)
{
{
static
char
buf
[
BUFSIZ
];
static
char
buf
[
BUFSIZ
];
setvbuf
(
stderr
,
buf
,
_IOLBF
,
BUFSIZ
);
setvbuf
(
stderr
,
buf
,
_IOLBF
,
BUFSIZ
);
...
@@ -145,7 +145,7 @@ OsInit(void)
...
@@ -145,7 +145,7 @@ OsInit(void)
if
(
getpgrp
()
==
0
)
if
(
getpgrp
()
==
0
)
setpgid
(
0
,
0
);
setpgid
(
0
,
0
);
#else
#else
#if !defined(SYSV)
&& !defined(WIN32)
#if !defined(SYSV)
if
(
getpgrp
(
0
)
==
0
)
if
(
getpgrp
(
0
)
==
0
)
setpgrp
(
0
,
getpid
());
setpgrp
(
0
,
getpid
());
#endif
#endif
...
...
nx-X11/programs/Xserver/os/utils.c
View file @
d409b566
...
@@ -83,9 +83,6 @@ OR PERFORMANCE OF THIS SOFTWARE.
...
@@ -83,9 +83,6 @@ OR PERFORMANCE OF THIS SOFTWARE.
#include <signal.h>
#include <signal.h>
#endif
#endif
#if defined(WIN32) && !defined(__CYGWIN__)
#include <nx-X11/Xwinsock.h>
#endif
#include <nx-X11/Xos.h>
#include <nx-X11/Xos.h>
#include <stdio.h>
#include <stdio.h>
#include "misc.h"
#include "misc.h"
...
@@ -115,10 +112,8 @@ OR PERFORMANCE OF THIS SOFTWARE.
...
@@ -115,10 +112,8 @@ OR PERFORMANCE OF THIS SOFTWARE.
#undef _POSIX_SOURCE
#undef _POSIX_SOURCE
#endif
#endif
#endif
#endif
#ifndef WIN32
#include <sys/wait.h>
#include <sys/wait.h>
#endif
#if !defined(SYSV)
#if !defined(SYSV) && !defined(WIN32)
#include <sys/resource.h>
#include <sys/resource.h>
#endif
#endif
#include <time.h>
#include <time.h>
...
@@ -132,9 +127,7 @@ OR PERFORMANCE OF THIS SOFTWARE.
...
@@ -132,9 +127,7 @@ OR PERFORMANCE OF THIS SOFTWARE.
#include <stdlib.h>
/* for malloc() */
#include <stdlib.h>
/* for malloc() */
#if defined(TCPCONN)
#if defined(TCPCONN)
# ifndef WIN32
# include <netdb.h>
# include <netdb.h>
# endif
#endif
#endif
#include "opaque.h"
#include "opaque.h"
...
@@ -910,7 +903,7 @@ ProcessCommandLine(int argc, char *argv[])
...
@@ -910,7 +903,7 @@ ProcessCommandLine(int argc, char *argv[])
#ifdef SERVER_LOCK
#ifdef SERVER_LOCK
else
if
(
strcmp
(
argv
[
i
],
"-nolock"
)
==
0
)
else
if
(
strcmp
(
argv
[
i
],
"-nolock"
)
==
0
)
{
{
#if
!defined(WIN32) &&
!defined(__CYGWIN__)
#if !defined(__CYGWIN__)
if
(
getuid
()
!=
0
)
if
(
getuid
()
!=
0
)
ErrorF
(
"Warning: the -nolock option can only be used by root
\n
"
);
ErrorF
(
"Warning: the -nolock option can only be used by root
\n
"
);
else
else
...
@@ -1230,7 +1223,7 @@ ExpandCommandLine(int *pargc, char ***pargv)
...
@@ -1230,7 +1223,7 @@ ExpandCommandLine(int *pargc, char ***pargv)
{
{
int
i
;
int
i
;
#if
!defined(WIN32) &&
!defined(__CYGWIN__)
#if !defined(__CYGWIN__)
if
(
getuid
()
!=
geteuid
())
if
(
getuid
()
!=
geteuid
())
return
;
return
;
#endif
#endif
...
@@ -1566,7 +1559,6 @@ OsReleaseSignals (void)
...
@@ -1566,7 +1559,6 @@ OsReleaseSignals (void)
#endif
#endif
}
}
#if !defined(WIN32)
/*
/*
* "safer" versions of system(3), popen(3) and pclose(3) which give up
* "safer" versions of system(3), popen(3) and pclose(3) which give up
* all privs before running a command.
* all privs before running a command.
...
@@ -1948,7 +1940,6 @@ Fclose(void * iop)
...
@@ -1948,7 +1940,6 @@ Fclose(void * iop)
#endif
#endif
}
}
#endif
/* !WIN32 */
/*
/*
...
@@ -1981,11 +1972,7 @@ Fclose(void * iop)
...
@@ -1981,11 +1972,7 @@ Fclose(void * iop)
/* Check args and env only if running setuid (euid == 0 && euid != uid) ? */
/* Check args and env only if running setuid (euid == 0 && euid != uid) ? */
#ifndef CHECK_EUID
#ifndef CHECK_EUID
#ifndef WIN32
#define CHECK_EUID 1
#define CHECK_EUID 1
#else
#define CHECK_EUID 0
#endif
#endif
#endif
/*
/*
...
...
nx-X11/programs/Xserver/os/xdmcp.c
View file @
d409b566
...
@@ -17,22 +17,13 @@
...
@@ -17,22 +17,13 @@
#include <dix-config.h>
#include <dix-config.h>
#endif
#endif
#ifdef WIN32
#include <nx-X11/Xwinsock.h>
#define XSERV_t
#define TRANS_SERVER
#define TRANS_REOPEN
#include <nx-X11/Xtrans/Xtrans.h>
#endif
#include <nx-X11/Xos.h>
#include <nx-X11/Xos.h>
#if !defined(WIN32)
#include <sys/param.h>
#include <sys/param.h>
#include <sys/socket.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/in.h>
#include <netdb.h>
#include <netdb.h>
#endif
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
...
@@ -1507,9 +1498,6 @@ get_addr_by_name(
...
@@ -1507,9 +1498,6 @@ get_addr_by_name(
#ifdef XTHREADS_NEEDS_BYNAMEPARAMS
#ifdef XTHREADS_NEEDS_BYNAMEPARAMS
_Xgethostbynameparams
hparams
;
_Xgethostbynameparams
hparams
;
#endif
#endif
#if defined(WIN32) && defined(TCPCONN)
_XSERVTransWSAStartup
();
#endif
if
(
!
(
hep
=
_XGethostbyname
(
namestr
,
hparams
)))
if
(
!
(
hep
=
_XGethostbyname
(
namestr
,
hparams
)))
{
{
FatalError
(
"Xserver: %s unknown host: %s
\n
"
,
argtype
,
namestr
);
FatalError
(
"Xserver: %s unknown host: %s
\n
"
,
argtype
,
namestr
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment