Skip to content

Commit

Permalink
Explicit header definitions for Open XL warnings
Browse files Browse the repository at this point in the history
Open XL 2.1 on z/OS reports some of the implicit declarations
as errors, and requires these to be explicitly defined. Most of
the underlying changes are to address this concern and some other
fixes pertaining to compilation errors.
_EXT is defined in port/zos390/omrosdump.c as the cnap() function
declaration within the ctype.h header is guarded behind the _EXT
macro and required to be present for Open XL.
  • Loading branch information
Deigue committed May 13, 2024
1 parent 33a1542 commit 660db3c
Show file tree
Hide file tree
Showing 13 changed files with 37 additions and 12 deletions.
4 changes: 4 additions & 0 deletions include_core/unix/thrdsup.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ int linux_pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, c
intptr_t init_thread_library(void);
intptr_t set_pthread_priority(pthread_t handle, omrthread_prio_t j9ThreadPriority);
intptr_t set_pthread_name(pthread_t self, pthread_t thread, const char *name);
intptr_t sem_init_zos(j9sem_t s, int pShared, int initValue);
intptr_t sem_destroy_zos(j9sem_t s);
intptr_t sem_wait_zos(j9sem_t s);
intptr_t sem_post_zos(j9sem_t s);

extern struct J9ThreadLibrary default_library;

Expand Down
2 changes: 1 addition & 1 deletion port/zos390/omrcel4ro31.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ omr_cel4ro31_call(OMR_CEL4RO31_infoBlock *infoBlock);
* @return whether CEL4RO31 runtime support is available.
*/
BOOLEAN
omr_cel4ro31_isSupported(void);
omr_cel4ro31_is_supported(void);

/**
* A helper routine to return an error message associated with the CEL4RO31 return code.
Expand Down
1 change: 1 addition & 0 deletions port/zos390/omrgetjobid.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <stdlib.h>
#include "omrport.h"
#include "omrgetjobid.h"
#include "omrportpriv.h"

#define JOBID_STRING_LENGTH 9

Expand Down
1 change: 1 addition & 0 deletions port/zos390/omrgetjobname.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ void
omrget_jobname(struct OMRPortLibrary *portLibrary, char *jobname, uintptr_t length)
{
char *tmp_jobname = (char *)__malloc31(J9_MAX_JOBNAME);
extern void _JOBNAME(char *); /* defined in omrjobname.s */

