bug-cvs
[Top][All Lists]
Advanced

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

small problem targeting VMS: MAXSIZE, and cross autoconf


From: Jay K
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]