NetBSD MAP_FIXED mmap patch

Bang Jun-Young junyoung at mogua.com
Thu Dec 13 10:29:00 CST 2001


	* configure, configure.in, include/config.h.in:
	Bang Jun-Young <junyoung at mogua.com>
	Add check for stdint.h (needed on NetBSD).

	* library/port.c:
	Bang Jun-Young <junyoung at mogua.com>
	Make use of solaris_try_mmap() for NetBSD. Rename it
	to try_mmap_fixed() since it's no longer Solaris-specific.

-- 
Bang Jun-Young <junyoung at mogua.com>

-------------- next part --------------
Index: configure
===================================================================
RCS file: /home/wine/wine/configure,v
retrieving revision 1.237
diff -u -r1.237 configure
--- configure	2001/11/23 23:04:58	1.237
+++ configure	2001/12/13 14:40:07
@@ -5951,6 +5951,7 @@
 	resolv.h \
 	sched.h \
 	socket.h \
+	stdint.h \
 	strings.h \
 	sys/cdio.h \
 	sys/errno.h \
@@ -5985,17 +5986,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5989: checking for $ac_hdr" >&5
+echo "configure:5990: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5994 "configure"
+#line 5995 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5999: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6000: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -6022,12 +6023,12 @@
 done
 
 echo $ac_n "checking whether stat file-mode macros are broken""... $ac_c" 1>&6
-echo "configure:6026: checking whether stat file-mode macros are broken" >&5
+echo "configure:6027: checking whether stat file-mode macros are broken" >&5
 if eval "test \"`echo '$''{'ac_cv_header_stat_broken'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6031 "configure"
+#line 6032 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -6080,12 +6081,12 @@
 
 
 echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:6084: checking for working const" >&5
+echo "configure:6085: checking for working const" >&5
 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6089 "configure"
+#line 6090 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -6134,7 +6135,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:6138: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6139: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_const=yes
 else
@@ -6155,21 +6156,21 @@
 fi
 
 echo $ac_n "checking for inline""... $ac_c" 1>&6
-echo "configure:6159: checking for inline" >&5
+echo "configure:6160: checking for inline" >&5
 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_cv_c_inline=no
 for ac_kw in inline __inline__ __inline; do
   cat > conftest.$ac_ext <<EOF
-#line 6166 "configure"
+#line 6167 "configure"
 #include "confdefs.h"
 
 int main() {
 } $ac_kw foo() {
 ; return 0; }
 EOF
-if { (eval echo configure:6173: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6174: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_inline=$ac_kw; break
 else
@@ -6195,12 +6196,12 @@
 esac
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:6199: checking for ANSI C header files" >&5
+echo "configure:6200: checking for ANSI C header files" >&5
 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6204 "configure"
+#line 6205 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -6208,7 +6209,7 @@
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6212: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6213: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -6225,7 +6226,7 @@
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 6229 "configure"
+#line 6230 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -6243,7 +6244,7 @@
 if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 6247 "configure"
+#line 6248 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -6264,7 +6265,7 @@
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 6268 "configure"
+#line 6269 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -6275,7 +6276,7 @@
 exit (0); }
 
 EOF
-if { (eval echo configure:6279: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6280: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -6299,12 +6300,12 @@
 fi
 
 echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:6303: checking for size_t" >&5
+echo "configure:6304: checking for size_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6308 "configure"
+#line 6309 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -6332,7 +6333,7 @@
 fi
 
 echo $ac_n "checking size of long long""... $ac_c" 1>&6
-echo "configure:6336: checking size of long long" >&5
+echo "configure:6337: checking size of long long" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_long_long'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -6340,10 +6341,9 @@
   ac_cv_sizeof_long_long=0
 else
   cat > conftest.$ac_ext <<EOF
-#line 6344 "configure"
+#line 6345 "configure"
 #include "confdefs.h"
 #include <stdio.h>
-#include <sys/types.h>
 main()
 {
   FILE *f=fopen("conftestval", "w");
Index: configure.in
===================================================================
RCS file: /home/wine/wine/configure.in,v
retrieving revision 1.237
diff -u -r1.237 configure.in
--- configure.in	2001/11/23 23:04:59	1.237
+++ configure.in	2001/12/13 14:40:12
@@ -873,6 +873,7 @@
 	resolv.h \
 	sched.h \
 	socket.h \
+	stdint.h \
 	strings.h \
 	sys/cdio.h \
 	sys/errno.h \
Index: include/config.h.in
===================================================================
RCS file: /home/wine/wine/include/config.h.in,v
retrieving revision 1.91
diff -u -r1.91 config.h.in
--- include/config.h.in	2001/11/06 20:57:19	1.91
+++ include/config.h.in	2001/12/13 14:40:23
@@ -313,6 +313,9 @@
 /* Define if you have the <soundcard.h> header file.  */
 #undef HAVE_SOUNDCARD_H
 
+/* Define if you have the <stdint.h> header file.  */
+#undef HAVE_STDINT_H
+
 /* Define if you have the <strings.h> header file.  */
 #undef HAVE_STRINGS_H
 
Index: library/port.c
===================================================================
RCS file: /home/wine/wine/library/port.c,v
retrieving revision 1.19
diff -u -r1.19 port.c
--- library/port.c	2001/11/06 20:57:22	1.19
+++ library/port.c	2001/12/13 14:40:27
@@ -40,7 +40,9 @@
 #ifdef HAVE_LIBUTIL_H
 # include <libutil.h>
 #endif
-
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
 
 /***********************************************************************
  *		usleep
@@ -397,9 +399,9 @@
 #endif /* HAVE_GETRLIMIT */
 
 
-#ifdef __svr4__
+#if defined(__svr4__) || defined(__NetBSD__)
 /***********************************************************************
- *             solaris_try_mmap
+ *             try_mmap_fixed
  *
  * The purpose of this routine is to emulate the behaviour of
  * the Linux mmap() routine if a non-NULL address is passed,
@@ -415,8 +417,8 @@
  * address range is still available, and placing the mapping there
  * using MAP_FIXED if so.
  */
-static int solaris_try_mmap (void *addr, size_t len, int prot, int flags,
-                            int fildes, off_t off)
+static int try_mmap_fixed (void *addr, size_t len, int prot, int flags,
+                           int fildes, off_t off)
 {
     char * volatile result = NULL;
     int pagesize = getpagesize();
@@ -442,7 +444,7 @@
 
     if ( (pid = vfork()) == -1 )
     {
-        perror("solaris_try_mmap: vfork");
+        perror("try_mmap_fixed: vfork");
         exit(1);
     }
     if ( pid == 0 )
@@ -508,8 +510,8 @@
     flags |= MAP_PRIVATE;
 #endif
 
-#ifdef __svr4__
-    if ( solaris_try_mmap( start, size, prot, flags, fdzero, 0 ) )
+#if defined(__svr4__) || defined(__NetBSD__)
+    if ( try_mmap_fixed( start, size, prot, flags, fdzero, 0 ) )
         return start;
 #endif
 


More information about the wine-patches mailing list