Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 5 Nov 1996 17:29:48 +1100
From:      Bruce Evans <bde@zeta.org.au>
To:        hasty@rah.star-gate.com, mtaylor@cybernet.com
Cc:        hackers@FreeBSD.org
Subject:   RE: Geomview, Mbone and FreeBSD...
Message-ID:  <199611050629.RAA16574@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>Already done.  I've submitted the patches to the Geometry Center.  They
>were developed with the help of one of their workers.

>...
>diff -c -r Geomview.orig/src/bin/geomview/x11/gvmain.c Geomview/src/bin/geomview
>/x11/gvmain.c
>*** Geomview.orig/src/bin/geomview/x11/gvmain.c	Thu Nov 17 18:45:03 1994
>--- Geomview/src/bin/geomview/x11/gvmain.c	Wed Jul 24 16:19:58 1996
>***************
>*** 10,18 ****
>  #ifdef __linux__
>  #include <fpu_control.h>
>  #endif
>! #ifdef __osf__
>  #include <sys/signal.h>
>  #endif
>  
>  /* xgv main - global variables */
>  /*****************************************************************************
>/
>--- 10,21 ----
>  #ifdef __linux__
>  #include <fpu_control.h>
>  #endif
>! #if defined(__osf__) || defined(__FreeBSD__)
>  #include <sys/signal.h>
>  #endif
>+ #ifdef __FreeBSD__
>+ #include <floatingpoint.h>
>+ #endif
>  
>  /* xgv main - global variables */
>  /*****************************************************************************
>/
>***************
>*** 40,46 ****
>    __setfpucw(_FPU_IEEE);
>  #endif
>  
>! #ifdef __osf__
>    signal(SIGFPE, SIG_IGN);	/* Ignore e.g. divide-by-zero traps */
>  #endif
>  
>--- 43,53 ----
>    __setfpucw(_FPU_IEEE);
>  #endif
>  
>! #ifdef __FreeBSD__
>!   fpsetmask(fpgetmask()&(~FP_X_DZ));
>! #endif
>! 
>! #if defined(__osf__) || defined(__FreeBSD__)
>    signal(SIGFPE, SIG_IGN);	/* Ignore e.g. divide-by-zero traps */
>  #endif

The fpsetmask() call should probably mask all floating point exceptions 
like the __setfpucw() call apparently does.

The signal stuff would then be unnecessary.  It is broken anyway.  Masking
SIGFPE is rarely correct and is never correct for FreeBSD on i386's since
it causes the following behaviour:
- if the signal is for integer division by zero, then the faulting
  division is restarted endlessly.
- if the signal is for a floating point exception, then the result will
  usually be wrong and the stack will usually pile up.  E.g., for 1/+0,
  where 1 is in %st(0) and +0 is in %st(1), the operands will be left
  on the stack and the result will be 1 (sort of) and +0 will remain as
  junk on the stack.

>diff -c -r Geomview.orig/src/lib/oogl/refcomm/streampool.c Geomview/src/lib/oogl
>/refcomm/streampool.c
>*** Geomview.orig/src/lib/oogl/refcomm/streampool.c	Sun Oct 16 19:11:55 1994
>--- Geomview/src/lib/oogl/refcomm/streampool.c	Thu Jul 11 22:39:50 1996
>***************
>*** 218,227 ****
>--- 218,235 ----
>      p->otype = PO_ALL;
>      p->next = NULL;
>      p->mode = rw;
>+ #ifndef __FreeBSD__
>      p->seekable = (p->inf && tell(fileno(p->inf)) != -1 &&
>+ #else
>+     p->seekable = (p->inf && ftell(p->inf) != -1 &&
>+ #endif

ftell() is ANSI standard, while tell() is nonstandard, so the "__FreeBSD__"
case should be the normal case.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199611050629.RAA16574>