Discussion:
VMS has struct sched_param in pthread.h
Add Reply
John E. Malmberg
2017-06-15 23:16:14 UTC
Reply
Permalink
Raw Message
Hello All,

The make step on VMS next stopped at glthread/cond.c with:

cc -DHAVE_CONFIG_H -DEXEEXT=\"\" -DEXEEXT=\"\" -DNO_XMALLOC
-DEXEEXT=\"\" -I. -I.. -DGNULIB_STRICT_CHECKING=1 -g -c -o
glthread/cond.o glthread/cond.c

struct sched_param
^
%CC-E-REDEFSTRUCT, In this declaration, the struct "sched_param" is
redefined.
at line number 52 in file LCL_ROOT:[gnulib.gllib]sched.h;1
make[4]: *** [glthread/cond.o] Error 2

VMS does not currently provide a sched.h and has that definition in
pthread.h instead.

Regards,
-John
Bruno Haible
2017-06-16 17:21:27 UTC
Reply
Permalink
Raw Message
Hello John,
Post by John E. Malmberg
cc -DHAVE_CONFIG_H -DEXEEXT=\"\" -DEXEEXT=\"\" -DNO_XMALLOC
-DEXEEXT=\"\" -I. -I.. -DGNULIB_STRICT_CHECKING=1 -g -c -o
glthread/cond.o glthread/cond.c
struct sched_param
^
%CC-E-REDEFSTRUCT, In this declaration, the struct "sched_param" is
redefined.
at line number 52 in file LCL_ROOT:[gnulib.gllib]sched.h;1
make[4]: *** [glthread/cond.o] Error 2
VMS does not currently provide a sched.h and has that definition in
pthread.h instead.
Please try the attached patch.

Please also tell us identification of your environment:
- Is it "VMS"? Or "OpenVMS"?
- Which version? You're talking about 7.3 here, 8.2 there, 8.4 then...
- [Not for this patch, but for other ones.] What's the best C preprocessor
conditionals for your environment? According to predef.sf.net, I guess
it's __DECC for the compiler and __VMS for the operating system?
Conditionalized with __VMS_VER >= 82000000 or __VMS_VER >= 84000000 ?

Bruno
John E. Malmberg
2017-06-17 02:47:24 UTC
Reply
Permalink
Raw Message
Post by Bruno Haible
Hello John,
Post by John E. Malmberg
VMS does not currently provide a sched.h and has that definition in
pthread.h instead.
Please try the attached patch.
Thank you, I will try to get to that this weekend.
Post by Bruno Haible
- Is it "VMS"? Or "OpenVMS"?
The marketing people renamed VMS to OpenVMS at about version 5.5, but
many people consider the "Open" to be silent.

This is what uname will report on an Itanium system which it gets from
querying the OS from config.log:

uname -m = HP_rx2600___1_50GHz_6_0MB_
uname -r = 0
uname -s = OpenVMS
uname -v = V8.4

/usr/bin/uname -p = unknown
/bin/uname -X = unknown

/bin/arch = HP_rx2600___1_50GHz_6_0MB_
/usr/bin/arch -k = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo = unknown
/bin/machine = unknown
/usr/bin/oslevel = unknown
/bin/universe = unknown
Post by Bruno Haible
- Which version? You're talking about 7.3 here, 8.2 there, 8.4
then...
- [Not for this patch, but for other ones.]
My current efforts are mainly targeting 8.3 and 8.4 for Alpha and Itanium.

I know of one person trying to rebuild my ports on VMS 8.2 Alpha.

I also have systems currently powered off that stop at VMS Alpha 7.2-2.

VMS 8.4 will be the last VMS release for Alpha, and probably the last
for Itanium.

VMS 9.0 will be the first VMS release on x86_64 and hopefully will
default to having its C library be more compatible with Linux.

VMS 7.3 was the last VMS release for VAX.

I can build bash 4.2.x on VMS VAX 7.3. Bash 4.3.x expects a 64 bit
ino_t, and does not use same-inode.h yet.

Many GNU products like Make and Gawk are still being built for VAX/VMS
7.3. I do not know how many users are using them. I will keep updating
the VAX ports for the GNV project as long it does not take extra effort
to keep them building.
Post by Bruno Haible
What's the best C preprocessor conditionals for your environment?
According topredef.sf.net, I guess it's __DECC for the compiler and
__VMS for the operating system?
Conditionalized with __VMS_VER >=82000000 or __VMS_VER >= 84000000 ?
Compiler: __DECC
__DECC_VER example 70390020

C library: __CRTL_VER example 80400000 for 8.4
CPU: __ALPHA or __ia64 or __VAX

Usually !__VAX is used for code that needs either Alpha or Itanium.
A common bug is using __ALPHA which caused compiles to be wrong in Itanium.

OS: __VMS
VMS version: __VMS_VER=80400022 For 8.4 with some updates.

The __CRTL_VER is probably the most important version setting. The
__VMS_VER setting would be for VMS specific code to implement something
that is missing that varies with the version of VMS.

Regards,
-John
Bruno Haible
2017-06-17 08:27:50 UTC
Reply
Permalink
Raw Message
Hi John,

