Subject: COMPAT_SUNOS and DEVZERO
To: None <deraadt@fsa.ca, glass@sun-lamp.cs.berkeley.edu>
From: Gordon W. Ross <gwr@jericho.mc.com>
List: tech-kern
Date: 04/25/1994 17:58:48
Here is a change I propose to make sure the COMPAT_SUNOS sun_mmap()
system call works regardless of what device node /dev/zero is given
in the <arch>/conf.c file. The basic idea is to define a variable
in the conf.c file and make compat/sunos/sun_misc.c use it.
This change would affect all architectures that use the COMPAT_SUNOS
option, which currently includes: amiga, mac68k, sparc, and sun3.
The diffs attached below implement the proposed change.
The conf.c file seems to me like the best place to define DEVZERO
because that is where the needed information is certain to be known.
What do you think of the idea?
Gordon Ross
*** compat/sunos/sun_misc.c.orig Mon Apr 25 16:37:54 1994
--- compat/sunos/sun_misc.c Mon Apr 25 16:43:44 1994
***************
*** 404,414 ****
return (error);
}
! #if defined(sparc)
! #define DEVZERO makedev(3, 12) /* major,minor of /dev/zero */
! #else /* all m68k architectures */
! #define DEVZERO makedev(2, 12) /* major,minor of /dev/zero */
! #endif
#define SUN__MAP_NEW 0x80000000 /* if not, old mmap & cannot handle */
--- 404,412 ----
return (error);
}
! /* This is defined in each <arch>/conf.c file. */
! extern dev_t devzero_dev;
! #define DEVZERO devzero_dev
#define SUN__MAP_NEW 0x80000000 /* if not, old mmap & cannot handle */
*** arch/sun3/sun3/conf.c.orig Tue Mar 1 06:21:50 1994
--- arch/sun3/sun3/conf.c Mon Apr 25 17:53:38 1994
***************
*** 255,261 ****
--- 255,267 ----
int nchrdev = sizeof (cdevsw) / sizeof (cdevsw[0]);
+ /* I'd like to change this to 3 for SunOS 4.1.1 compatibility. -gwr */
int mem_no = 2; /* major device number of memory special file */
+
+ #ifdef COMPAT_SUNOS
+ /* This is used by compat/sunos/sun_misc.c */
+ dev_t devzero_dev = makedev(2, 12) /* major,minor of /dev/zero */
+ #endif
/*
* Swapdev is a fake device implemented
*** arch/sparc/sparc/conf.c.orig Thu Mar 3 05:57:16 1994
--- arch/sparc/sparc/conf.c Mon Apr 25 17:47:43 1994
***************
*** 431,436 ****
--- 431,441 ----
int mem_no = 3; /* major device number of memory special file */
+ #ifdef COMPAT_SUNOS
+ /* This is used by compat/sunos/sun_misc.c */
+ dev_t devzero_dev = makedev(3, 12) /* major,minor of /dev/zero */
+ #endif
+
/*
* Swapdev is a fake device implemented
* in sw.c used only internally to get to swstrategy.
*** arch/amiga/amiga/conf.c.orig Wed Apr 6 06:16:01 1994
--- arch/amiga/amiga/conf.c Mon Apr 25 17:48:22 1994
***************
*** 417,422 ****
--- 417,427 ----
int mem_no = 2; /* major device number of memory special file */
+ #ifdef COMPAT_SUNOS
+ /* This is used by compat/sunos/sun_misc.c */
+ dev_t devzero_dev = makedev(2, 12) /* major,minor of /dev/zero */
+ #endif
+
/*
* Swapdev is a fake device implemented
* in sw.c used only internally to get to swstrategy.
*** arch/mac68k/mac68k/conf.c.orig Fri Feb 4 05:11:27 1994
--- arch/mac68k/mac68k/conf.c Mon Apr 25 17:49:38 1994
***************
*** 364,369 ****
--- 364,374 ----
int mem_no = 2; /* major device number of memory special file */
+ #ifdef COMPAT_SUNOS
+ /* This is used by compat/sunos/sun_misc.c */
+ dev_t devzero_dev = makedev(2, 12) /* major,minor of /dev/zero */
+ #endif
+
/*
* Swapdev is a fake device implemented
* in sw.c used only internally to get to swstrategy.
------------------------------------------------------------------------------