mirror of
https://github.com/X11Libre/xserver.git
synced 2026-04-14 17:18:09 +00:00
os: cross platform ioctl() wrapper
Reducing the ifdef-zoo a bit by moving the platform specific socket ioctl calls into separate function. On win32, this also checks the retval and potentially query for error. On Unix, just calling ioctl(). Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
committed by
Enrico Weigelt
parent
fe795fa7b8
commit
ec20354aec
11
os/Xtrans.c
11
os/Xtrans.c
@@ -117,13 +117,6 @@ Xtransport_table Xtransports[] = {
|
||||
|
||||
#define NUMTRANS (sizeof(Xtransports)/sizeof(Xtransport_table))
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
#define ioctl ioctlsocket
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* These are a few utility function used by the public interface functions.
|
||||
*/
|
||||
@@ -564,7 +557,7 @@ int _XSERVTransNonBlock(XtransConnInfo ciptr)
|
||||
{
|
||||
int arg;
|
||||
arg = 1;
|
||||
ret = ioctl (fd, FIOSNBIO, &arg);
|
||||
ret = ossock_ioctl (fd, FIOSNBIO, &arg);
|
||||
}
|
||||
#else
|
||||
#if defined(WIN32)
|
||||
@@ -572,7 +565,7 @@ int _XSERVTransNonBlock(XtransConnInfo ciptr)
|
||||
u_long arg_ret = 1;
|
||||
/* IBM TCP/IP understands this option too well: it causes _XSERVTransRead to fail
|
||||
* eventually with EWOULDBLOCK */
|
||||
ret = ioctl (fd, FIONBIO, &arg_ret);
|
||||
ret = ossock_ioctl (fd, FIONBIO, &arg_ret);
|
||||
}
|
||||
#else
|
||||
ret = fcntl (fd, F_GETFL, 0);
|
||||
|
||||
Reference in New Issue
Block a user