Re: [PATCH] Two VMS configuration nits

"Craig A. Berry" <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
> On Jun 14, 2015, at 11:53 AM, Frediano Ziglio <[email protected]> wrote:
> 
> Il 12/Giu/2015 19:48, "Craig A. Berry" <[email protected]> ha scritto:
>> 
>> There are two attached patches.  One avoids a redefinition of a symbol in
> the VMS-specific Makefile equivalent which bothers one VMS make utility
> (MMS) but not another (MMK).  The other enables the replacement socketpair
> for older VMS systems that don’t have their own.  These are against master
> but should be quite safe for the 0.95 branch as well.
>> 
>> Thanks to Norm Lastovica for problem reports and testing.
>> 
> 
> Looks good. Did you try to force socket pair replacement to be used. In
> Linux it worked but to remove a warning I had to add unistd.h include. Do
> you want me to add to 0.95 too? Should you/me add a comment in changeset
> comment about Norm?
> 

I believe there was a warning about close() not being declared, so yes, unistd.h should take care of that.  But it did work despite the warning.  And yes, they should be applied to 0.95 as well as master.  Good call on crediting Norm.  I’ve attached a revised version of patch #0002 with that added to the commit message.

________________________________________
Craig A. Berry
mailto:[email protected]

"... getting out of a sonnet is much more
 difficult than getting in."
                 Brad Leithauser

_______________________________________________
FreeTDS mailing list
[email protected]
http://lists.ibiblio.org/mailman/listinfo/freetds
0002-Use-replacement-socketpair-on-pre-8.2-VMS-systems.patch (application/octet-stream, 4 KB)
From 701d0de251d01925c7909d9f77a4f43323ba15c0 Mon Sep 17 00:00:00 2001
From: "Craig A. Berry" <[email protected]>
Date: Thu, 11 Jun 2015 10:51:57 -0500
Subject: [PATCH 2/2] Use replacement socketpair on pre-8.2 VMS systems.

Thanks to Norm Lastovica for the bug report and testing.
---
 vms/config_h.vms         |  3 ++-
 vms/configure.com        | 22 ++++++++++++++++++++++
 vms/descrip_mms.template |  3 ++-
 3 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/vms/config_h.vms b/vms/config_h.vms
index 3f97063..1f731d2 100644
--- a/vms/config_h.vms
+++ b/vms/config_h.vms
@@ -170,7 +170,8 @@
 #undef HAVE_SETHOSTENT_R
 
 /* Define to 1 if you have the `socketpair' function. */
-#if __CRTL_VER >= 80200000
+/* Must be undefined, not defined to 0, when not present. */
+#if @D_SOCKETPAIR@
 #define HAVE_SOCKETPAIR 1
 #endif
 
diff --git a/vms/configure.com b/vms/configure.com
index c58c154..d8aa863 100644
--- a/vms/configure.com
+++ b/vms/configure.com
@@ -52,6 +52,17 @@ $   d_have_iconv = "0"
 $   SAY "Using replacement iconv()"
 $ ENDIF
 $!
+$! Set socketpair (available with VMS 8.2 and later)
+$!
+$ IF F$EXTRACT(1,3,F$EDIT(F$GETSYI("VERSION"),"TRIM")) .GES. "8.2"
+$ THEN
+$   d_socketpair = "1"
+$   SAY "Using system-supplied socketpair()"
+$ ELSE
+$   d_socketpair = "0"
+$   SAY "Using replacement socketpair()"
+$ ENDIF
+$!
 $! Generate config.h
 $!
 $ open/write vmsconfigtmp vmsconfigtmp.com
@@ -73,6 +84,8 @@ $ write vmsconfigtmp "POSITION (BEGINNING_OF (main_buffer));"
 $ write vmsconfigtmp "eve_global_replace(""@D_HAVE_ICONV@"",""''d_have_iconv'"");"
 $ write vmsconfigtmp "POSITION (BEGINNING_OF (main_buffer));"
 $ write vmsconfigtmp "eve_global_replace(""@D_SNPRINTF@"",""''d_snprintf'"");"
