Discussion:
[patch]socket.h : OpenVMS has _CMSG_LEN/_CMSG_SPACE macros.
John E. Malmberg
2017-07-12 13:32:42 UTC
Permalink
This patch defines the CMSG_LEN and CMSG_SPACE macros for OpenVMS in
sys_socket.h.

Regards,
-John
Bruno Haible
2017-07-15 15:23:35 UTC
Permalink
Post by John E. Malmberg
This patch defines the CMSG_LEN and CMSG_SPACE macros for OpenVMS in
sys_socket.h.
There was no patch attached to your mail.

Bruno
John E. Malmberg
2017-07-15 20:34:58 UTC
Permalink
Post by Bruno Haible
Post by John E. Malmberg
This patch defines the CMSG_LEN and CMSG_SPACE macros for OpenVMS in
sys_socket.h.
There was no patch attached to your mail.
Sorry, here is the patch.

Regards,
-John
Bruno Haible
2017-07-15 21:23:33 UTC
Permalink
Post by John E. Malmberg
Post by John E. Malmberg
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 <***@gmail.com>

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.
+@item
+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__

Loading...