* More X patches
@ 1998-06-28 1:05 Dave Gilbert
0 siblings, 0 replies; 9+ messages in thread
From: Dave Gilbert @ 1998-06-28 1:05 UTC (permalink / raw)
To: matti.aarnio; +Cc: axp-list
Hi,
(NOTE: Please reply to me as dg@treblig.demon.co.uk - my
main address is broken over this weekend)
Included are some more X server patches for the Alpha; with
these the server doesn't crash after receiving 25 or so connections;
however it is still not servicing clients on those connections.
I get the feeling the equivalent of my 'ffsl' would be a useful
addition to the C library (since there is an ffs and this is the point of
it!).
Dave
--- ./include/Xpoll.h.predag Sat Jun 27 23:46:31 1998
+++ ./include/Xpoll.h Sat Jun 27 23:47:02 1998
@@ -90,13 +90,13 @@
#endif
#ifndef FD_SET
-#define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
+#define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1L << ((n) % NFDBITS)))
#endif
#ifndef FD_CLR
-#define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
+#define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1L << ((n) % NFDBITS)))
#endif
#ifndef FD_ISSET
-#define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
+#define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1L << ((n) % NFDBITS)))
#endif
#ifndef FD_ZERO
#define FD_ZERO(p) bzero((char *)(p), sizeof(*(p)))
./programs/Xserver/dix/Makefile.predag
--- ./programs/Xserver/dix/Makefile.predag Sun Jun 28 00:23:10 1998
+++ ./programs/Xserver/dix/Makefile Sun Jun 28 00:22:35 1998
@@ -638,9 +638,9 @@
XPSRC = xpstubs.c
XPOBJ = xpstubs.o
-SRCS = atom.c colormap.c cursor.c devices.c dispatch.c dixutils.c events.c extension.c gc.c globals.c glyphcurs.c grabs.c main.c property.c resource.c swaprep.c swapreq.c tables.c window.c initatoms.c dixfonts.c privates.c pixmap.c $(FFS_SRC)
+SRCS = atom.c colormap.c cursor.c devices.c dispatch.c dixutils.c events.c extension.c gc.c globals.c glyphcurs.c grabs.c main.c property.c resource.c swaprep.c swapreq.c tables.c window.c initatoms.c dixfonts.c privates.c pixmap.c ffsl.c $(FFS_SRC)
-OBJS = atom.o colormap.o cursor.o devices.o dispatch.o dixutils.o events.o extension.o gc.o globals.o glyphcurs.o grabs.o main.o property.o resource.o swaprep.o swapreq.o tables.o window.o initatoms.o dixfonts.o privates.o pixmap.o $(FFS_OBJ)
+OBJS = atom.o colormap.o cursor.o devices.o dispatch.o dixutils.o events.o extension.o gc.o globals.o glyphcurs.o grabs.o main.o property.o resource.o swaprep.o swapreq.o tables.o window.o initatoms.o dixfonts.o privates.o pixmap.o ffsl.o $(FFS_OBJ)
INCLUDES = -I../include -I$(XINCLUDESRC) -I$(FONTINCSRC) -I$(EXTINCSRC)
LINTLIBS = ../os/llib-los.ln
./programs/Xserver/dix/ffsl.c.predag
--- ./programs/Xserver/dix/ffsl.c.predag Sun Jun 28 00:23:20 1998
+++ ./programs/Xserver/dix/ffsl.c Sun Jun 28 01:18:37 1998
@@ -0,0 +1,39 @@
+/* $XConsortium: ffs.c /main/1 1996/12/02 10:20:11 lehors $ */
+/*
+
+Copyright (C) 1996 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Soft-
+ware"), 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 condi-
+tions:
+
+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 MERCHANTABIL-
+ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
+SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABIL-
+ITY, 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 the X Consortium shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization from
+the X Consortium.
+
+*/
+
+int
+ffsl(long i)
+{
+ int j;
+ for (j = 1; (i & 1L) == 0; j++)
+ i >>= 1;
+ return j;
+}
./programs/Xserver/include/dix.h.predag
--- ./programs/Xserver/include/dix.h.predag Sun Jun 28 00:27:10 1998
+++ ./programs/Xserver/include/dix.h Sun Jun 28 00:27:39 1998
@@ -1100,4 +1100,10 @@
int count;
} DeviceEventInfoRec;
+extern int ffsl(
+#if NeedFunctionPrototypes
+ long
+#endif
+);
+
#endif /* DIX_H */
./programs/Xserver/os/connection.c.predag
--- ./programs/Xserver/os/connection.c.predag Sat Jun 27 22:22:40 1998
+++ ./programs/Xserver/os/connection.c Sun Jun 28 01:35:28 1998
@@ -810,8 +810,8 @@
int status;
#ifndef WIN32
- curconn = ffs (readyconnections) - 1;
- readyconnections &= ~(1 << curconn);
+ curconn = ffsl (readyconnections) - 1;
+ readyconnections &= ~(1L << curconn);
#else
curconn = XFD_FD(&readyconnections, i);
#endif
@@ -977,14 +977,14 @@
mask = AllClients.fds_bits[i];
while (mask)
{
- curoff = ffs (mask) - 1;
+ curoff = ffsl (mask) - 1;
curclient = curoff + (i << 5);
FD_ZERO(&tmask);
FD_SET(curclient, &tmask);
r = Select (curclient + 1, &tmask, NULL, NULL, ¬ime);
if (r < 0)
CloseDownClient(clients[ConnectionTranslation[curclient]]);
- mask &= ~(1 << curoff);
+ mask &= ~(1L << curoff);
}
}
#else
./programs/Xserver/os/WaitFor.c.predag
--- ./programs/Xserver/os/WaitFor.c.predag Sun Jun 28 00:25:44 1998
+++ ./programs/Xserver/os/WaitFor.c Sun Jun 28 01:35:16 1998
@@ -418,7 +418,7 @@
{
int client_priority, client_index;
- curclient = ffs (clientsReadable.fds_bits[i]) - 1;
+ curclient = ffsl (clientsReadable.fds_bits[i]) - 1;
client_index = ConnectionTranslation[curclient + (i << 5)];
#else
int highest_priority;
@@ -531,7 +531,7 @@
while (clientsReadable[i]) {
int client_priority, curclient, client_index;
- curclient = ffs (clientsReadable[i]) - 1;
+ curclient = ffsl (clientsReadable[i]) - 1;
client_index = ConnectionTranslation[curclient + (i << 5)];
dbprintf(("%d has input\n", curclient));
#ifdef XSYNC
./programs/Xserver/Makefile.predag
--- ./programs/Xserver/Makefile.predag Sun Jun 28 01:04:12 1998
+++ ./programs/Xserver/Makefile Sun Jun 28 01:04:13 1998
@@ -1125,7 +1125,7 @@
XNESTOBJS =
XNEST = hw/xnest/libxnest.a
-XNESTLIBS = $(DIX) $(OS) $(FONT) $(XPDDX) $(XNEST) $(XPFBLIBS) $(MI) $(EXTENSIONS) $(XNEST)
+XNESTLIBS = $(DIX) $(OS) $(FONT) $(XPDDX) $(XNEST) $(XPFBLIBS) $(MI) $(EXTENSIONS) $(DIX) $(XNEST)
XNESTSYSLIBS = $(LDPRELIBS) $(XLIB) $(SYSLIBS)
$(XNESTOBJS) $(XNESTLIBS) $(XNESTSYSLIBS):: $(XNESTDIRS)
--------------------------------------------------------------------
/ Dr. David Alan Gilbert | Running Linux on Alpha & ARM \
\ gro.gilbert @ treblig.org | ------- Happy in hex ------- /
\____________________________|___ http://www.treblig.demon.co.uk __/
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: More X patches
@ 1998-06-28 22:17 Matti Aarnio
1998-06-29 2:48 ` Michal Jaegermann
1998-06-29 22:07 ` Richard Henderson
0 siblings, 2 replies; 9+ messages in thread
From: Matti Aarnio @ 1998-06-28 22:17 UTC (permalink / raw)
To: Dave Gilbert, dg; +Cc: axp-list
Hello Dave,
I thought about the patches you are suggesting:
+++ ./include/Xpoll.h Sat Jun 27 23:47:02 1998
+++ ./programs/Xserver/dix/Makefile Sun Jun 28 00:22:35 1998
+++ ./programs/Xserver/dix/ffsl.c Sun Jun 28 01:18:37 1998
+++ ./programs/Xserver/include/dix.h Sun Jun 28 00:27:39 1998
+++ ./programs/Xserver/os/connection.c Sun Jun 28 01:35:28 1998
+++ ./programs/Xserver/os/WaitFor.c Sun Jun 28 01:35:16 1998
+++ ./programs/Xserver/Makefile Sun Jun 28 01:04:13 1998
The first problem I see is that you are patching Makefile:s
Those are GENERATED from Imakefile:s in the same directories.
The second is what I think larger system problem, as apparently
the codes in connection.c, and WaitFor.c assume select(2)
semantics with components of the fd_set's array to have size of
32 bits (and hence that ffs() works always, and that magic "i << 5"
type code is always correct..)
These same problems are in Opengroup X11R6.4 sources too. Sigh..
(And in XFree86 betas too, for that matter)
/Matti Aarnio <matti.aarnio@sonera.fi>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: More X patches
1998-06-28 22:17 More X patches Matti Aarnio
@ 1998-06-29 2:48 ` Michal Jaegermann
1998-06-29 12:35 ` David Alan Gilbert
1998-06-29 22:07 ` Richard Henderson
1 sibling, 1 reply; 9+ messages in thread
From: Michal Jaegermann @ 1998-06-29 2:48 UTC (permalink / raw)
To: axp-list
>
> The second is what I think larger system problem, as apparently
> the codes in connection.c, and WaitFor.c assume select(2)
> semantics with components of the fd_set's array to have size of
> 32 bits
From what I see Xpoll.h header is broken in the first place.
It overrides macros, like FD_ISSET, defined elsewhere in header
files and does that in a manner which is incorrect on Alpha.
Patches by Dave are of a "ho-hum" kind. "1L" happens to work at
this moment but we have seen the same bug before on other occasions
and there is a fd_set typedef to deal cleanly with the issue.
Michal
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: More X patches
1998-06-29 2:48 ` Michal Jaegermann
@ 1998-06-29 12:35 ` David Alan Gilbert
1998-06-29 23:06 ` Quant-X Alpha Linux Support
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: David Alan Gilbert @ 1998-06-29 12:35 UTC (permalink / raw)
To: axp-list
Michal Jaegermann wrote:
>
> >
> > The second is what I think larger system problem, as apparently
> > the codes in connection.c, and WaitFor.c assume select(2)
> > semantics with components of the fd_set's array to have size of
> > 32 bits
>
> >From what I see Xpoll.h header is broken in the first place.
> It overrides macros, like FD_ISSET, defined elsewhere in header
> files and does that in a manner which is incorrect on Alpha.
> Patches by Dave are of a "ho-hum" kind. "1L" happens to work at
> this moment but we have seen the same bug before on other occasions
> and there is a fd_set typedef to deal cleanly with the issue.
Yes I agree. What is the correct (as far as Posix?) place for
fd_set etc. ?
Incidentally I think you'll have a hard time convincing the X
guys that they should change one of their headers. There is a glaring
use of a #define where a typedef should be used in one of the
headers which can cause havoc; I mailed them about this
a few years ago and got a response which basically said that the
problem was known about since earlier systems (W?) and that
basically they can't change it now if they wanted to because
it had gone through standardisation mechanisms.
Dave
--
----------------------------------------------------------------------
- Dr. David Alan Gilbert - WARNING! This is a beta release .signature-
- Work: dg @ cogency.co.uk - +44-(0)161-428-9444 -
- Home: gro.gilbert @ treblig.org - -
----------------------------------------------------------------------
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: More X patches
1998-06-28 22:17 More X patches Matti Aarnio
1998-06-29 2:48 ` Michal Jaegermann
@ 1998-06-29 22:07 ` Richard Henderson
1 sibling, 0 replies; 9+ messages in thread
From: Richard Henderson @ 1998-06-29 22:07 UTC (permalink / raw)
To: Matti Aarnio, Dave Gilbert, dg; +Cc: axp-list
On Mon, Jun 29, 1998 at 01:17:41AM +0300, Matti Aarnio wrote:
> The second is what I think larger system problem, as apparently
> the codes in connection.c, and WaitFor.c assume select(2)
> semantics with components of the fd_set's array to have size of
> 32 bits (and hence that ffs() works always, and that magic "i << 5"
> type code is always correct..)
Which is interesting because XPG4.2 basically requires
typedef struct
{
unsigned long fds_bits[N];
} fd_set;
r~
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: More X patches
1998-06-29 12:35 ` David Alan Gilbert
@ 1998-06-29 23:06 ` Quant-X Alpha Linux Support
1998-06-29 23:20 ` Matti Aarnio
1998-06-29 23:23 ` Richard Henderson
2 siblings, 0 replies; 9+ messages in thread
From: Quant-X Alpha Linux Support @ 1998-06-29 23:06 UTC (permalink / raw)
To: axp-list
Hi David !
> Yes I agree. What is the correct (as far as Posix?) place for
> fd_set etc. ?
/dev/null. select is not defined in POSIX. ;-(
--
Quant-X Service & Ph: (+43) 4212 6004-0
Consulting Ges.m.b.H. Fax: (+43) 4212 600420
http://www.quant-x.com Email: support@quant-x.com
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: More X patches
1998-06-29 12:35 ` David Alan Gilbert
1998-06-29 23:06 ` Quant-X Alpha Linux Support
@ 1998-06-29 23:20 ` Matti Aarnio
1998-06-29 23:23 ` Richard Henderson
2 siblings, 0 replies; 9+ messages in thread
From: Matti Aarnio @ 1998-06-29 23:20 UTC (permalink / raw)
To: axp-list
....
> Yes I agree. What is the correct (as far as Posix?) place for
> fd_set etc. ?
>
> Incidentally I think you'll have a hard time convincing the X
> guys that they should change one of their headers. There is a glaring
> use of a #define where a typedef should be used in one of the
> headers which can cause havoc; I mailed them about this
> a few years ago and got a response which basically said that the
> problem was known about since earlier systems (W?) and that
> basically they can't change it now if they wanted to because
> it had gone through standardisation mechanisms.
Sure... Except I can't quite figure out why they can't use
<sys/select.h>
and its definitions of things as is:
--- xc/include/Xpoll.h~ Mon Dec 23 07:58:10 1996
+++ xc/include/Xpoll.h Mon Jun 29 18:56:23 1998
@@ -38,7 +38,7 @@
#ifndef USE_POLL
#include <X11/Xos.h>
-#if (defined(SVR4) || defined(CRAY) || defined(AIXV3)) && !defined(FD_SETSIZE)
+#if (defined(SVR4) || defined(CRAY) || defined(AIXV3) || defined(__linux)) && !defined(FD_SETSIZE)
#include <sys/select.h>
#ifdef luna
#include <sysent.h>
> Dave
> - Dr. David Alan Gilbert - WARNING! This is a beta release .signature-
> - Work: dg @ cogency.co.uk - +44-(0)161-428-9444 -
> - Home: gro.gilbert @ treblig.org - -
/Matti Aarnio <matti.aarnio@sonera.fi>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: More X patches
1998-06-29 12:35 ` David Alan Gilbert
1998-06-29 23:06 ` Quant-X Alpha Linux Support
1998-06-29 23:20 ` Matti Aarnio
@ 1998-06-29 23:23 ` Richard Henderson
1998-06-29 23:37 ` Matti Aarnio
2 siblings, 1 reply; 9+ messages in thread
From: Richard Henderson @ 1998-06-29 23:23 UTC (permalink / raw)
To: axp-list
On Mon, Jun 29, 1998 at 01:35:24PM +0100, David Alan Gilbert wrote:
> Yes I agree. What is the correct (as far as Posix?) place for
> fd_set etc. ?
POSIX doesn't. But afaik, XPG4 puts it in <sys/types.h>.
r~
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: More X patches
1998-06-29 23:23 ` Richard Henderson
@ 1998-06-29 23:37 ` Matti Aarnio
0 siblings, 0 replies; 9+ messages in thread
From: Matti Aarnio @ 1998-06-29 23:37 UTC (permalink / raw)
To: rth; +Cc: axp-list
> On Mon, Jun 29, 1998 at 01:35:24PM +0100, David Alan Gilbert wrote:
> > Yes I agree. What is the correct (as far as Posix?) place for
> > fd_set etc. ?
>
> POSIX doesn't. But afaik, XPG4 puts it in <sys/types.h>.
Oddly DEC OSF/1 (aka DEC UNIX) man-page tells to use
<sys/time.h>
header, while the man-page says: "Standards: XPG4-UNIX"
Still even DEC UNIX headers have fd_set in <sys/select.h>.
(And for some reason <sys/time.h> includes <sys/select.h> :-O )
(And <sys/types.h> includes it too, if you have _OSF_SOURCE defined.)
> r~
/Matti Aarnio <matti.aarnio@sonera.fi> (signing off for the night...)
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~1998-06-29 23:37 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1998-06-28 22:17 More X patches Matti Aarnio
1998-06-29 2:48 ` Michal Jaegermann
1998-06-29 12:35 ` David Alan Gilbert
1998-06-29 23:06 ` Quant-X Alpha Linux Support
1998-06-29 23:20 ` Matti Aarnio
1998-06-29 23:23 ` Richard Henderson
1998-06-29 23:37 ` Matti Aarnio
1998-06-29 22:07 ` Richard Henderson
-- strict thread matches above, loose matches on Subject: below --
1998-06-28 1:05 Dave Gilbert
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox