]> git.pld-linux.org Git - packages/XFree86.git/blame - XFree86-alpha-sockets.patch
- outdated
[packages/XFree86.git] / XFree86-alpha-sockets.patch
CommitLineData
505397d5 1--- XFree86-3.3.3.1/xc/include/Xpoll.h.alpha-sockets Mon Jan 11 12:28:21 1999
2+++ XFree86-3.3.3.1/xc/include/Xpoll.h Mon Jan 11 12:30:05 1999
3@@ -40,7 +40,7 @@
4
5 #include <X11/Xos.h>
6 #if !defined(DGUX)
7-#if (defined(SVR4) || defined(CRAY) || defined(AIXV3)) && !defined(FD_SETSIZE)
8+#if (defined(SVR4) || defined(CRAY) || defined(AIXV3) || defined(linux)) && !defined(FD_SETSIZE)
9 #include <sys/select.h>
10 #ifdef luna
11 #include <sysent.h>
12--- XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/common/compiler.h.alpha-sockets Mon Oct 19 16:39:32 1998
13+++ XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/common/compiler.h Mon Jan 11 12:28:22 1999
14@@ -161,53 +161,93 @@
15 * from linux/include/asm-alpha/unaligned.h
16 */
17
18-static __inline__ unsigned long ldq_u(unsigned long * r11)
19-{
20+/*
21+ * This is a silly but good way to make sure that
22+ * the get/put functions are indeed always optimized,
23+ * and that we use the correct sizes.
24+ */
25+extern void bad_unaligned_access_length(void);
26+
27+/*
28+ * EGCS 1.1 knows about arbitrary unaligned loads. Define some
29+ * packed structures to talk about such things with.
30+ */
31+
32+struct __una_u64 { unsigned long x __attribute__((packed)); };
33+struct __una_u32 { unsigned int x __attribute__((packed)); };
34+struct __una_u16 { unsigned short x __attribute__((packed)); };
35+
36+/*
37+ * Elemental unaligned loads
38+ */
39+
40+extern __inline__ unsigned long ldq_u(const unsigned long * r11)
41+{
42+#if __GNUC__ > 2 || __GNUC_MINOR__ >= 91
43+ const struct __una_u64 *ptr = (const struct __una_u64 *) r11;
44+ return ptr->x;
45+#else
46 unsigned long r1,r2;
47 __asm__("ldq_u %0,%3\n\t"
48 "ldq_u %1,%4\n\t"
49 "extql %0,%2,%0\n\t"
50- "extqh %1,%2,%1\n\t"
51- "bis %1,%0,%0"
52+ "extqh %1,%2,%1"
53 :"=&r" (r1), "=&r" (r2)
54 :"r" (r11),
55 "m" (*r11),
56- "m" (*(unsigned long *)(7+(char *) r11)));
57- return r1;
58+ "m" (*(const unsigned long *)(7+(char *) r11)));
59+ return r1 | r2;
60+#endif
61 }
62
63-static __inline__ unsigned long ldl_u(unsigned int * r11)
64+extern __inline__ unsigned long ldl_u(const unsigned int * r11)
65 {
66+#if __GNUC__ > 2 || __GNUC_MINOR__ >= 91
67+ const struct __una_u32 *ptr = (const struct __una_u32 *) r11;
68+ return ptr->x;
69+#else
70 unsigned long r1,r2;
71 __asm__("ldq_u %0,%3\n\t"
72 "ldq_u %1,%4\n\t"
73 "extll %0,%2,%0\n\t"
74- "extlh %1,%2,%1\n\t"
75- "bis %1,%0,%0"
76+ "extlh %1,%2,%1"
77 :"=&r" (r1), "=&r" (r2)
78 :"r" (r11),
79 "m" (*r11),
80- "m" (*(unsigned long *)(3+(char *) r11)));
81- return r1;
82+ "m" (*(const unsigned long *)(3+(char *) r11)));
83+ return r1 | r2;
84+#endif
85 }
86
87-static __inline__ unsigned long ldw_u(unsigned short * r11)
88+extern __inline__ unsigned long ldw_u(const unsigned short * r11)
89 {
90+#if __GNUC__ > 2 || __GNUC_MINOR__ >= 91
91+ const struct __una_u16 *ptr = (const struct __una_u16 *) r11;
92+ return ptr->x;
93+#else
94 unsigned long r1,r2;
95 __asm__("ldq_u %0,%3\n\t"
96 "ldq_u %1,%4\n\t"
97 "extwl %0,%2,%0\n\t"
98- "extwh %1,%2,%1\n\t"
99- "bis %1,%0,%0"
100+ "extwh %1,%2,%1"
101 :"=&r" (r1), "=&r" (r2)
102 :"r" (r11),
103 "m" (*r11),
104- "m" (*(unsigned long *)(1+(char *) r11)));
105- return r1;
106+ "m" (*(const unsigned long *)(1+(char *) r11)));
107+ return r1 | r2;
108+#endif
109 }
110
111-static __inline__ void stq_u(unsigned long r5, unsigned long * r11)
112-{
113+/*
114+ * Elemental unaligned stores
115+ */
116+
117+extern __inline__ void stq_u(unsigned long r5, unsigned long * r11)
118+{
119+#if __GNUC__ > 2 || __GNUC_MINOR__ >= 91
120+ struct __una_u64 *ptr = (struct __una_u64 *) r11;
121+ ptr->x = r5;
122+#else
123 unsigned long r1,r2,r3,r4;
124
125 __asm__("ldq_u %3,%1\n\t"
126@@ -224,10 +264,15 @@
127 "=m" (*(unsigned long *)(7+(char *) r11)),
128 "=&r" (r1), "=&r" (r2), "=&r" (r3), "=&r" (r4)
129 :"r" (r5), "r" (r11));
130+#endif
131 }
132
133-static __inline__ void stl_u(unsigned long r5, unsigned int * r11)
134+extern __inline__ void stl_u(unsigned long r5, unsigned int * r11)
135 {
136+#if __GNUC__ > 2 || __GNUC_MINOR__ >= 91
137+ struct __una_u32 *ptr = (struct __una_u32 *) r11;
138+ ptr->x = r5;
139+#else
140 unsigned long r1,r2,r3,r4;
141
142 __asm__("ldq_u %3,%1\n\t"
143@@ -244,10 +289,15 @@
144 "=m" (*(unsigned long *)(3+(char *) r11)),
145 "=&r" (r1), "=&r" (r2), "=&r" (r3), "=&r" (r4)
146 :"r" (r5), "r" (r11));
147+#endif
148 }
149
150-static __inline__ void stw_u(unsigned long r5, unsigned short * r11)
151+extern __inline__ void stw_u(unsigned long r5, unsigned short * r11)
152 {
153+#if __GNUC__ > 2 || __GNUC_MINOR__ >= 91
154+ struct __una_u16 *ptr = (struct __una_u16 *) r11;
155+ ptr->x = r5;
156+#else
157 unsigned long r1,r2,r3,r4;
158
159 __asm__("ldq_u %3,%1\n\t"
160@@ -264,6 +314,7 @@
161 "=m" (*(unsigned long *)(1+(char *) r11)),
162 "=&r" (r1), "=&r" (r2), "=&r" (r3), "=&r" (r4)
163 :"r" (r5), "r" (r11));
164+#endif
165 }
166
167 #define mem_barrier() __asm__ __volatile__("mb" : : : "memory")
168--- XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/common/xf86Summa.c.alpha-sockets Mon Jan 11 12:28:16 1999
169+++ XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/common/xf86Summa.c Mon Jan 11 12:28:22 1999
170@@ -600,7 +600,7 @@
171 timeout.tv_sec = 0;
172 timeout.tv_usec = 200000;
173
174- SYSCALL(err = select(FD_SETSIZE, &readfds, NULL, NULL, &timeout));
175+ SYSCALL(err = select(fd+1, &readfds, NULL, NULL, &timeout));
176 if (err == -1) {
177 Error("SummaSketch select");
178 return NULL;
179--- XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/common/xf86Wacom.c.alpha-sockets Mon Jan 11 12:28:16 1999
180+++ XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/common/xf86Wacom.c Mon Jan 11 12:28:23 1999
181@@ -692,7 +692,7 @@
182
183 timeout.tv_sec = 1;
184 timeout.tv_usec = 0;
185- SYSCALL(err = select(FD_SETSIZE, &readfds, NULL, NULL, &timeout));
186+ SYSCALL(err = select(fd+1, &readfds, NULL, NULL, &timeout));
187
188 return err;
189 }
190--- XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/common/xf86_Mouse.c.alpha-sockets Mon Jan 11 12:28:16 1999
191+++ XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/common/xf86_Mouse.c Mon Jan 11 12:28:23 1999
192@@ -437,7 +437,7 @@
193 write(mouse->mseFd, s, 1);
194 FD_ZERO(&fds);
195 FD_SET(mouse->mseFd, &fds);
196- if (select(FD_SETSIZE, &fds, NULL, NULL, NULL) <= 0)
197+ if (select(mouse->mseFd+1, &fds, NULL, NULL, NULL) <= 0)
198 break;
199 read(mouse->mseFd, &c, 1);
200 if (c != *s)
201--- XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/common/xf86_PnPMouse.c.alpha-sockets Mon Mar 2 05:23:21 1998
202+++ XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/common/xf86_PnPMouse.c Mon Jan 11 12:28:23 1999
203@@ -235,7 +235,7 @@
204 FD_SET(mouse->mseFd, &fds);
205 timeout.tv_sec = 0;
206 timeout.tv_usec = 200000;
207- if (select(FD_SETSIZE, &fds, NULL, NULL, &timeout) <= 0) {
208+ if (select(mouse->mseFd+1, &fds, NULL, NULL, &timeout) <= 0) {
209
210 /* port setup, 2nd phase (2.1.5) */
211 i = TIOCM_DTR | TIOCM_RTS; /* DTR = 0, RTS = 0 */
212@@ -252,7 +252,7 @@
213 FD_SET(mouse->mseFd, &fds);
214 timeout.tv_sec = 0;
215 timeout.tv_usec = 200000;
216- if (select(FD_SETSIZE, &fds, NULL, NULL, &timeout) <= 0)
217+ if (select(mouse->mseFd+1, &fds, NULL, NULL, &timeout) <= 0)
218 goto connect_idle;
219 }
220 #else
221@@ -277,7 +277,7 @@
222 FD_SET(mouse->mseFd, &fds);
223 timeout.tv_sec = 0;
224 timeout.tv_usec = 200000;
225- if (select(FD_SETSIZE, &fds, NULL, NULL, &timeout) <= 0)
226+ if (select(mouse->mseFd+1, &fds, NULL, NULL, &timeout) <= 0)
227 goto connect_idle;
228 #endif
229
230@@ -302,7 +302,7 @@
231 FD_SET(mouse->mseFd, &fds);
232 timeout.tv_sec = 0;
233 timeout.tv_usec = 200000;
234- if (select(FD_SETSIZE, &fds, NULL, NULL, &timeout) <= 0)
235+ if (select(mouse->mseFd+1, &fds, NULL, NULL, &timeout) <= 0)
236 break;
237
238 read(mouse->mseFd, &buf[i], 1);
239--- XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/vga256/drivers/mga/mga_driver.c.alpha-sockets Mon Jan 11 12:28:17 1999
240+++ XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/vga256/drivers/mga/mga_driver.c Mon Jan 11 12:28:23 1999
241@@ -1256,6 +1256,16 @@
242 MGASave(save)
243 vgaHWPtr save;
244 {
245+#if NeedFunctionPrototypes
246+ extern void *MGA3026Save(void*);
247+ extern void *MGA1064Save(void*);
248+ extern void *MGA200Save(void*);
249+#else
250+ extern void *MGA3026Save();
251+ extern void *MGA1064Save();
252+ extern void *MGA200Save();
253+#endif
254+
255 switch (MGAchipset)
256 {
257 case PCI_CHIP_MGA2064:
258--- XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/xaa/xf86bench.c.alpha-sockets Mon Jan 11 12:28:19 1999
259+++ XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/xaa/xf86bench.c Mon Jan 11 12:28:23 1999
260@@ -96,7 +96,7 @@
261 unsigned char *end;
262 #ifdef __alpha__
263 unsigned long data64;
264- data64 = data | (data << 32);
265+ data64 = (unsigned long)data | ((unsigned long)data << 32);
266 #endif
267 end = dest + nbytes;
268 while (dest <= end - 128) {
269--- XFree86-3.3.3.1/xc/programs/Xserver/include/os.h.alpha-sockets Thu Jan 22 05:47:13 1998
270+++ XFree86-3.3.3.1/xc/programs/Xserver/include/os.h Mon Jan 11 12:28:23 1999
271@@ -773,4 +773,20 @@
272 /* stuff for FlushCallback */
273 extern CallbackListPtr FlushCallback;
274
275+#ifdef LONG64
276+
277+/* Systems with 64-bit 'long' have their own quirks, like
278+ select()'s fd_mask components are 64-bit long, but the
279+ ffs() function works only on 'int', which at least at
280+ an Alpha are 32-bit wide... */
281+
282+# define ffs mffs
283+
284+extern int mffs (
285+#if NeedFunctionPrototypes
286+ unsigned long
287+#endif
288+);
289+#endif /* LONG64 */
290+
291 #endif /* OS_H */
292--- XFree86-3.3.3.1/xc/programs/Xserver/os/WaitFor.c.alpha-sockets Sat Oct 24 03:56:28 1998
293+++ XFree86-3.3.3.1/xc/programs/Xserver/os/WaitFor.c Mon Jan 11 12:28:23 1999
294@@ -83,9 +83,10 @@
295 #include "dixstruct.h"
296 #include "opaque.h"
297
298-/* modifications by raphael */
299-#define ffs mffs
300-int mffs(fd_mask mask) {
301+/* modifications by raphael, and [mea];
302+ system uses this if LONG64 is defined.
303+ See at the end of the "os.h" */
304+int mffs(unsigned long mask) {
305 register i;
306 if ( ! mask ) return 0;
307 i = 1;
308@@ -423,17 +424,18 @@
309 if (XFD_ANYSET (&clientsReadable))
310 {
311 #ifndef WIN32
312- for (i=0; i<howmany(XFD_SETSIZE, NFDBITS); i++)
313+ for (i=0;
314+ i < (sizeof(clientsReadable)/sizeof(clientsReadable.fds_bits[0]));
315+ i++)
316 {
317 int highest_priority;
318
319 while (clientsReadable.fds_bits[i])
320 {
321 int client_priority, client_index;
322-
323 curclient = ffs (clientsReadable.fds_bits[i]) - 1;
324- client_index = /* raphael: modified */
325- ConnectionTranslation[curclient + (i * (sizeof(fd_mask) * 8))];
326+ curclient += i * (8 * sizeof(fd_mask));
327+ client_index = ConnectionTranslation[curclient];
328 #else
329 int highest_priority;
330 fd_set savedClientsReadable;
331@@ -476,11 +478,10 @@
332 {
333 pClientsReady[nready++] = client_index;
334 }
335+
336+ FD_CLR(curclient, &clientsReadable);
337 #ifndef WIN32
338- clientsReadable.fds_bits[i] &= ~(((fd_mask)1) << curclient);
339 }
340-#else
341- FD_CLR(curclient, &clientsReadable);
342 #endif
343 }
344 }
345@@ -541,12 +542,13 @@
346 COPYBITS(ClientsWithInput, clientsReadable);
347 dbprintf(("WaitFor: "));
348 nready = 0;
349- for (i=0; i < mskcnt; i++) {
350+ for (i=0; i < mskcnt;i++) {
351 while (clientsReadable[i]) {
352 int client_priority, curclient, client_index;
353
354 curclient = ffs (clientsReadable[i]) - 1;
355- client_index = ConnectionTranslation[curclient + (i << 5)];
356+ curclient += i * (8 * sizeof(clientsReadable[i]));
357+ client_index = ConnectionTranslation[curclient];
358 dbprintf(("%d has input\n", curclient));
359 #ifdef XSYNC
360 client_priority = clients[client_index]->priority;
361@@ -794,7 +796,7 @@
362 {
363 OsTimerPtr timer;
364
365- while (timer = timers)
366+ while ((timer = timers))
367 {
368 timers = timer->next;
369 xfree(timer);
370--- XFree86-3.3.3.1/xc/programs/Xserver/os/connection.c.alpha-sockets Mon Jan 11 12:28:20 1999
371+++ XFree86-3.3.3.1/xc/programs/Xserver/os/connection.c Mon Jan 11 12:28:23 1999
372@@ -178,10 +178,6 @@
373 #include <netdnet/dn.h>
374 #endif /* DNETCONN */
375
376-/* added by raphael */
377-#define ffs mffs
378-extern int mffs(long);
379-
380 extern char *display; /* The display number */
381 int lastfdesc; /* maximum file descriptor */
382
383@@ -785,6 +781,8 @@
384 {
385 #ifndef WIN32
386 fd_mask readyconnections; /* mask of listeners that are ready */
387+ /* In UNIX environments we assume that all listeners fit into
388+ the first 32 file descriptor ids. */
389 #else
390 fd_set readyconnections; /* set of listeners that are ready */
391 #endif
392@@ -981,9 +979,6 @@
393 void
394 CheckConnections()
395 {
396-#ifndef WIN32
397- fd_mask mask;
398-#endif
399 fd_set tmask;
400 register int curclient, curoff;
401 int i;
402@@ -994,23 +989,24 @@
403 #endif
404
405 #ifndef AMOEBA
406- notime.tv_sec = 0;
407- notime.tv_usec = 0;
408-
409 #ifndef WIN32
410- for (i=0; i<howmany(XFD_SETSIZE, NFDBITS); i++)
411+ for (i=0; i < (sizeof(AllClients)/sizeof(fd_mask)); i++)
412 {
413- mask = AllClients.fds_bits[i];
414+ fd_mask mask = AllClients.fds_bits[i];
415 while (mask)
416 {
417 curoff = ffs (mask) - 1;
418- curclient = curoff + (i << 5);
419+ curclient = curoff + (i * 8 * sizeof(mask));
420 FD_ZERO(&tmask);
421 FD_SET(curclient, &tmask);
422+ /* there are operating systems which *do* alter the timeout
423+ variables -- it is good practice to initialize them always */
424+ notime.tv_sec = 0;
425+ notime.tv_usec = 0;
426 r = Select (curclient + 1, &tmask, NULL, NULL, &notime);
427 if (r < 0)
428 CloseDownClient(clients[ConnectionTranslation[curclient]]);
429- mask &= ~(1 << curoff);
430+ mask &= ~(((fd_mask)1) << curoff);
431 }
432 }
433 #else
434--- XFree86-3.3.3.1/xc/programs/Xserver/os/io.c.alpha-sockets Sat Oct 24 03:56:29 1998
435+++ XFree86-3.3.3.1/xc/programs/Xserver/os/io.c Mon Jan 11 12:28:23 1999
436@@ -85,10 +85,6 @@
437 #include "lbxserve.h"
438 #endif
439
440-/* added by raphael */
441-#define ffs mffs
442-extern int mffs(long);
443-
444 CallbackListPtr ReplyCallback;
445 CallbackListPtr FlushCallback;
446
447@@ -995,7 +991,7 @@
448 NewOutputPending = FALSE;
449
450 #ifndef WIN32
451- for (base = 0; base < howmany(XFD_SETSIZE, NFDBITS); base++)
452+ for (base = 0; base < (sizeof(OutputPending)/sizeof(fd_mask)); base++)
453 {
454 mask = OutputPending.fds_bits[ base ];
455 OutputPending.fds_bits[ base ] = 0;
456@@ -1003,7 +999,8 @@
457 {
458 index = ffs(mask) - 1;
459 mask &= ~lowbit(mask);
460- if ((index = ConnectionTranslation[(base << 5) + index]) == 0)
461+ index = ConnectionTranslation[ base * (8 * sizeof(mask)) + index ];
462+ if (index == 0)
463 continue;
464 client = clients[index];
465 if (client->clientGone)
466--- XFree86-3.3.3.1/xc/programs/lbxproxy/include/os.h.alpha-sockets Sat Dec 21 23:16:36 1996
467+++ XFree86-3.3.3.1/xc/programs/lbxproxy/include/os.h Mon Jan 11 12:28:23 1999
468@@ -243,4 +243,20 @@
469 #endif
470 );
471
472+#ifdef LONG64
473+
474+/* Systems with 64-bit 'long' have their own quirks, like
475+ select()'s fd_mask components are 64-bit long, but the
476+ ffs() function works only on 'int', which at least at
477+ an Alpha are 32-bit wide... */
478+
479+# define ffs mffs
480+
481+extern int mffs (
482+#if NeedFunctionPrototypes
483+ unsigned long
484+#endif
485+);
486+#endif /* LONG64 */
487+
488 #endif
489--- XFree86-3.3.3.1/xc/programs/lbxproxy/os/WaitFor.c.alpha-sockets Sat Dec 21 23:16:30 1996
490+++ XFree86-3.3.3.1/xc/programs/lbxproxy/os/WaitFor.c Mon Jan 11 12:28:23 1999
491@@ -71,6 +71,20 @@
492 #include "osdep.h"
493 #include "os.h"
494
495+/* modifications by raphael, and [mea];
496+ system uses this if LONG64 is defined.
497+ See at the end of the "os.h" */
498+int mffs(unsigned long mask) {
499+ register i;
500+ if ( ! mask ) return 0;
501+ i = 1;
502+ while (! (mask & 1)) {
503+ i++;
504+ mask = mask >> 1;
505+ }
506+ return i;
507+}
508+
509 extern fd_set AllSockets;
510 extern fd_set AllClients;
511 extern fd_set LastSelectMask;
512@@ -192,17 +206,18 @@
513 nready = 0;
514 if (XFD_ANYSET(&clientsReadable))
515 {
516- for (i=0; i<howmany(XFD_SETSIZE, NFDBITS); i++)
517+ for (i=0; i < (sizeof(clientsReadable)/sizeof(fd_mask)); i++)
518 {
519 while (clientsReadable.fds_bits[i])
520 {
521 int client_index;
522
523 curclient = ffs (clientsReadable.fds_bits[i]) - 1;
524- client_index = ConnectionTranslation[curclient + (i << 5)];
525- {
526- pClientsReady[nready++] = client_index;
527- }
528+ curclient += i * (8 * sizeof(fd_mask));
529+ client_index = ConnectionTranslation[curclient];
530+
531+ pClientsReady[nready++] = client_index;
532+
533 clientsReadable.fds_bits[i] &= ~(((fd_mask)1) << curclient);
534 }
535 }
536--- XFree86-3.3.3.1/xc/programs/lbxproxy/os/connection.c.alpha-sockets Thu Nov 5 14:27:57 1998
537+++ XFree86-3.3.3.1/xc/programs/lbxproxy/os/connection.c Mon Jan 11 12:28:23 1999
538@@ -1746,7 +1746,7 @@
539 while (readyconnections)
540 {
541 curconn = ffs (readyconnections) - 1;
542- readyconnections &= ~(1 << curconn);
543+ readyconnections &= ~(((fd_mask)1) << curconn);
544 if ((newconn = accept (curconn,
545 (struct sockaddr *) NULL,
546 (int *)NULL)) < 0)
547@@ -1905,19 +1905,19 @@
548 notime.tv_sec = 0;
549 notime.tv_usec = 0;
550
551- for (i=0; i<howmany(XFD_SETSIZE, NFDBITS); i++)
552+ for (i=0; i < (sizeof(AllClients)/sizeof(fd_mask)); i++)
553 {
554 mask = AllClients.fds_bits[i];
555 while (mask)
556 {
557 curoff = ffs (mask) - 1;
558- curclient = curoff + (i << 5);
559+ curclient = curoff + i * (8 * sizeof(mask));
560 FD_ZERO(&tmask);
561 FD_SET(curclient, &tmask);
562 r = Select (curclient + 1, &tmask, NULL, NULL, &notime);
563 if (r < 0)
564 CloseDownClient(clients[ConnectionTranslation[curclient]]);
565- mask &= ~(1 << curoff);
566+ mask &= ~(((fd_mask)1) << curoff);
567 }
568 }
569 }
570--- XFree86-3.3.3.1/xc/programs/lbxproxy/os/io.c.alpha-sockets Wed Jan 1 22:02:48 1997
571+++ XFree86-3.3.3.1/xc/programs/lbxproxy/os/io.c Mon Jan 11 12:28:23 1999
572@@ -913,7 +913,8 @@
573 void
574 FlushAllOutput()
575 {
576- register int index, base, mask;
577+ register int index, base;
578+ register fd_mask mask;
579 OsCommPtr oc;
580 register ClientPtr client;
581
582@@ -927,7 +928,7 @@
583 */
584 NewOutputPending = FALSE;
585
586- for (base = 0; base < howmany(XFD_SETSIZE, NFDBITS); base++)
587+ for (base = 0; base < (sizeof(OutputPending)/sizeof(mask)); base++)
588 {
589 mask = OutputPending.fds_bits[ base ];
590 OutputPending.fds_bits[ base ] = 0;
591@@ -935,7 +936,9 @@
592 {
593 index = ffs(mask) - 1;
594 mask &= ~lowbit(mask);
595- if ((index = ConnectionOutputTranslation[(base << 5) + index]) == 0)
596+ index += base * (8 * sizeof(mask));
597+ index = ConnectionOutputTranslation[index];
598+ if (index == 0)
599 continue;
600 client = clients[index];
601 if (client->clientGone)
602--- XFree86-3.3.3.1/xc/programs/xfs/include/os.h.alpha-sockets Fri Jan 5 08:21:30 1996
603+++ XFree86-3.3.3.1/xc/programs/xfs/include/os.h Mon Jan 11 12:28:23 1999
604@@ -94,4 +94,19 @@
605 extern int ListCatalogues();
606 extern int ListAlternateServers();
607
608+#ifdef LONG64
609+
610+/* Systems with 64-bit 'long' have their own quirks, like
611+ select()'s fd_mask components are 64-bit long, but the
612+ ffs() function works only on 'int', which at least at
613+ an Alpha are 32-bit wide... */
614+
615+# define ffs mffs
616+
617+extern int mffs (
618+#if NeedFunctionPrototypes
619+ unsigned long
620+#endif
621+);
622+#endif /* LONG64 */
623 #endif /* _OS_H_ */
624--- XFree86-3.3.3.1/xc/programs/xfs/os/connection.c.alpha-sockets Thu Nov 5 14:28:31 1998
625+++ XFree86-3.3.3.1/xc/programs/xfs/os/connection.c Mon Jan 11 12:28:23 1999
626@@ -325,6 +325,9 @@
627
628 /*
629 * accepts new connections
630+ *
631+ * This assumes that all sockets in *listen* mode are numbered
632+ * something below 32! (likely true..)
633 */
634 void
635 MakeNewConnections()
636@@ -495,15 +498,15 @@
637 struct timeval notime;
638 int r;
639
640- notime.tv_sec = 0;
641- notime.tv_usec = 0;
642-
643 XFD_COPYSET(&AllClients, &mask);
644 for (i = 0; i < howmany(XFD_SETSIZE, NFDBITS); i++) {
645 while (mask.fds_bits[i]) {
646- curclient = ffs(mask.fds_bits[i]) - 1 + (i << 5);
647+ curclient = ffs(mask.fds_bits[i]) - 1;
648+ curclient += i * (8 * sizeof(mask.fds_bits[i]));
649 FD_ZERO(&tmask);
650 FD_SET(curclient, &tmask);
651+ notime.tv_sec = 0;
652+ notime.tv_usec = 0;
653 r = Select(curclient + 1, &tmask, NULL, NULL, &notime);
654 if (r < 0)
655 CloseDownClient(clients[ConnectionTranslation[curclient]]);
656--- XFree86-3.3.3.1/xc/programs/xfs/os/io.c.alpha-sockets Thu May 29 10:01:08 1997
657+++ XFree86-3.3.3.1/xc/programs/xfs/os/io.c Mon Jan 11 12:28:23 1999
658@@ -69,6 +69,7 @@
659 #include "X11/Xpoll.h"
660 #include "osdep.h"
661 #include "globals.h"
662+#include "os.h"
663
664 #ifdef X_NOT_STDC_ENV
665 extern int errno;
666@@ -530,13 +531,14 @@
667
668 NewOutputPending = FALSE;
669
670- for (base = 0; base < howmany(XFD_SETSIZE, NFDBITS); base++) {
671+ for (base = 0; base < (sizeof(OutputPending)/sizeof(mask)); base++) {
672 mask = OutputPending.fds_bits[base];
673 OutputPending.fds_bits[base] = 0;
674 while (mask) {
675 index = ffs(mask) - 1;
676 mask &= ~lowbit(mask);
677- if ((index = ConnectionTranslation[(base << 5) + index]) == 0)
678+ index += base * (8 * sizeof(mask));
679+ if ((index = ConnectionTranslation[index]) == 0)
680 continue;
681 client = clients[index];
682 if (client->clientGone == CLIENT_GONE)
683--- XFree86-3.3.3.1/xc/programs/xfs/os/waitfor.c.alpha-sockets Sat Jan 18 02:02:48 1997
684+++ XFree86-3.3.3.1/xc/programs/xfs/os/waitfor.c Mon Jan 11 12:28:23 1999
685@@ -65,6 +65,21 @@
686 #include "globals.h"
687 #include "X11/Xpoll.h"
688 #include "osdep.h"
689+#include "os.h"
690+
691+/* modifications by raphael, and [mea];
692+ system uses this if LONG64 is defined.
693+ See at the end of the "os.h" */
694+int mffs(unsigned long mask) {
695+ register i;
696+ if ( ! mask ) return 0;
697+ i = 1;
698+ while (! (mask & 1)) {
699+ i++;
700+ mask = mask >> 1;
701+ }
702+ return i;
703+}
704
705 #ifdef MINIX
706 #include <sys/nbio.h>
707@@ -208,10 +223,11 @@
708
709 if (current_time) /* may not have been set */
710 current_time = GetTimeInMillis();
711- for (i = 0; i < howmany(XFD_SETSIZE, NFDBITS); i++) {
712+ for (i = 0; i < (sizeof(clientsReadable)/sizeof(fd_mask)); i++) {
713 while (clientsReadable.fds_bits[i]) {
714 curclient = ffs(clientsReadable.fds_bits[i]) - 1;
715- conn = ConnectionTranslation[curclient + (i << 5)];
716+ curclient += i * (8 * sizeof(fd_mask));
717+ conn = ConnectionTranslation[curclient];
718 FD_CLR (curclient, &clientsReadable);
719 client = clients[conn];
720 if (!client)
This page took 0.183973 seconds and 4 git commands to generate.