diff options
author | Eamon Walsh <ewalsh@tycho.nsa.gov> | 2007-08-02 14:27:03 -0400 |
---|---|---|
committer | Eamon Walsh <ewalsh@moss-charon.epoch.ncsc.mil> | 2007-08-02 14:27:03 -0400 |
commit | e34fcd2bf42dbd72ab6ce2df80f2dcaa13416e74 (patch) | |
tree | c9639b11acb0ff6c90d774574b0392d81320e84e /hw/xnest | |
parent | 32c0dcc8c0d1edba5d7e418fd2dc916847a4f069 (diff) | |
parent | f3955c0a020b39021050cd33c20a17f14fc4b579 (diff) |
Merge branch 'master' into XACE-SELINUX
Conflicts:
dix/devices.c
dix/property.c
include/dix.h
Diffstat (limited to 'hw/xnest')
-rw-r--r-- | hw/xnest/Args.c | 1 | ||||
-rw-r--r-- | hw/xnest/Args.h | 1 | ||||
-rw-r--r-- | hw/xnest/Color.c | 1 | ||||
-rw-r--r-- | hw/xnest/Color.h | 1 | ||||
-rw-r--r-- | hw/xnest/Drawable.h | 1 | ||||
-rw-r--r-- | hw/xnest/Events.h | 1 | ||||
-rw-r--r-- | hw/xnest/GCOps.h | 1 | ||||
-rw-r--r-- | hw/xnest/Handlers.h | 1 | ||||
-rw-r--r-- | hw/xnest/Keyboard.h | 1 | ||||
-rw-r--r-- | hw/xnest/Makefile.am | 3 | ||||
-rw-r--r-- | hw/xnest/Pointer.c | 1 | ||||
-rw-r--r-- | hw/xnest/Pointer.h | 1 | ||||
-rw-r--r-- | hw/xnest/Screen.h | 1 | ||||
-rw-r--r-- | hw/xnest/Visual.c | 1 | ||||
-rw-r--r-- | hw/xnest/Visual.h | 1 | ||||
-rw-r--r-- | hw/xnest/XNFont.h | 2 | ||||
-rw-r--r-- | hw/xnest/XNGC.h | 1 | ||||
-rw-r--r-- | hw/xnest/Xnest.h | 1 | ||||
-rw-r--r-- | hw/xnest/os2Stub.c | 387 |
19 files changed, 1 insertions, 407 deletions
diff --git a/hw/xnest/Args.c b/hw/xnest/Args.c index c2e8b0db7..f061f9e80 100644 --- a/hw/xnest/Args.c +++ b/hw/xnest/Args.c @@ -11,7 +11,6 @@ the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. */ -/* $XFree86$ */ #ifdef HAVE_XNEST_CONFIG_H #include <xnest-config.h> diff --git a/hw/xnest/Args.h b/hw/xnest/Args.h index 38090fd0e..c3002bfca 100644 --- a/hw/xnest/Args.h +++ b/hw/xnest/Args.h @@ -11,7 +11,6 @@ the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. */ -/* $XFree86$ */ #ifndef XNESTARGC_H #define XNESTARGS_H diff --git a/hw/xnest/Color.c b/hw/xnest/Color.c index 2dd60971f..5ba0bdbad 100644 --- a/hw/xnest/Color.c +++ b/hw/xnest/Color.c @@ -11,7 +11,6 @@ the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. */ -/* $XFree86$ */ #ifdef HAVE_XNEST_CONFIG_H #include <xnest-config.h> diff --git a/hw/xnest/Color.h b/hw/xnest/Color.h index aec0a248c..f00bde47f 100644 --- a/hw/xnest/Color.h +++ b/hw/xnest/Color.h @@ -11,7 +11,6 @@ the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. */ -/* $XFree86$ */ #ifndef XNESTCOLOR_H #define XNESTCOLOR_H diff --git a/hw/xnest/Drawable.h b/hw/xnest/Drawable.h index 61159c9ba..d94916ecd 100644 --- a/hw/xnest/Drawable.h +++ b/hw/xnest/Drawable.h @@ -11,7 +11,6 @@ the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. */ -/* $XFree86$ */ #ifndef XNESTDRAWABLE_H #define XNESTDRAWABLE_H diff --git a/hw/xnest/Events.h b/hw/xnest/Events.h index cdad9f398..2441accd5 100644 --- a/hw/xnest/Events.h +++ b/hw/xnest/Events.h @@ -11,7 +11,6 @@ the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. */ -/* $XFree86$ */ #ifndef XNESTEVENTS_H #define XNESTEVENTS_H diff --git a/hw/xnest/GCOps.h b/hw/xnest/GCOps.h index fce9d6cb3..ca4cf33f7 100644 --- a/hw/xnest/GCOps.h +++ b/hw/xnest/GCOps.h @@ -11,7 +11,6 @@ the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. */ -/* $XFree86$ */ #ifndef XNESTGCOPS_H #define XNESTGCOPS_H diff --git a/hw/xnest/Handlers.h b/hw/xnest/Handlers.h index fe064213e..16228a0c1 100644 --- a/hw/xnest/Handlers.h +++ b/hw/xnest/Handlers.h @@ -11,7 +11,6 @@ the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. */ -/* $XFree86$ */ #ifndef XNESTHANDLERS_H #define XNESTHANDLERS_H diff --git a/hw/xnest/Keyboard.h b/hw/xnest/Keyboard.h index d87866c73..546a1cbe4 100644 --- a/hw/xnest/Keyboard.h +++ b/hw/xnest/Keyboard.h @@ -11,7 +11,6 @@ the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. */ -/* $XFree86$ */ #ifndef XNESTKEYBOARD_H #define XNESTKEYBOARD_H diff --git a/hw/xnest/Makefile.am b/hw/xnest/Makefile.am index e958c0eee..99dba60bd 100644 --- a/hw/xnest/Makefile.am +++ b/hw/xnest/Makefile.am @@ -55,8 +55,7 @@ Xnest_LDADD = $(XORG_CORE_LIBS) \ $(XNESTMODULES_LIBS) \ libfbcmap.a -EXTRA_DIST = os2Stub.c \ - icon \ +EXTRA_DIST = icon \ screensaver \ Xnest.man.pre diff --git a/hw/xnest/Pointer.c b/hw/xnest/Pointer.c index 912b6fa21..b0de13b5f 100644 --- a/hw/xnest/Pointer.c +++ b/hw/xnest/Pointer.c @@ -11,7 +11,6 @@ the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. */ -/* $XFree86$ */ #ifdef HAVE_XNEST_CONFIG_H #include <xnest-config.h> diff --git a/hw/xnest/Pointer.h b/hw/xnest/Pointer.h index 2012db4c3..890726f55 100644 --- a/hw/xnest/Pointer.h +++ b/hw/xnest/Pointer.h @@ -11,7 +11,6 @@ the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. */ -/* $XFree86$ */ #ifndef XNESTPOINTER_H #define XNESTPOINTER_H diff --git a/hw/xnest/Screen.h b/hw/xnest/Screen.h index db298e300..b113c6460 100644 --- a/hw/xnest/Screen.h +++ b/hw/xnest/Screen.h @@ -11,7 +11,6 @@ the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. */ -/* $XFree86$ */ #ifndef XNESTSCREEN_H #define XNESTSCREEN_H diff --git a/hw/xnest/Visual.c b/hw/xnest/Visual.c index 628e22a7d..da1d63c10 100644 --- a/hw/xnest/Visual.c +++ b/hw/xnest/Visual.c @@ -11,7 +11,6 @@ the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. */ -/* $XFree86$ */ #ifdef HAVE_XNEST_CONFIG_H #include <xnest-config.h> diff --git a/hw/xnest/Visual.h b/hw/xnest/Visual.h index c2d715a65..1bd203709 100644 --- a/hw/xnest/Visual.h +++ b/hw/xnest/Visual.h @@ -11,7 +11,6 @@ the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. */ -/* $XFree86$ */ #ifndef XNESTVISUAL_H #define XNESTVISUAL_H diff --git a/hw/xnest/XNFont.h b/hw/xnest/XNFont.h index f7b9e38c0..92c112f36 100644 --- a/hw/xnest/XNFont.h +++ b/hw/xnest/XNFont.h @@ -11,8 +11,6 @@ the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. */ -/* $XFree86$ */ - #ifndef XNESTFONT_H #define XNESTFONT_H diff --git a/hw/xnest/XNGC.h b/hw/xnest/XNGC.h index a59508739..d3ac3df0b 100644 --- a/hw/xnest/XNGC.h +++ b/hw/xnest/XNGC.h @@ -11,7 +11,6 @@ the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. */ -/* $XFree86$ */ #ifndef XNESTGC_H #define XNESTGC_H diff --git a/hw/xnest/Xnest.h b/hw/xnest/Xnest.h index 8ed3f8902..827030c8f 100644 --- a/hw/xnest/Xnest.h +++ b/hw/xnest/Xnest.h @@ -27,7 +27,6 @@ other dealings in this Software without prior written authorization from the X Consortium. */ -/* $XFree86$ */ /* ** Machines with a 64 bit library interface and a 32 bit server require diff --git a/hw/xnest/os2Stub.c b/hw/xnest/os2Stub.c deleted file mode 100644 index 33675ec75..000000000 --- a/hw/xnest/os2Stub.c +++ /dev/null @@ -1,387 +0,0 @@ -/* - * (c) Copyright 1996 by Sebastien Marineau - * <marineau@genie.uottawa.ca> - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * HOLGER VEIT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of Sebastien Marineau shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from Sebastien Marineau. - * - */ - - -/* This below implements select() for calls in xnest. It has been */ -/* somewhat optimized for improved performance, but assumes a few */ -/* things so it cannot be used as a general select. */ - -#define I_NEED_OS2_H -#include <X11/Xpoll.h> -#include <stdio.h> -#include <sys/select.h> -#include <sys/errno.h> -#include <sys/time.h> -#define INCL_DOSSEMAPHORES -#define INCL_DOSNPIPES -#define INCL_DOSMISC -#define INCL_DOSMODULEMGR -#undef BOOL -#undef BYTE -#include <os2.h> - -HEV hPipeSem; -HMODULE hmod_so32dll; -static int (*os2_tcp_select)(int*,int,int,int,long); -ULONG os2_get_sys_millis(); -extern int _files[]; - -#define MAX_TCP 256 -/* These lifted from sys/emx.h. Change if that changes there! */ -#define F_SOCKET 0x10000000 -#define F_PIPE 0x20000000 - -struct select_data -{ - fd_set read_copy; - fd_set write_copy; - BOOL have_read; - BOOL have_write; - int tcp_select_mask[MAX_TCP]; - int tcp_emx_handles[MAX_TCP]; - int tcp_select_copy[MAX_TCP]; - int socket_nread; - int socket_nwrite; - int socket_ntotal; - int pipe_ntotal; - int pipe_have_write; - int max_fds; -}; - -int os2PseudoSelect(int nfds, fd_set *readfds, fd_set *writefds, - fd_set *exceptfds, struct timeval *timeout) -{ -static BOOL FirstTime=TRUE; -static haveTCPIP=TRUE; -ULONG timeout_ms; -ULONG postCount, start_millis,now_millis; -char faildata[16]; -struct select_data sd; -BOOL any_ready; -int np,ns, i,ready_handles,n; -APIRET rc; - -sd.have_read=FALSE; sd.have_write=FALSE; -sd.socket_nread=0; sd.socket_nwrite=0; sd.socket_ntotal=0; -sd.max_fds=31; ready_handles=0; any_ready=FALSE; -sd.pipe_ntotal=0; sd.pipe_have_write=FALSE; - -if(FirstTime){ - /* First load the so32dll.dll module and get a pointer to the SELECT function */ - - if((rc=DosLoadModule(faildata,sizeof(faildata),"SO32DLL",&hmod_so32dll))!=0){ - fprintf(stderr, "Could not load module so32dll.dll, rc = %d. Error note %s\n",rc,faildata); - haveTCPIP=FALSE; - } - if((rc = DosQueryProcAddr(hmod_so32dll, 0, "SELECT", (PPFN)&os2_tcp_select))!=0){ - fprintf(stderr, "Could not query address of SELECT, rc = %d.\n",rc); - haveTCPIP=FALSE; - } - /* Call these a first time to set the semaphore */ - /* rc = DosCreateEventSem(NULL, &hPipeSem, DC_SEM_SHARED, FALSE); - if(rc) { - fprintf(stderr, "Could not create event semaphore, rc=%d\n",rc); - return(-1); - } - rc = DosResetEventSem(hPipeSem, &postCount); */ /* Done in xtrans code for servers*/ - - /*fprintf(stderr, "Client select() done first-time stuff, sem handle %d.\n",hPipeSem);*/ - - FirstTime = FALSE; -} - -/* Set up the time delay structs */ - - if(timeout!=NULL) { - timeout_ms=timeout->tv_sec*1000+timeout->tv_usec/1000; - } - else { timeout_ms=1000000; } /* This should be large enough... */ - if(timeout_ms>0) start_millis=os2_get_sys_millis(); - -/* Copy the masks */ - {FD_ZERO(&sd.read_copy);} - {FD_ZERO(&sd.write_copy);} - if(readfds!=NULL){ XFD_COPYSET(readfds,&sd.read_copy); sd.have_read=TRUE;} - if(writefds!=NULL) {XFD_COPYSET(writefds,&sd.write_copy);sd.have_write=TRUE;} - -/* And zero the original masks */ - if(sd.have_read){ FD_ZERO(readfds);} - if(sd.have_write) {FD_ZERO(writefds);} - if(exceptfds != NULL) {FD_ZERO(exceptfds);} - -/* Now we parse the fd_sets passed to select and separate pipe/sockets */ - n = os2_parse_select(&sd,nfds); - if(n == -1) { - errno = EBADF; - return (-1); - } - -/* Now we have three cases: either we have sockets, pipes, or both */ -/* We handle all three cases differently to optimize things */ - -/* Case 1: only pipes! */ - if((sd.pipe_ntotal >0) && (!sd.socket_ntotal)){ - np = os2_check_pipes(&sd,readfds,writefds); - if(np > 0){ - return (np); - } - else if (np == -1) { return(-1); } - while(!any_ready){ - rc = DosWaitEventSem(hPipeSem, 1L); - /* if(rc) fprintf(stderr,"Sem-wait timeout, rc = %d\n",rc); */ - if(rc == 640) { - return(0); - } - if((rc != 0) && (rc != 95)) {errno= EBADF; return(-1);} - np = os2_check_pipes(&sd,readfds,writefds); - if (np > 0){ - return(np); - } - else if (np < 0){ return(-1); } - } - } - -/* Case 2: only sockets. Just let the os/2 tcp select do the work */ - if((sd.socket_ntotal > 0) && (!sd.pipe_ntotal)){ - ns = os2_check_sockets(&sd, readfds, writefds, timeout_ms); - return (ns); - } - -/* Case 3: combination of both */ - if((sd.socket_ntotal > 0) && (sd.pipe_ntotal)){ - np = os2_check_pipes(&sd,readfds,writefds); - if(np > 0){ - any_ready=TRUE; - ready_handles += np; - } - else if (np == -1) { return(-1); } - - ns = os2_check_sockets(&sd,readfds,writefds, 0); - if(ns>0){ - ready_handles+=ns; - any_ready = TRUE; - } - else if (ns == -1) {return(-1);} - - while (!any_ready && timeout_ms){ - - rc = DosWaitEventSem(hPipeSem, 1L); - if (rc==640) return(0); - if(rc == 0){ - np = os2_check_pipes(&sd,readfds,writefds); - if(np > 0){ - ready_handles+=np; - any_ready = TRUE; - } - else if (np == -1) { - return(-1); } - } - - ns = os2_check_sockets(&sd,readfds,writefds,exceptfds, 0); - if(ns>0){ - ready_handles+=ns; - any_ready = TRUE; - } - else if (ns == -1) {return(-1);} - - if (i%8 == 0) { - now_millis = os2_get_sys_millis(); - if((now_millis-start_millis) > timeout_ms) timeout_ms = 0; - } - i++; - } - } - -return(ready_handles); -} - - -ULONG os2_get_sys_millis() -{ - APIRET rc; - ULONG milli; - - rc = DosQuerySysInfo(14, 14, &milli, sizeof(milli)); - if(rc) { - fprintf(stderr,"Bad return code querying the millisecond counter! rc=%d\n",rc); - return(0); - } - return(milli); -} - -int os2_parse_select(sd,nfds) -struct select_data *sd; -int nfds; -{ - int i; - APIRET rc; -/* First we determine up to which descriptor we need to check. */ -/* No need to check up to 256 if we don't have to (and usually we dont...)*/ -/* Note: stuff here is hardcoded for fd_sets which are int[8] as in EMX! */ - - if(nfds > sd->max_fds){ - for(i=0;i<((FD_SETSIZE+31)/32);i++){ - if(sd->read_copy.fds_bits[i] || - sd->write_copy.fds_bits[i]) - sd->max_fds=(i*32) +32; - } - } - else { sd->max_fds = nfds; } -/* Check if result is greater than specified in select() call */ - if(sd->max_fds > nfds) sd->max_fds = nfds; - - if (sd->have_read) - { - for (i = 0; i < sd->max_fds; ++i) { - if (FD_ISSET (i, &sd->read_copy)){ - if(_files[i] & F_SOCKET) - { - sd->tcp_select_mask[sd->socket_ntotal]=_getsockhandle(i); - sd->tcp_emx_handles[sd->socket_ntotal]=i; - sd->socket_ntotal++; sd->socket_nread++; - } - else if (_files[i] & F_PIPE) - { - sd -> pipe_ntotal++; - /* rc = DosSetNPipeSem((HPIPE)i, (HSEM) hPipeSem, i); - if(rc) { fprintf(stderr,"Error SETNPIPE rc = %d\n",rc); return -1;} */ - } - } - } - } - - if (sd->have_write) - { - for (i = 0; i < sd->max_fds; ++i) { - if (FD_ISSET (i, &sd->write_copy)){ - if(_files[i] & F_SOCKET) - { - sd->tcp_select_mask[sd->socket_ntotal]=_getsockhandle(i); - sd->tcp_emx_handles[sd->socket_ntotal]=i; - sd->socket_ntotal++; sd->socket_nwrite++; - } - else if (_files[i] & F_PIPE) - { - sd -> pipe_ntotal++; - /* rc = DosSetNPipeSem((HPIPE)i, (HSEM) hPipeSem, i); - if(rc) { fprintf(stderr,"Error SETNPIPE rc = %d\n",rc); return -1;} */ - sd -> pipe_have_write=TRUE; - } - } - } - } - - -return(sd->socket_ntotal); -} - - -int os2_check_sockets(sd,readfds,writefds) -struct select_data *sd; -fd_set *readfds,*writefds; -{ - int e,i; - int j,n; - memcpy(sd->tcp_select_copy,sd->tcp_select_mask, - sd->socket_ntotal*sizeof(int)); - - e = os2_tcp_select(sd->tcp_select_copy,sd->socket_nread, - sd->socket_nwrite, 0, 0); - - if(e == 0) return(e); -/* We have something ready? */ - if(e>0){ - j = 0; n = 0; - for (i = 0; i < sd->socket_nread; ++i, ++j) - if (sd->tcp_select_copy[j] != -1) - { - FD_SET (sd->tcp_emx_handles[j], readfds); - n ++; - } - for (i = 0; i < sd->socket_nwrite; ++i, ++j) - if (sd->tcp_select_copy[j] != -1) - { - FD_SET (sd->tcp_emx_handles[j], writefds); - n ++; - } - errno = 0; - - return n; - } - if(e<0){ - /*Error -- TODO. EBADF is a good choice for now. */ - fprintf(stderr,"Error in server select! e=%d\n",e); - errno = EBADF; - return (-1); - } - } - -/* Check to see if anything is ready on pipes */ - -int os2_check_pipes(sd,readfds,writefds) -struct select_data *sd; -fd_set *readfds,*writefds; -{ -int i,e; -ULONG ulPostCount; -PIPESEMSTATE pipeSemState[128]; -APIRET rc; - e = 0; - rc = DosResetEventSem(hPipeSem,&ulPostCount); - rc = DosQueryNPipeSemState((HSEM) hPipeSem, (PPIPESEMSTATE)&pipeSemState, - sizeof(pipeSemState)); - if(rc) fprintf(stderr,"SELECT: rc from QueryNPipeSem: %d\n",rc); - i=0; - while (pipeSemState[i].fStatus != 0) { - /*fprintf(stderr,"SELECT: sem entry, stat=%d, flag=%d, key=%d,avail=%d\n", - pipeSemState[i].fStatus,pipeSemState[i].fFlag,pipeSemState[i].usKey, - pipeSemState[i].usAvail); */ - if((pipeSemState[i].fStatus == 1) && - (FD_ISSET(pipeSemState[i].usKey,&sd->read_copy))){ - FD_SET(pipeSemState[i].usKey,readfds); - e++; - } - else if((pipeSemState[i].fStatus == 2) && - (FD_ISSET(pipeSemState[i].usKey,&sd->write_copy))){ - FD_SET(pipeSemState[i].usKey,writefds); - e++; - } - else if( (pipeSemState[i].fStatus == 3) && - ( (FD_ISSET(pipeSemState[i].usKey,&sd->read_copy)) || - (FD_ISSET(pipeSemState[i].usKey,&sd->write_copy)) )){ - errno = EBADF; - /* fprintf(stderr,"Pipe has closed down, fd=%d\n",pipeSemState[i].usKey); */ - return (-1); - } - i++; - } /* endwhile */ - /*fprintf(stderr,"Done listing pipe sem entries, total %d entries, total ready entries %d\n",i,e);*/ -errno = 0; -return(e); -} - |