bug-cvs
[Top][All Lists]
Advanced

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

RE: small problem targeting VMS: MAXSIZE, and cross autoconf


From: Jay K
Subject: RE: small problem targeting VMS: MAXSIZE, and cross autoconf
Date: Wed, 5 May 2010 10:20:18 +0000

Here's another variation that I'm going with for now:

jbook2:cvs jay$ diff -u /src/orig/cvs-1.11.23/src/filesubr.c 
/src/cvs-1.11.23/src/filesubr.c
--- /src/orig/cvs-1.11.23/src/filesubr.c    2008-05-07 08:57:34.000000000 -0700
+++ /src/cvs-1.11.23/src/filesubr.c    2010-05-05 03:16:33.000000000 -0700
@@ -880,7 +880,11 @@
  *  This function exits with a fatal error if it fails to read the link for
  *  any reason.
  */
+#if defined(__vms) && !defined(SSIZE_MAX)
+#define MAXSIZE (SIZE_MAX)
+#else
 #define MAXSIZE (SIZE_MAX < SSIZE_MAX ? SIZE_MAX : SSIZE_MAX)
+#endif
 
 char *
 xreadlink (link)

 - Jay


----------------------------------------
> From: jay.krell@cornell.edu
> To: bug-cvs@nongnu.org
> Subject: small problem targeting VMS: MAXSIZE, and cross autoconf
> Date: Wed, 5 May 2010 09:50:16 +0000
>
>
> I'm targeting VMS 7.x. Current is 8.x (which I don't have available).
>
>
> There's some problem where limits.h doesn't or doesn't always #define 
> SSIZE_MAX. I haven't totally figured it out.
> The "real" limits.h has it behind a reasonable "#   if defined(_XOPEN_SOURCE) 
> || !defined(_ANSI_C_SOURCE)".
> But gcc makes a new limits.h that doesn't have it at all.
>
>
> It might be reasonable to eliminate or reduce the dependency?
> in src/filesubr.c:
>
> #define MAXSIZE (SIZE_MAX < SSIZE_MAX ? SIZE_MAX : SSIZE_MAX)
>
> Some possibilities:
>
> #ifdef SSIZE_MAX
> #define MAXSIZE (SIZE_MAX < SSIZE_MAX ? SIZE_MAX : SSIZE_MAX)
> #else
> #define MAXSIZE (SIZE_MAX)
> #endif
>
> #ifndef __vms
> #define MAXSIZE (SIZE_MAX < SSIZE_MAX ? SIZE_MAX : SSIZE_MAX)
> #else
> #define MAXSIZE (SIZE_MAX)
> #endif
>
> #define MAXSIZE (~(size_t)0) assuming two's complent?
> #define MAXSIZE (1L << 30)  very portable and pretty darn large?
> #define MAXSIZE LONG_MAX
> #define MAXSIZE ULONG_MAX
> #define MAXSIZE (ULONG_MAX < LONG_MAX ? ULONG_MAX : LONG_MAX)
>   Equivalent on all but a few platforms, and still pretty darn large.
>
> #ifndef _WIN64
> #define MAXSIZE (~(size_t)0)
> #else
> #define MAXSIZE (ULONG_MAX < LONG_MAX ? ULONG_MAX : LONG_MAX)
> #endif
>
> pretty good.
>
> You could also like remove the use of MAXSIZE and like:
>
> next_buflen = buflen * 2;
> if (next_buflen < buflen)
>         /* Our buffer cannot grow any bigger.  */
>         error (1, ENAMETOOLONG, "cannot readlink %s", link);
> buflen = next_buflen
>
>
> I don't know what the right way to incorporate this, but
> I'm cross building and VMS has vfork but not fork, and
> it doesn't have fnmatch (doesn't appear to be in Posix),
> so I
> ac_cv_func_fnmatch_works=no \
> ac_cv_func_fork=no \
> ac_cv_func_fork_works=no \
> ac_cv_func_vfork=yes \
>
>
> Thanks,
>  - Jay
>
                                          



reply via email to

[Prev in Thread] Current Thread [Next in Thread]