if (NULL != tmp_jobname) {
char *ascname = NULL;
Expand Down
1 change: 1 addition & 0 deletions port/zos390/omrgetsysname.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*******************************************************************************/

#include <stdlib.h>
#include <string.h>
#include <sys/utsname.h>
#include "omrgetsysname.h"

Expand Down
1 change: 1 addition & 0 deletions port/zos390/omrgetuserid.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ omrget_userid(char *userid, uintptr_t length)
uintptr_t result = 0;

userid[0] = '\0';
extern void _USERID(char *); /* defined in omruserid.s */

if (NULL != tmp_userid) {
char *ascname = NULL;
Expand Down
24 changes: 17 additions & 7 deletions port/zos390/omrintrospect.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,25 @@
#include "omrintrospect_common.h"
#include "omrutil.h"

#pragma linkage(getthent, OS_UPSTACK)
#if defined(OMR_ENV_DATA64)
#pragma linkage(getthent, OS)
#pragma map(getthent, "BPX4GTH")
#else
#else /* defined(OMR_ENV_DATA64) */
#pragma linkage(getthent, OS_UPSTACK)
#pragma map(getthent, "BPX1GTH")
#endif
#endif /* defined(OMR_ENV_DATA64) */

#pragma linkage(pthread_quiesce, OS_UPSTACK)
#if defined(OMR_ENV_DATA64)
#pragma map(pthread_quiesce, "BPX4PTQ")
#else
#else /* defined(OMR_ENV_DATA64) */
#pragma linkage(pthread_quiesce, OS_UPSTACK)
#pragma map(pthread_quiesce, "BPX1PTQ")
#endif
#endif /* defined(OMR_ENV_DATA64) */

#if !defined(OMR_ENV_DATA64)
#pragma linkage(pthread_quiesce_and_get_np_X, OS_UPSTACK)
#pragma map(pthread_quiesce_and_get_np_X, "BPX1PQG")
#endif /* !defined(OMR_ENV_DATA64) */

#ifdef MAX_NAME
#undef MAX_NAME
Expand All @@ -60,8 +63,11 @@

typedef __mcontext_t_ thread_context;


#if defined(__open_xl__)
#pragma pack(push, 1)
#else /* defined(__open_xl__) */
#pragma pack(packed)
#endif /* defined(__open_xl__) */

/* Program routine entry area (XPLINK) */
typedef struct XPLINK_Routine_entry {
Expand Down Expand Up @@ -633,6 +639,10 @@ struct tcb {
#define QUIESCE_SRB 9 /* Quiesce threads type = SRBs @DGA */
/* Skip 10 and 11 due to collision with BPXZCONS Freeze/Unfreeze Fast */

#if defined(__open_xl__)
#pragma pack(pop)
#else /* defined(__open_xl__) */
#pragma pack(reset)
#endif /* defined(__open_xl__) */

#endif
1 change: 1 addition & 0 deletions port/zos390/omrosbacktrace_impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
*/

#include "omrport.h"
#include "omrportpriv.h"
#include "omrsignal_context.h"
#include <stdio.h>
#include <signal.h>
Expand Down
5 changes: 5 additions & 0 deletions port/zos390/omrosdump.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
* @brief Dump formatting
*/

#define _EXT

#include <errno.h>
#include <stdio.h>
Expand All @@ -37,7 +38,9 @@
#include <time.h>
#include <pwd.h>
#include <ctest.h>
#include "omrgetjobname.h"
#include "omrport.h"
#include "omrportpriv.h"
#if defined(J9ZOS390) && !defined(OMR_EBCDIC)
#include "atoe.h"
#endif
Expand Down Expand Up @@ -333,6 +336,8 @@ tdump(struct OMRPortLibrary *portLibrary, char *asciiLabel, char *ebcdicLabel, u
char dsn[256];
} *dsnPattern31;

extern void _TDUMP(struct ioparms_t *ioparms, struct dsn_pattern_t *dsn_pattern); /* defined in omrgenerate_ieat_dump.s */

/* _TDUMP subroutine expects 31 bit addresses */
ioParms31 = __malloc31(sizeof(*ioParms31));
if (ioParms31 == NULL) {
Expand Down
1 change: 1 addition & 0 deletions port/zos390/omrsignal_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

#include "omrport.h"
#include "omrportpriv.h"
#include <strings.h>
#include <unistd.h>
#include "omrsignal_context.h"
#include "omrceeocb.h"
Expand Down
1 change: 1 addition & 0 deletions port/zos390/omrsignal_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ uint32_t infoForVR(struct OMRPortLibrary *portLibrary, OMRUnixSignalInfo *info,
uint32_t infoForModule(struct OMRPortLibrary *portLibrary, struct OMRUnixSignalInfo *info, int32_t index, const char **name, void **value);
uint32_t infoForControl(struct OMRPortLibrary *portLibrary, struct OMRUnixSignalInfo *info, int32_t index, const char **name, void **value);
uint32_t infoForSignal(struct OMRPortLibrary *portLibrary, struct OMRUnixSignalInfo *info, int32_t index, const char **name, void **value);
void fillInJumpInfo(struct OMRPortLibrary *portLibrary, void *contextInfo, void *jumpInfo);
void fillInUnixSignalInfo(struct OMRPortLibrary *portLibrary, void *contextInfo, struct OMRUnixSignalInfo *signalInfo);
BOOLEAN checkIfResumableTrapsSupported(struct OMRPortLibrary *portLibrary);

6 changes: 2 additions & 4 deletions thread/unix/thrdsup.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,10 @@ intptr_t init_thread_library(void);
static intptr_t zos_init_yielding(void);
#endif
intptr_t sem_getvalue_zos(j9sem_t s);
intptr_t sem_init_zos(j9sem_t s, int pShared, int initValue);
void call_omrthread_init(void);
intptr_t sem_destroy_zos(j9sem_t s);
intptr_t sem_wait_zos(j9sem_t s);
intptr_t sem_trywait_zos(j9sem_t s);
intptr_t sem_post_zos(j9sem_t s);
int setenv(const char *, const char *, int) __THROW;
char *getenv(const char *) __THROW;

#if defined (OMRZTPF)
void ztpf_init_proc(void);
Expand Down
1 change: 1 addition & 0 deletions util/omrutil/unix/zos/getstoragekey.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
uintptr_t
getStorageKey(void)
{
extern uintptr_t _GETPSW(); /* defined in getpsw.s */
/* The storage key is returned in bits 8-11 of the PSW */
return ((_GETPSW() >> 20) & 0xF);
}

0 comments on commit 660db3c

Please sign in to comment.