bug-gnulib
[Top][All Lists]
Advanced

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

Re: [patch]socket.h : OpenVMS has _CMSG_LEN/_CMSG_SPACE macros.


From: Bruno Haible
Subject: Re: [patch]socket.h : OpenVMS has _CMSG_LEN/_CMSG_SPACE macros.
Date: Sat, 15 Jul 2017 23:23:33 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-83-generic; KDE/5.18.0; x86_64; ; )

John E. Malmberg wrote:
> >> This patch defines the CMSG_LEN and CMSG_SPACE macros for OpenVMS in
> >> sys_socket.h.
> 
> Sorry, here is the patch.

Thanks, looks good.

Two nits:
* The argument names of C macros don't need to be protected; only K&R C
  preprocessors were not hygienic regarding C macro argument names, but they
  are not in use any more.
  The use of identifiers that start with '__' in C programs is bad style, 
because
  these identifiers belong to the "system" (= system vendor + libc vendor +
  compiler vendor). In gnulib, we use such identifiers in a few places for
  glibc compatibility (e.g. in regex.h) and sometimes also with no good reason
  (e.g. __gl_setmode_check, __xalloc_count_type), but this is not a practice
  that one should follow.
* The name of the module is 'sys_socket', not 'socket'. If you're unsure to 
which
  module a file belongs, use
    ./gnulib-tool --find lib/sys_socket.in.h

I've applied this:


2017-07-15  John E. Malmberg  <address@hidden>

        sys_socket: Add support for OpenVMS.
        * lib/sys_socket.in.h [__VMS]: Define CMSG_SPACE, CMSG_LEN.
        * doc/posix-headers/sys_socket.texi: Mention OpenVMS issues.

diff --git a/doc/posix-headers/sys_socket.texi 
b/doc/posix-headers/sys_socket.texi
index 4c104a2..380a0ae 100644
--- a/doc/posix-headers/sys_socket.texi
+++ b/doc/posix-headers/sys_socket.texi
@@ -28,6 +28,10 @@ emx+gcc.
 The @code{struct sockaddr_storage} type does not have a member @code{ss_family}
 on some platforms:
 AIX 7.1.
address@hidden
+The @code{CMSG_SPACE} and @code{CMSG_LEN} macros are not provided on some
+platforms:
+OpenVMS.
 @end itemize
 
 Portability problems not fixed by Gnulib:
diff --git a/lib/sys_socket.in.h b/lib/sys_socket.in.h
index d898622..b4911bb 100644
--- a/lib/sys_socket.in.h
+++ b/lib/sys_socket.in.h
@@ -141,6 +141,15 @@ struct sockaddr_storage
 #  define SHUT_RDWR 2
 # endif
 
+# ifdef __VMS                        /* OpenVMS */
+#  ifndef CMSG_SPACE
+#   define CMSG_SPACE(length) _CMSG_SPACE(length)
+#  endif
+#  ifndef CMSG_LEN
+#   define CMSG_LEN(length) _CMSG_LEN(length)
+#  endif
+# endif
+
 #else
 
 # ifdef __CYGWIN__




reply via email to

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