Thanks for the details. We'll rely on that.
Post by John E. Malmberg
Post by Bruno Haible
- Is it "VMS"? Or "OpenVMS"?
The marketing people renamed VMS to OpenVMS at about version 5.5, but
many people consider the "Open" to be silent.
OK. In gnulib we should talk about "OpenVMS". Just like we are talking about
Solaris, after it was renamed from SunOS by "the marketing people" of the
respective vendor. The Wikipedia article [1] also carries the title "OpenVMS".
Post by John E. Malmberg
The __CRTL_VER is probably the most important version setting. The
__VMS_VER setting would be for VMS specific code to implement something
that is missing that varies with the version of VMS.
Good point.
Post by John E. Malmberg
My current efforts are mainly targeting 8.3 and 8.4 for Alpha and Itanium.
I know of one person trying to rebuild my ports on VMS 8.2 Alpha.
OK, then when we need to conditionalize, please remind us whether we should
use __CRTL_VER >= 80200000 or __CRTL_VER >= 80300000.

Bruno

[1] https://en.wikipedia.org/wiki/OpenVMS
John E. Malmberg
2017-06-19 13:17:45 UTC
Reply
Permalink
Raw Message
Post by John E. Malmberg
Post by Bruno Haible
Hello John,
Post by John E. Malmberg
VMS does not currently provide a sched.h and has that definition in
pthread.h instead.
Please try the attached patch.
Thank you, I will try to get to that this weekend.
The configure script is now detecting that struct sched_param is present.

The generated sched.in.h file is not including pthread.h, just the
gllib/spawn.h so that the gllib/execute.c fails to build.

~~~~~
#ifdef __KLIBC__

/* On OS/2 kLIBC, struct sched_param is in spawn.h */
# include <spawn.h>

#endif

#if !1

# if !GNULIB_defined_struct_sched_param
~~~~~

Attached is a patch to lib/sched.in.patch

Regards,
-John
Bruno Haible
2017-06-19 14:59:42 UTC
Reply
Permalink
Raw Message
Post by John E. Malmberg
The configure script is now detecting that struct sched_param is present.
...
Attached is a patch to lib/sched.in.patch
Thanks. Applied with tiny changes: I write "OpenVMS", not "VMS", as
discussed in the other thread. Also, no need to use conditionals based
on __CRTL_VER or HAVE_PTHREAD_H, since you said that only OpenVMS >= 7.3
is interesting and this <pthread.h> exists on VMS since 7.2:
http://h41379.www4.hpe.com/doc/72final/6493/6101pro_029.html
http://h30266.www3.hpe.com/odl/axpos/opsys/vmsos84/6493/6101pro_031.html


2017-06-19 Bruno Haible <***@clisp.org>
John E. Malmberg <***@gmail.com> (tiny change)

sched: Fix compilation failure on OpenVMS.
* m4/sched_h.m4 (gl_SCHED_H): Require AC_CANONICAL_HOST. On OpenVMS,
test whether <pthread.h> exists and defines struct sched_param.
* lib/sched.in.h: On OpenVMS, include <pthread.h>.

diff --git a/lib/sched.in.h b/lib/sched.in.h
index aa96aed..6b4bde8 100644
--- a/lib/sched.in.h
+++ b/lib/sched.in.h
@@ -39,10 +39,13 @@
#include <sys/types.h>

#ifdef __KLIBC__
-
-/* On OS/2 kLIBC, struct sched_param is in spawn.h */
+/* On OS/2 kLIBC, struct sched_param is in spawn.h. */
# include <spawn.h>
+#endif

+#ifdef __VMS
+/* On OpenVMS, struct sched_param is in <pthread.h>. */
+# include <pthread.h>
#endif

#if !@HAVE_STRUCT_SCHED_PARAM@
diff --git a/m4/sched_h.m4 b/m4/sched_h.m4
index fd60a40..213cf68 100644
--- a/m4/sched_h.m4
+++ b/m4/sched_h.m4
@@ -1,4 +1,4 @@
-# sched_h.m4 serial 9
+# sched_h.m4 serial 10
dnl Copyright (C) 2008-2017 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -8,6 +8,7 @@ dnl Written by Bruno Haible.

AC_DEFUN([gl_SCHED_H],
[
+ AC_REQUIRE([AC_CANONICAL_HOST])
AC_CHECK_HEADERS_ONCE([sys/cdefs.h])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[
@@ -41,10 +42,20 @@ AC_DEFUN([gl_SCHED_H],
#include <sched.h>
]])
else
- dnl On OS/2 kLIBC, struct sched_param is in spawn.h.
- AC_CHECK_TYPE([struct sched_param],
- [HAVE_STRUCT_SCHED_PARAM=1], [HAVE_STRUCT_SCHED_PARAM=0],
- [#include <spawn.h>])
+ case "$host_os" in
+ os2*)
+ dnl On OS/2 kLIBC, struct sched_param is in spawn.h.
+ AC_CHECK_TYPE([struct sched_param],
+ [HAVE_STRUCT_SCHED_PARAM=1], [HAVE_STRUCT_SCHED_PARAM=0],
+ [#include <spawn.h>])
+ ;;
+ vms)
+ dnl On OpenVMS 7.2 or newer, struct sched_param is in pthread.h.
+ AC_CHECK_TYPE([struct sched_param],
+ [HAVE_STRUCT_SCHED_PARAM=1], [HAVE_STRUCT_SCHED_PARAM=0],
+ [#include <pthread.h>])
+ ;;
+ esac
fi
AC_SUBST([HAVE_STRUCT_SCHED_PARAM])

Loading...