+$ write vmsconfigtmp "POSITION (BEGINNING_OF (main_buffer));"
+$ write vmsconfigtmp "eve_global_replace(""@D_SOCKETPAIR@"",""''d_socketpair'"");"
 $ write vmsconfigtmp "out_file := GET_INFO (COMMAND_LINE, ""output_file"");"
 $ write vmsconfigtmp "WRITE_FILE (main_buffer, out_file);"
 $ write vmsconfigtmp "quit;"
@@ -119,6 +132,13 @@ $ else
 $   snprintfobj = "[.src.replacements]snprintf$(OBJ),"
 $ endif
 $!
+$ if d_socketpair .eqs. "1"
+$ then
+$   socketpairobj = " "
+$ else
+$   socketpairobj = "[.src.replacements]socketpair$(OBJ),"
+$ endif
+$!
 $ if P1 .eqs. "--disable-thread-safe"
 $ then
 $   enable_thread_safe = " "
@@ -144,6 +164,8 @@ $ write vmsconfigtmp "eve_global_replace(""@LIBICONVOBJ@"",""''libiconvobj'"");"
 $ write vmsconfigtmp "POSITION (BEGINNING_OF (main_buffer));"
 $ write vmsconfigtmp "eve_global_replace(""@SNPRINTFOBJ@"",""''snprintfobj'"");"
 $ write vmsconfigtmp "POSITION (BEGINNING_OF (main_buffer));"
+$ write vmsconfigtmp "eve_global_replace(""@SOCKETPAIROBJ@"",""''socketpairobj'"");"
+$ write vmsconfigtmp "POSITION (BEGINNING_OF (main_buffer));"
 $ write vmsconfigtmp "eve_global_replace(""@ENABLE_THREAD_SAFE@"",""''enable_thread_safe'"");"
 $ write vmsconfigtmp "out_file := GET_INFO (COMMAND_LINE, ""output_file"");"
 $ write vmsconfigtmp "WRITE_FILE (main_buffer, out_file);"
diff --git a/vms/descrip_mms.template b/vms/descrip_mms.template
index e0e0155..2355b4a 100644
--- a/vms/descrip_mms.template
+++ b/vms/descrip_mms.template
@@ -114,6 +114,7 @@ VASPRINTFOBJ = @VASPRINTFOBJ@
 STRTOK_ROBJ = @STRTOK_ROBJ@
 LIBICONVOBJ = @LIBICONVOBJ@
 SNPRINTFOBJ = @SNPRINTFOBJ@
+SOCKETPAIROBJ = @SOCKETPAIROBJ@
 
 TDSOBJS = [.src.tds]bulk$(OBJ), [.src.tds]challenge$(OBJ), [.src.tds]config$(OBJ), \
 	[.src.tds]convert$(OBJ), [.src.tds]data$(OBJ), [.src.tds]des$(OBJ), [.src.tds]getmac$(OBJ), \
@@ -126,7 +127,7 @@ TDSOBJS = [.src.tds]bulk$(OBJ), [.src.tds]challenge$(OBJ), [.src.tds]config$(OBJ
 	[.src.tds]stream$(OBJ), \
 	[.src.replacements]strlcpy$(OBJ), [.src.replacements]getpassarg$(OBJ), \
 	[.src.replacements]sleep$(OBJ), \
-	$(ASPRINTFOBJ) $(VASPRINTFOBJ) $(SNPRINTFOBJ) $(STRTOK_ROBJ) $(LIBICONVOBJ) \
+	$(ASPRINTFOBJ) $(VASPRINTFOBJ) $(SNPRINTFOBJ) $(STRTOK_ROBJ) $(LIBICONVOBJ) $(SOCKETPAIROBJ) \
 	[.vms]getpass$(OBJ)
 
 CTLIBOBJS = [.src.ctlib]blk$(OBJ), [.src.ctlib]cs$(OBJ), [.src.ctlib]ct$(OBJ), \
-- 
2.2.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.