[PATCH] for solaris 2.6

Mark D. Baushke mdb at juniper.net
Wed Oct 31 05:41:10 EST 2001


I didn't see this one applied to the repository yet. 

It may not be the best patch possible... basic problem is that
_LARGEFILE64_SOURCE needs to be defined on Solaris 2.6 if
AC_SYS_LARGEFILE ends up doing a '#define _FILE_OFFSET_BITS 64'

If _FILE_OFFSET_BITS == 64, then <sys/resource.h> will define a
'struct rlimit64' but NOT define a 'struct rlimit' leading to a
failure to compile ssh.c because 'struct rlimit' is not a complete
type.

When _LARGEFILE64_SOURCE is defined, it adds a #define rlimit rlimit64
so that uses of 'struct rlimit rlim;' will become 'struct rlimit64 rlim;'
by the compiler and the compilation will succeed.

It may be desirable to modify the AC_SYS_LARGEFILE in the autoconf
sources for this situation, but I have not tried to do that.

	Enjoy!
	-- Mark

Index: acconfig.h
===================================================================
RCS file: /cvs/openssh_cvs/acconfig.h,v
retrieving revision 1.118
diff -u -r1.118 acconfig.h
--- acconfig.h	2001/10/22 00:53:59	1.118
+++ acconfig.h	2001/10/30 18:42:56
@@ -332,6 +332,9 @@
 /* Define if you want smartcard support */
 #undef SMARTCARD
 
+/* Define if _FILE_OFFSET_BITS also needs _LARGEFILE64_SOURCE defined */
+#undef _LARGEFILE64_SOURCE
+
 @BOTTOM@
 
 /* ******************* Shouldn't need to edit below this line ************** */
Index: configure.ac
===================================================================
RCS file: /cvs/openssh_cvs/configure.ac,v
retrieving revision 1.3
diff -u -r1.3 configure.ac
--- configure.ac	2001/10/27 17:45:37	1.3
+++ configure.ac	2001/10/30 18:42:57
@@ -24,6 +24,32 @@
 
 # System features
 AC_SYS_LARGEFILE
+if test "$ac_cv_sys_file_offset_bits" != no; then
+	AC_MSG_CHECKING(if _LARGEFILE64_SOURCE is needed)
+	AC_TRY_COMPILE(
+		[
+#include "confdefs.h"
+#include <sys/resource.h>
+		],
+		[ struct rlimit rlim; ],
+		[ AC_MSG_RESULT(no) ],
+		[ 
+		AC_TRY_COMPILE(
+			[
+#include "confdefs.h"
+#define _LARGEFILE64_SOURCE
+#include <sys/resource.h>
+			],
+			[ struct rlimit rlim; ],
+			[ 
+				AC_MSG_RESULT(yes)
+				AC_DEFINE(_LARGEFILE64_SOURCE)
+			],
+			[ AC_MSG_RESULT(problems with struct rlimit found) ]
+		)
+		]
+	)
+fi
 
 if test -z "$AR" ; then
 	AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])



More information about the openssh-unix-dev mailing list