Subject: Xserver: Add support for Sun3 running NetBSD-1.0
To: None <xbugs@x.org>
From: Gordon W. Ross <gwr@mc.com>
List: port-sun3
Date: 05/30/1995 18:14:32
     VERSION:

R6, public-patch-11

     CLIENT MACHINE and OPERATING SYSTEM:

Sun3 / NetBSD-1.0

     DISPLAY TYPE:

Sun bwtwo, cgtwo, cgfour

     WINDOW MANAGER:

twm (any)

     COMPILER:

native cc

     AREA:

Xserver

     SYNOPSIS:

Add support for Sun3 running NetBSD-1.0

     DESCRIPTION:

This is an enhancement to allow the Xsun and XsunMono servers
to be built for a Sun3 running NetBSD-1.0 (or later).

     REPEAT BY:

cd $TOP ; make World

     SAMPLE FIX:

Correct the pathname for cg2reg.h on NetBSD/sun3;
No need to call valloc() before mmap() on any NetBSD;
Fix a variable name that appears to have been missed
when someone renamed kbdFd or something.

Files affected: (under xc/programs/Xserver)
 hw/sun/sunCfb.c
 hw/sun/sunFbs.c
 hw/sun/sunInit.c

*** hw/sun/sunCfb.c.save	Wed Mar 15 16:16:33 1995
--- hw/sun/sunCfb.c	Tue May 30 17:42:09 1995
***************
*** 1,5 ****
--- 1,6 ----
  
  /* $XConsortium: sunCfb.c,v 1.15.1.2 95/01/12 18:54:42 kaleb Exp $ */
+ /* Sun3/NetBSD-1.0 <gwr@netbsd.org> */
  
  /*
  Copyright (c) 1990  X Consortium
***************
*** 268,281 ****
  #ifndef i386 /* { */
  
  #ifdef SVR4
! #include <sys/cg2reg.h>
! #else
! #ifndef __NetBSD__
! #include <pixrect/cg2reg.h>
! #else
! #include <machine/cgtworeg.h>
! #endif
! #endif
  
  typedef struct {
      struct cg2memfb	mem;
--- 269,286 ----
  #ifndef i386 /* { */
  
  #ifdef SVR4
! # include <sys/cg2reg.h>
! #else	/* SVR4 */
! # ifndef __NetBSD__
! #  include <pixrect/cg2reg.h>
! # else	/* __NetBSD__ */
! #  ifdef	__sparc__
! #   include <machine/cgtworeg.h>
! #  else
! #   include <machine/cg2reg.h>
! #  endif
! # endif /* __NetBSD__ */
! #endif	/* SVR4 */
  
  typedef struct {
      struct cg2memfb	mem;

*** hw/sun/sunFbs.c.save	Wed Mar 15 15:46:25 1995
--- hw/sun/sunFbs.c	Tue May 30 17:42:18 1995
***************
*** 1,5 ****
--- 1,6 ----
  
  /* $XConsortium: sunFbs.c,v 1.8 94/08/16 13:45:30 dpw Exp $ */
+ /* Sun3/NetBSD-1.0 <gwr@netbsd.org> */
  
  /*
  Copyright (c) 1990, 1993  X Consortium
***************
*** 103,109 ****
      mapsize = ((int) len + pagemask) & ~pagemask;
      addr = 0;
  
! #ifndef _MAP_NEW
      if ((addr = (caddr_t) valloc (mapsize)) == NULL) {
  	Error ("Couldn't allocate frame buffer memory");
  	(void) close (fd);
--- 104,110 ----
      mapsize = ((int) len + pagemask) & ~pagemask;
      addr = 0;
  
! #if !defined(_MAP_NEW) && !defined(__NetBSD__)
      if ((addr = (caddr_t) valloc (mapsize)) == NULL) {
  	Error ("Couldn't allocate frame buffer memory");
  	(void) close (fd);

*** hw/sun/sunInit.c.save	Wed Mar 15 16:16:33 1995
--- hw/sun/sunInit.c	Tue May 30 17:42:27 1995
***************
*** 1,4 ****
--- 1,5 ----
  /* $XConsortium: sunInit.c,v 5.54 94/12/23 16:49:38 kaleb Exp $ */
+ /* Sun3/NetBSD-1.0 <gwr@netbsd.org> */
  /*
   * sunInit.c --
   *	Initialization functions for screen/keyboard/mouse, etc.
***************
*** 463,469 ****
  	    key.kio_station = 118;
  	    if (ioctl(sunKbdPriv.fd, KIOCGETKEY, &key) == -1) {
  		Error( "ioctl KIOCGETKEY" );
! 		FatalError("Can't KIOCGETKEY on fd %d\n", kbdFd);
  	    }
  	    if (key.kio_entry != HOLE)
  		sunKbdPriv.type = KB_SUN4;
--- 464,470 ----
  	    key.kio_station = 118;
  	    if (ioctl(sunKbdPriv.fd, KIOCGETKEY, &key) == -1) {
  		Error( "ioctl KIOCGETKEY" );
! 		FatalError("Can't KIOCGETKEY on fd %d\n", sunKbdPriv.fd);
  	    }
  	    if (key.kio_entry != HOLE)
  		sunKbdPriv.type = KB_SUN4;