pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

doomlegacy-devel: More SunOS patches



Module Name:	pkgsrc-wip
Committed By:	Michael Baeuerle <micha%NetBSD.org@localhost>
Pushed By:	micha
Date:		Tue Jun 16 18:04:32 2020 +0200
Changeset:	4ada97bcbf203be00c2a390dab081d359136e760

Modified Files:
	doomlegacy-devel/Makefile
	doomlegacy-devel/TODO
	doomlegacy-devel/distinfo
	doomlegacy-devel/patches/patch-src_mserv.c

Log Message:
doomlegacy-devel: More SunOS patches

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=4ada97bcbf203be00c2a390dab081d359136e760

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 doomlegacy-devel/Makefile                  |  1 +
 doomlegacy-devel/TODO                      | 11 ++++++++
 doomlegacy-devel/distinfo                  |  2 +-
 doomlegacy-devel/patches/patch-src_mserv.c | 45 +++++++++++++++++++++++++++---
 4 files changed, 54 insertions(+), 5 deletions(-)

diffs:
diff --git a/doomlegacy-devel/Makefile b/doomlegacy-devel/Makefile
index 90aaa8f7b0..137c3cca9d 100644
--- a/doomlegacy-devel/Makefile
+++ b/doomlegacy-devel/Makefile
@@ -44,6 +44,7 @@ MAKE_FLAGS+=		OS=MAC
 # Other Unix (should work for GNU/Linux, OpenBSD and SunOS)
 MAKE_FLAGS+=		OS=LINUX
 CFLAGS.SunOS+=		-DSOLARIS
+LDFLAGS.SunOS+=		-lresolv
 .endif
 
 .if ${MACHINE_ENDIAN} == "big"
diff --git a/doomlegacy-devel/TODO b/doomlegacy-devel/TODO
index a57efcc8e7..c48b8f76fd 100644
--- a/doomlegacy-devel/TODO
+++ b/doomlegacy-devel/TODO
@@ -45,5 +45,16 @@ Just a cosmetic problem.
 [X] Created upstream bug report #663
 
 
+Part 11: Resurrect SunOS codepath
+=================================
+[X] Explicitly define SOLARIS for all SunOS-based operating systems
+    Required at least for SmartOS
+[X] Do not use label_t
+    Comment out declaration of unused function with return value of that type
+[X] Use native inet_aton()
+    Located in libresolv on SunOS
+[X] Use fcntl() instead of ioctl() to enable non-blocking mode of socket
+    Should be usable for all POSIX conformant operating systems
+
 
 EOF
diff --git a/doomlegacy-devel/distinfo b/doomlegacy-devel/distinfo
index 6ffc1b7884..067a9bb23a 100644
--- a/doomlegacy-devel/distinfo
+++ b/doomlegacy-devel/distinfo
@@ -8,7 +8,7 @@ SHA1 (patch-src_Makefile) = 40184838a23e00975a5380f18c8c53b3cc2eee47
 SHA1 (patch-src_am__map.c) = 14b3c8b70c63778ad043827ab2f0b6f4fe07bcde
 SHA1 (patch-src_doomdata.h) = 8c3186dafbf11a8a75262a06755dd9807cb58612
 SHA1 (patch-src_dstrings.c) = a654c47792800dc6547f5819ef4f5850803b2ca3
-SHA1 (patch-src_mserv.c) = cf90e57287523cc1d27c44a575008b078b195522
+SHA1 (patch-src_mserv.c) = 685ca5028740428ef2579025ca8673d8da526ebe
 SHA1 (patch-src_p__local.h) = 0340c38a80ba4323e4fe7a8c314575a70a246708
 SHA1 (patch-src_p__setup.c) = 3690d253d07a772eeab87f658ebc5cb61ecc000c
 SHA1 (patch-src_r__defs.h) = 91e6543674e3474c9afdb0ba19d6869b658d0543
diff --git a/doomlegacy-devel/patches/patch-src_mserv.c b/doomlegacy-devel/patches/patch-src_mserv.c
index 0b931474a9..57650689bb 100644
--- a/doomlegacy-devel/patches/patch-src_mserv.c
+++ b/doomlegacy-devel/patches/patch-src_mserv.c
@@ -1,17 +1,54 @@
-$NetBSD: patch-src_mserv.c,v 1.1 2020/06/15 10:32:52 micha Exp $
+$NetBSD$
 
 Use native inet_aton() on Solaris.
+Use portable fcntl() instead of ioctl() for non-blocking mode by default.
 
---- src/mserv.c.orig	2020-05-10 22:05:17.000000000 +0000
+--- src/mserv.c.orig	2020-06-16 09:17:35.000000000 +0000
 +++ src/mserv.c
-@@ -210,7 +210,9 @@ struct Copy_CVarMS_t
+@@ -122,12 +122,13 @@
+ #else
+ # include <unistd.h>
+ # ifdef __OS2__
+-#  include <sys/types.h>
++#  include <sys/types.h>  // [MB] 2020-06-16: Maybe required for old Unix too
+ # endif
+ # include <sys/socket.h>  // socket(),...
+ # include <sys/time.h>    // timeval,... (TIMEOUT)
+ # include <netinet/in.h>  // sockaddr_in
+ # include <arpa/inet.h>   // inet_addr(),...
++# include <fcntl.h>       // [MB] 2020-06-16: For fcntl()
+ # include <netdb.h>       // gethostbyname(),...
+ # include <sys/ioctl.h>
+ # include <errno.h>
+@@ -210,7 +211,9 @@ struct Copy_CVarMS_t
  #define close closesocket
  #endif
  
 -#if defined( WIN32) || defined( __OS2__) || defined( SOLARIS)
-+// For pkgsrc: Use native inet_aton() on Solaris
++// [MB] 2020-06-16: Use native inet_aton() on Solaris
 +// Solaris has inet_aton() in libresolv since version 2.6 from 1997
 +#if defined( WIN32) || defined( __OS2__) // || defined( SOLARIS)
  // it seems windows doesn't define that... maybe some other OS? OS/2
  static inline
  int inet_aton(const char *hostname,
+@@ -643,9 +646,19 @@ static int MS_Connect(char *ip_addr, cha
+         // winsock.h:  int ioctlsocket(SOCKET,long,u_long *);
+         u_long test = 1; // [smite] I have no idea what this type is supposed to be
+         ioctlsocket(ms_socket_fd, FIONBIO, &test);
+-#else
++#elif defined(__OS2__)
+         res = 1;  // non-blocking true
+         ioctl(ms_socket_fd, FIONBIO, &res);
++#else
++        // [MB] 2020-06-16: Use portable POSIX way to enable non-blocking mode
++        // https://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html
++        res = fcntl(ms_socket_fd, F_SETFL, O_NONBLOCK);
++        if(-1 == res)
++        {
++            con_state = MSCS_FAILED;
++            MS_Close_socket();
++            return MS_CONNECT_ERROR;
++        }
+ #endif
+         res = connect(ms_socket_fd, (struct sockaddr *) &ms_addr, sizeof(ms_addr));
+         if (res < 0)


Home | Main Index | Thread Index | Old Index