Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 12 Feb 2000 16:18:16 +0100
From:      Juergen Lock <nox@jelal.kn-bremen.de>
To:        wine-patches@winehq.com, FreeBSD-emulation@FreeBSD.ORG
Subject:   get wine working again on FreeBSD, next round...
Message-ID:  <20000212161816.A50023@saturn.kn-bremen.de>

next in thread | raw e-mail | index | archive | help
Changelog:

	* misc/cdrom.c: Juergen Lock <nox@jelal.kn-bremen.de>
	fix CDROM_Audio_Seek for non-linux systems (well, make it
	compile...  at least FreeBSD doesn't have a CD audio seek
	ioctl so in order to not lose the end position of the original
	play command wine would have to save it internally)
	* configure.in, configure, include/config.h.in, server/request.c,
	scheduler/client.c: Juergen Lock <nox@jelal.kn-bremen.de>
	proper fix (i hope :) for the unix domain sockaddr length
	problem, it needs a configure check to work everywhere

 I also saw a reference for the second one:

	W. R. Stevens "Advanced Programming in the Unix Environment" p. 502

Index: misc/cdrom.c
===================================================================
RCS file: /home/wine/wine/misc/cdrom.c,v
retrieving revision 1.10
diff -u -u -r1.10 cdrom.c
--- misc/cdrom.c	2000/02/10 19:39:50	1.10
+++ misc/cdrom.c	2000/02/12 14:58:19
@@ -501,7 +501,7 @@
     * use end of CD ROM instead
     */
    FIXME("Could a BSD expert implement the seek function ?\n");
-   CDAUDIO_Play(wcda, at, wcda->lpdwTrackPos[wcda->nTracks] + wcda->lpdwTrackLen[wcda->nTracks]);
+   CDROM_Audio_Play(wcda, at, wcda->lpdwTrackPos[wcda->nTracks] + wcda->lpdwTrackLen[wcda->nTracks]);
    
 #endif
     return ret;
Index: configure.in
===================================================================
RCS file: /home/wine/wine/configure.in,v
retrieving revision 1.97
diff -u -u -r1.97 configure.in
--- configure.in	2000/02/07 16:26:56	1.97
+++ configure.in	2000/02/12 14:57:57
@@ -891,6 +891,18 @@
     AC_DEFINE(HAVE_MSGHDR_ACCRIGHTS)
 fi
 
