/* * zos_shim.h - just enough of the z/OS C library's declarations to * compile src/sys_zos.c on Linux with -fsyntax-only (make zos-lint). * * This catches typos, type errors, missing includes and warnings in the * z/OS layer before it reaches a z/OS compiler. It proves nothing about * behaviour, and the declarations are transcribed from the z/OS headers * (fcntl.h is in the project docs; the rest from the XL C/C++ Runtime * Library Reference), so a mismatch here is a mismatch to fix here. * Forced in with -include, after the real system headers. */ #ifndef ZOS_SHIM_H #define ZOS_SHIM_H /* Tell the sources they are being checked, not built: this is 64-bit * Linux, and sys_zos.c asserts the real build is 31-bit. */ #define ZASH_ZOS_SHIM 1 #include #include #include #include #include #include #include #include #define __MVS__ 1 /* with __FX (_OPEN_SYS_FILE_EXT) */ #define F_SETTAG 12 #define F_CONTROL_CVT 13 struct f_cnvrt { int cvtcmd; short pccsid; short fccsid; }; #define SETCVTOFF 0 #define SETCVTON 1 #define SETAUTOCVTON 2 #define QUERYCVT 3 #define SETCVTALL 4 #define SETAUTOCVTALL 5 /* : the tag lives in struct stat; Linux's has none, so the * shim's stat()/fstat() take a z/OS-shaped structure. */ typedef unsigned short __ccsid_t; struct file_tag { unsigned short ft_ccsid; unsigned int ft_txtflag : 1; unsigned int ft_deferred : 1; unsigned int ft_rsvflags : 14; }; struct zos_stat { mode_t st_mode; off_t st_size; struct file_tag st_tag; }; /* "stat" names both the structure and the function, as on z/OS. */ int zos_stat(const char *, struct zos_stat *); int zos_fstat(int, struct zos_stat *); #define stat zos_stat #define fstat zos_fstat /* __chattr() and attrib_t (, _OPEN_SYS_FILE_EXT) */ typedef struct { unsigned int att_filetagchg : 1; struct file_tag att_filetag; } attrib_t; int __chattr(char *, attrib_t *, int); /* <_Ccsid.h> */ #define _CSNAME_LEN_MAX 16 __ccsid_t __toCcsid(char *); int __toCSName(__ccsid_t, char *); /* <_Nascii.h> */ #define _CVTSTATE_OFF 0 #define _CVTSTATE_ON 1 #define _CVTSTATE_QUERY 4 int __ae_autoconvert_state(int); /* : storage below 2 GB, i.e. reachable with 31 bits */ void *__malloc31(size_t); void __free31(void *); /* */ int __osname(struct utsname *); /* fetch() */ typedef int (*__fetch_t)(void); __fetch_t fetch(const char *); int release(void (*)(void)); /* : LE's abend signal. The value is from EDC4H023. */ #ifndef SIGABND #define SIGABND 18 #endif /* (z/OS spawn(), not posix_spawn) */ struct inheritance { short flags; pid_t pgroup; sigset_t sigmask; sigset_t sigdefault; int ctlttyfd; }; #define SPAWN_SETGROUP 0x01 #define SPAWN_SETSIGMASK 0x02 #define SPAWN_SETSIGDEF 0x04 #define SPAWN_SETTCPGRP 0x08 #define SPAWN_NEWPGROUP (-1) #define SPAWN_FDCLOSED (-1) pid_t spawn(const char *, const int, const int[], const struct inheritance *, const char *[], const char *[]); /* #pragma linkage is ignored by clang on Linux */ #pragma GCC diagnostic ignored "-Wunknown-pragmas" #endif