[comp.sources.bugs] MGR installation

markv@uoregon.uoregon.edu (Mark VandeWettering) (01/28/89)

In article <484@ubc-cs.UUCP> majka@moose.cs.ubc.ca () writes:

>1:  sys/kbd.c has this silly line (line 23):
>    #   include "<sys/termios.h>"
>    This should probably be:
>    #include <sys/termios.h>

	I think this is an difference between the compilers under SUNOS4
	and the older versions.  See the caveats below.

>2:  There is supposed to be a file called doc/usrman.out
>    It doesn't exist.  I made an empty one to get make over it,
>    assuming that mgr would run without whatever this document
>    is supposed to be.

	Yeah, I did something similar.

>Some of them do look ignorable, but there are mysterious things
>which look more serious.  e.g.: "mv mgr _mgr" fails because the
>file mgr doesn't exist.  "ln mgr mgr" also fails.

	The makefiles in MGR are atrocious.  Whoever designed them....
	AGH!  I think I am going to totally redo them.  Whenever you
	touch a C file, it really wants to remake the whole
	distribution.  Kind of defeats the purpose of the thing doesn't
	it?

>Thus, even though I got make to run all the way through, mgr was
>probably in a bad state.  This seemed to be indicated further by
>the fact that running mgr causes a segmentation fault.  It will
>run with -v or -V and print version information, but otherwise it
>dies without touching the screen. 
	
	MGR also coredumps on me, with a similar system (SUN 3/60 with
	SUNOS4).  The coredump appears in mem_rop, in the blitlib
	library.  I managed to build the version that uses pixrect, but
	it too has problems (doesn't notice font changes)

>Has anyone out there got fixes for mgr?  I would like to try it 
>out (as, I am sure, do many others on the net).  An informed 
>posting to the net would be reasonable at this point.  Email to
>me would be appreciated, but perhaps less helpful to other lost
>soles.  

>BTW, I tried putting mgr on a SUN 3, running SunOS 4.0.  I don't
>believe this is an oddball system.

	One thing I noticed is there is code in mgr.c and copyright.c
	that assume 4.2 type "select" calls, where the mask is an
	integer.  PLEASE folks, take the time to upgrade this to 4.3ish
	standards.  Under SUNOS4, it just doesn't work anymore! 


>---
>Marc Majka  -  System Manager  UBC Computer Science
><majka@cs.ubc.ca>
>---
	
	I hope this might save someone else some time, keep me posted if
	anyone has fixes for SUNOS4.

rob@violet.berkeley.edu (Rob Robertson) (01/28/89)

In article <3647@uoregon.uoregon.edu> markv@drizzle.UUCP (Mark VandeWettering) writes:
>	
>	MGR also coredumps on me, with a similar system (SUN 3/60 with
>	SUNOS4).  The coredump appears in mem_rop, in the blitlib
>	library.  I managed to build the version that uses pixrect, but
>	it too has problems (doesn't notice font changes)
>

The fix is that SUN changed the mmap() call between 3.X and 4.0.
Besides the new semantics, it now gives you exactly what you ask of
it.  Under 3.X when one specified PROT_WRITE (ie I wanna write on
these pages), the kernel also gave you read access.  Under 4.0 it
don't, and any attempt to read core dumps.  

A coworker found the problem (thanks Bob!).  The patch below fixes the
problem, along with several others.  They should at least get the
system up under 4.0.

All in all I think that MGR (or MunGeR as it has been affectionately
dubbed) is pretty nifty.  Nice, small, and easy to work in.  Next best
thing to a Blit.

Maybe it'll make SunOS 4.0 bearable on a 3/50.

rob
				william robertson
				rob@violet.berkeley.edu

diff -c kbd.c.orig kbd.c
*** kbd.c.orig  Tue Jan 24 12:12:35 1989
--- kbd.c       Fri Jan 27 16:52:21 1989
***************
*** 20,26 ****
  # include <sys/types.h>
  # include <sundev/kbio.h>
  # ifndef TIOCCONS                                     /* definiton moved in rel. 4.0 */
! #   include "<sys/termios.h>"
  # endif
  #endif KBD
  #endif
--- 20,26 ----
  # include <sys/types.h>
  # include <sundev/kbio.h>
  # ifndef TIOCCONS                                     /* definiton moved in rel. 4.0 */
! #   include <sys/termios.h>
  # endif
  #endif KBD
  #endif

diff -c blit/bitmap.c.orig blit/bitmap.c
*** blit/bitmap.c.orig  Thu Jan 26 22:18:10 1989
--- blit/bitmap.c       Thu Jan 26 22:22:48 1989
***************
*** 66,76 ****

  #ifdef _MAP_NEW               /* New semantics for mmap in Sun release 4.0 */
     addr = (DATA) mmap(addr, _s_len=buff.fb_size,
!                                                PROT_WRITE, _MAP_NEW|MAP_SHARED, fd, 0);
     if ((int)addr == -1)
        return (BIT_NULL);
  #else
!    if (mmap(addr, _s_len = buff.fb_size, PROT_WRITE, MAP_SHARED, fd, 0) < 0)
        return (BIT_NULL);
  #endif

--- 66,76 ----

  #ifdef _MAP_NEW               /* New semantics for mmap in Sun release 4.0 */
     addr = (DATA) mmap(addr, _s_len=buff.fb_size,
!                                                PROT_WRITE|PROT_READ, _MAP_NEW|MAP_SHARED,
fd, 0);
     if ((int)addr == -1)
        return (BIT_NULL);
  #else
!    if (mmap(addr, _s_len = buff.fb_size, PROT_WRITE|PROT_READ, MAP_SHARED, fd, 0) < 0)
        return (BIT_NULL);
  #endif

diff -c blit/sym.c.orig blit/sym.c
*** blit/sym.c.orig     Fri Jan 27 16:53:38 1989
--- blit/sym.c  Fri Jan 27 16:54:02 1989
***************
*** 158,163 ****
  is_reg(name)
  char *name;
     {
!    return( (name[0]=='d' || name[1] == 'a') &&
             (name[1] >= '0' && name[1] <= '7'));
     }
--- 158,163 ----
  is_reg(name)
  char *name;
     {
!    return( (name[0]=='d' || name[0] == 'a') &&
             (name[1] >= '0' && name[1] <= '7'));
     }
				william robertson
				rob@violet.berkeley.edu

guy@auspex.UUCP (Guy Harris) (01/28/89)

 >>1:  sys/kbd.c has this silly line (line 23):
 >>    #   include "<sys/termios.h>"
 >>    This should probably be:
 >>    #include <sys/termios.h>
 >
 >	I think this is an difference between the compilers under SUNOS4
 >	and the older versions.  See the caveats below.

The line in question is silly under every UNIX C compiler I know of.  I
would expect *all* UNIX C compilers to interpret

	#include "<sys/termios.h>"

as a request to include the file whose name is, literally

	<sys/termios.h>

i.e., look for a directory named "<sys" (complete with "<") in the
standard include directories and the current directory, and look for a
file in that directory named "termios.h>" (complete with ">").  I can't
believe a line with that syntax would have compiled on *any* UNIX C
implementation, unless it had a "<sys" directory with a "termios.h>"
file in it (or there were such a directory in the MGR source).

In any case, the line should be

	#include <sys/termios.h>

everywhere.

BTW, even

	#include <sys/termios.h>

wouldn't have worked under *any* pre-4.0 system; <sys/termios.h> didn't
*exist* in Sunos prior to 4.0. 

>	One thing I noticed is there is code in mgr.c and copyright.c
>	that assume 4.2 type "select" calls, where the mask is an
>	integer.  PLEASE folks, take the time to upgrade this to 4.3ish
>	standards.  Under SUNOS4, it just doesn't work anymore! 

Actually, you *can* make it work with an integer mask; just don't use
"getdtablesize".  If you switch to the "fd_set" stuff, in its full
shining glory, it may not compile under 4.2BSD-derived systems
(including SunOS 3.x) any more, so either #ifdef it or use the 4.2BSD
scheme but with a file descriptor count <= 32.