+dnl *** Check for the sun_len member in struct sockaddr_un
+
+AC_CACHE_CHECK("for sun_len in struct sockaddr_un", ac_cv_c_sun_len,
+ AC_TRY_COMPILE([#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/un.h>], [static struct sockaddr_un addr; addr.sun_len = 1],
+                ac_cv_c_sun_len="yes", ac_cv_c_sun_len="no"))
+if test "$ac_cv_c_sun_len" = "yes"
+then
+    AC_DEFINE(HAVE_SOCKADDR_SUN_LEN)
+fi
+
 dnl *** check for the need to define __i386__
 
 AC_CACHE_CHECK("whether we need to define __i386__",ac_cv_cpp_def_i386,
Index: configure
===================================================================
RCS file: /home/wine/wine/configure,v
retrieving revision 1.97
diff -u -u -r1.97 configure
--- configure	2000/02/07 16:26:56	1.97
+++ configure	2000/02/12 14:57:56
@@ -5987,13 +5987,50 @@
 fi
 
 
+echo $ac_n "checking "for sun_len in struct sockaddr_un"""... $ac_c" 1>&6
+echo "configure:5992: checking "for sun_len in struct sockaddr_un"" >&5
+if eval "test \"`echo '$''{'ac_cv_c_sun_len'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 5997 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+int main() {
+static struct sockaddr_un addr; addr.sun_len = 1
+; return 0; }
+EOF
+if { (eval echo configure:6006: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_c_sun_len="yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_c_sun_len="no"
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_c_sun_len" 1>&6
+if test "$ac_cv_c_sun_len" = "yes"
+then
+    cat >> confdefs.h <<\EOF
+#define HAVE_SOCKADDR_SUN_LEN 1
+EOF
+
+fi
+
+
 echo $ac_n "checking "whether we need to define __i386__"""... $ac_c" 1>&6
-echo "configure:5992: checking "whether we need to define __i386__"" >&5
+echo "configure:6029: checking "whether we need to define __i386__"" >&5
 if eval "test \"`echo '$''{'ac_cv_cpp_def_i386'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5997 "configure"
+#line 6034 "configure"
 #include "confdefs.h"
 #if (defined(i386) || defined(__i386)) && !defined(__i386__)
 yes
Index: include/config.h.in
===================================================================
RCS file: /home/wine/wine/include/config.h.in,v
retrieving revision 1.39
diff -u -u -r1.39 config.h.in
--- include/config.h.in	2000/01/30 22:22:23	1.39
+++ include/config.h.in	2000/02/12 14:58:14
@@ -53,6 +53,9 @@
 /* Define if struct msghdr contains msg_accrights */
 #undef HAVE_MSGHDR_ACCRIGHTS
 
+/* Define if struct sockaddr_un has the member sun_len */
+#undef HAVE_SOCKADDR_SUN_LEN
+
 /* Define if you have the Xxf86dga library (-lXxf86dga).  */
 #undef HAVE_LIBXXF86DGA
 
Index: scheduler/client.c
===================================================================
RCS file: /home/wine/wine/scheduler/client.c,v
retrieving revision 1.36
diff -u -u -r1.36 client.c
--- scheduler/client.c	2000/01/25 21:19:58	1.36
+++ scheduler/client.c	2000/02/12 14:58:27
@@ -340,7 +346,7 @@
 {
     struct sockaddr_un addr;
     struct stat st;
-    int s;
+    int s, slen;
 
     if (chdir( serverdir ) == -1)
     {
@@ -366,7 +372,14 @@
     if ((s = socket( AF_UNIX, SOCK_STREAM, 0 )) == -1) fatal_perror( "socket" );
     addr.sun_family = AF_UNIX;
     strcpy( addr.sun_path, SOCKETNAME );
-    if (connect( s, &addr, sizeof(addr.sun_family) + strlen(addr.sun_path) ) == -1)
+#ifdef HAVE_SOCKADDR_SUN_LEN
+    slen = (sizeof (addr.sun_len) + sizeof (addr.sun_family)
+	    + strlen (addr.sun_path) + 1);
+    addr.sun_len = slen;
+#else
+    slen = strlen (addr.sun_path) + sizeof (addr.sun_family);
+#endif
+    if (connect( s, (struct sockaddr *)&addr, slen ) == -1)
     {
         close( s );
         return -2;
Index: server/request.c
===================================================================
RCS file: /home/wine/wine/server/request.c,v
retrieving revision 1.26
diff -u -u -r1.26 request.c
--- server/request.c	2000/01/25 01:40:27	1.26
+++ server/request.c	2000/02/12 14:58:27
@@ -345,13 +351,20 @@
 void open_master_socket(void)
 {
     struct sockaddr_un addr;
-    int fd;
+    int fd, slen;
 
     create_server_dir();
     if ((fd = socket( AF_UNIX, SOCK_STREAM, 0 )) == -1) fatal_perror( "socket" );
     addr.sun_family = AF_UNIX;
-    strcpy( addr.sun_path, "socket" );
-    if (bind( fd, &addr, sizeof(addr.sun_family) + strlen(addr.sun_path) ) == -1)
+    strcpy( addr.sun_path, SOCKETNAME );
+#ifdef HAVE_SOCKADDR_SUN_LEN
+    slen = (sizeof (addr.sun_len) + sizeof (addr.sun_family)
+	    + strlen (addr.sun_path) + 1);
+    addr.sun_len = slen;
+#else
+    slen = strlen (addr.sun_path) + sizeof (addr.sun_family);
+#endif
+    if (bind( fd, (struct sockaddr *)&addr, slen ) == -1)
     {
         if ((errno == EEXIST) || (errno == EADDRINUSE))
             fatal_error( "another server is already running\n" );
@@ -360,7 +373,7 @@
     }
     atexit( socket_cleanup );
 
-    chmod( "socket", 0600 );  /* make sure no other user can connect */
+    chmod( SOCKETNAME, 0600 );  /* make sure no other user can connect */
     if (listen( fd, 5 ) == -1) fatal_perror( "listen" );
 
     if (!(master_socket = alloc_object( &master_socket_ops, fd )))

 Regards,
-- 
Juergen Lock <nox.foo@jelal.kn-bremen.de>
(remove dot foo from address to reply)


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-emulation" in the body of the message




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