zoslib
z/OS C/C++ Library
|
#include "edcwccwi.h"
#include "zos-getentropy.h"
#include "zos.h"
#include <_Ccsid.h>
#include <_Nascii.h>
#include <__le_api.h>
#include <assert.h>
#include <builtins.h>
#include <ctest.h>
#include <dlfcn.h>
#include <errno.h>
#include <fcntl.h>
#include <iconv.h>
#include <libgen.h>
#include <poll.h>
#include <pthread.h>
#include <signal.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/msg.h>
#include <sys/ps.h>
#include <sys/shm.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <time.h>
#include <unistd.h>
#include <sys/epoll.h>
#include <sys/eventfd.h>
#include <sys/inotify.h>
#include <exception>
#include <mutex>
#include <sstream>
#include <unordered_map>
#include <vector>
Classes | |
struct | timer_parm |
struct | iarv64parm |
struct | __hash_func |
class | __Cache |
struct | espiearg |
struct | thunk24 |
struct | loadmod |
struct | EDOI |
struct | IFAEDSTA_parms |
struct | IFAARGS |
Macros | |
#define | _AE_BIMODAL 1 |
#define | _ENHANCED_ASCII_EXT 0xFFFFFFFF |
#define | _XOPEN_SOURCE 600 |
#define | _OPEN_SYS_FILE_EXT 1 |
#define | _OPEN_MSGQ_EXT 1 |
#define | __ZOS_CC |
#define | dsa() ((unsigned long *)_gdsa()) |
#define | MIN(a, b) ((a) < (b) ? (a) : (b)) |
#define | XSTR(a) STRINGIFY(a) |
#define | STRINGIFY(a) #a |
#define | DEFAULT_BUILD_STRING "v" XSTR(MAJOR_VERSION) "." XSTR(MINOR_VERSION) "." XSTR(PATCH_VERSION) |
#define | max(a, b) (((a) > (b)) ? (a) : (b)) |
#define | PGTH_CURRENT 1 |
#define | PGTHACOMMANDLONG 1 |
#define | __AttrPacked |
#define | __USE_IARV64 1 |
#define | CSG(_op1, _op2, _op3) __asm volatile(" csg %0,%2,%1 \n " : "+r"(_op1), "+m"(_op2) : "r"(_op3) :) |
#define | CS(_op1, _op2, _op3) __asm volatile(" cs %0,%2,%1 \n " : "+r"(_op1), "+m"(_op2) : "r"(_op3) :) |
#define | PPA_FUNC_LENGTH 256 |
#define | MAP_LE_FUNC(func, offset) (func = (typeof(func))((unsigned long*)__get_libvec_base() + (offset<<1))) |
#define | CHECK_LE_FUNC(offset) (__check_le_func((void*)((unsigned long*)__get_libvec_base() + (offset<<1)), ppa_funcname, PPA_FUNC_LENGTH)) |
#define | MAP_LE_FUNC_ELSE_ZOSLIB_FUNC(func, zoslibfunc, funcstring, offset) |
Typedefs | |
typedef struct timer_parm | timer_parm_t |
typedef unsigned long | value_type |
typedef unsigned long | key_type |
typedef std::unordered_map< key_type, value_type, __hash_func >::const_iterator | mem_cursor_t |
typedef struct thunk24 | thunk24_t |
typedef struct loadmod | loadmod_t |
typedef int | IfaedType |
typedef char | IfaedProdOwner[16] |
typedef char | IfaedProdName[16] |
typedef char | IfaedFeatureName[16] |
typedef char | IfaedProdVers[2] |
typedef char | IfaedProdRel[2] |
typedef char | IfaedProdMod[2] |
typedef char | IfaedProdID[8] |
typedef char | IfaedProdToken[8] |
typedef int | IfaedFeaturesLen |
typedef int | IfaedReturnCode |
typedef struct IFAEDSTA_parms | IFAEDSTA_parms_t |
typedef struct IFAARGS | IFAARGS_t |
typedef int(* | zoslib_env_hook_func) (char *) |
Functions | |
void * | _gdsa () |
void | __set_ccsid_guess_buf_size (int nbytes) |
__zinit * | __get_instance () |
char ** | __get_environ_np (void) |
int | __setenv_a (const char *, const char *, int) asm("@@A00188") |
void | __xfer_env (void) |
int | gettid () |
int | backtrace (void **buffer, int size) |
char ** | backtrace_symbols (void *const *buffer, int size) |
void | backtrace_symbols_fd (void *const *buffer, int size, int fd) |
void | __display_backtrace (int fd) |
void | __abend (int comp_code, unsigned reason_code, int flat_byte, void *plist) |
int | strcasecmp_ignorecp (const char *a, const char *b) |
int | strncasecmp_ignorecp (const char *a, const char *b, size_t n) |
int | get_ipcs_overview (IPCQPROC *info) |
void | __cleanupipc (int others) |
unsigned long | __clock (void) |
void | __settimelimit (int secs) |
void * | __dlcb_next (void *last) |
int | __dlcb_entry_name (char *buf, int size, void *dlcb) |
void * | __dlcb_entry_addr (void *dlcb) |
int | __dlcb_iterate (int(*cb)(char *, void *, void *), void *data) |
void | abort (void) |
void | __set_backtrace_on_abort (bool flag) |
int | __cond_timed_wait (unsigned int secs, unsigned int nsecs, unsigned int event_list, unsigned int *secs_rem, unsigned int *nsecs_rem) |
int | kill (int pid, int sig) |
int | __getargcv (int *argc, char ***argv, pid_t pid) |
char ** | __getargv (void) |
char ** | __getargv_a (void) |
int | __getargc (void) |
int | __getexepath (char *path, int pathlen, pid_t pid) |
notagread_t | __get_no_tag_read_behaviour () |
int | __get_no_tag_ignore_ccsid1047 () |
unsigned long | __mach_absolute_time (void) |
unsigned long | getipttoken (void) |
void * | __zalloc (size_t len, size_t alignment) |
void * | anon_mmap (void *_, size_t len) |
int | __zfree (void *addr, int len) |
int | anon_munmap (void *addr, size_t len) |
int | execvpe (const char *name, char *const argv[], char *const envp[]) |
void | __atomic_store_real (int size, void *ptr, void *val, int memorder) asm("__atomic_store") |
int | __testread (const void *location) |
void | __tb (void) |
int | clock_gettime (clockid_t clk_id, struct timespec *tp) |
char * | __get_le_version (void) |
void | __build_version (void) |
void | __cpu_relax (__crwa_t *p) |
void | __tcp_clear_to_close (int socket, unsigned int secs) |
void | __unloadmod (void *mod) |
const char * | getIFAUsageErrorString (unsigned long rc) |
unsigned long long | __registerProduct (const char *major_version, const char *product_owner, const char *feature_name, const char *product_name, const char *pid) |
void * | __zalloc_for_fd (size_t len, const char *filename, int fd, off_t offset) |
void * | roanon_mmap (void *_, size_t len, int prot, int flags, const char *filename, int fd, off_t offset) |
int | __print_zoslib_help (FILE *fp, const char *title) |
int | __update_envar_settings (const char *envar) |
int | __update_envar_names (zoslib_config_t *const config) |
void * | __iterate_stack_and_get (void *dsaptr, __stack_info *si) |
int * | __get_stack_start () |
unsigned long | __get_libvec_base () |
int | futimes (int fd, const struct timeval tv[2]) |
(__EDC_TARGET < 0x42050000) && defined(ZOSLIB_ENABLE_V2R5_FEATURES) | |
int | lutimes (const char *filename, const struct timeval tv[2]) |
int | __nanosleep (const struct timespec *req, struct timespec *rem) |
void | init_zoslib_config (zoslib_config_t &config) |
void | init_zoslib_config (zoslib_config_t *const config) |
void | init_zoslib (const zoslib_config_t config) |
int | __check_le_func (void *addr, char *funcname, size_t len) |
bool | __doLogMemoryUsage () |
void | __setLogMemoryUsage (bool v) |
char * | __getMemoryUsageLogFile () |
bool | __doLogMemoryAll () |
bool | __doLogMemoryWarning () |
void | __mainTerminating () |
Variables | |
const char * | __zoslib_version = DEFAULT_BUILD_STRING |
char ** | environ |
const char * | MODULE_REGISTER_USAGE = "IFAUSAGE" |
const char * | IFAUsageErrorStrings [] |
#define __AttrPacked |
#define __USE_IARV64 1 |
#define __ZOS_CC |
#define _AE_BIMODAL 1 |
#define _ENHANCED_ASCII_EXT 0xFFFFFFFF |
#define _OPEN_MSGQ_EXT 1 |
#define _OPEN_SYS_FILE_EXT 1 |
#define _XOPEN_SOURCE 600 |
#define CHECK_LE_FUNC | ( | offset | ) | (__check_le_func((void*)((unsigned long*)__get_libvec_base() + (offset<<1)), ppa_funcname, PPA_FUNC_LENGTH)) |
#define CS | ( | _op1, | |
_op2, | |||
_op3 | |||
) | __asm volatile(" cs %0,%2,%1 \n " : "+r"(_op1), "+m"(_op2) : "r"(_op3) :) |
#define CSG | ( | _op1, | |
_op2, | |||
_op3 | |||
) | __asm volatile(" csg %0,%2,%1 \n " : "+r"(_op1), "+m"(_op2) : "r"(_op3) :) |
#define DEFAULT_BUILD_STRING "v" XSTR(MAJOR_VERSION) "." XSTR(MINOR_VERSION) "." XSTR(PATCH_VERSION) |
#define dsa | ( | ) | ((unsigned long *)_gdsa()) |
#define MAP_LE_FUNC | ( | func, | |
offset | |||
) | (func = (typeof(func))((unsigned long*)__get_libvec_base() + (offset<<1))) |
#define MAP_LE_FUNC_ELSE_ZOSLIB_FUNC | ( | func, | |
zoslibfunc, | |||
funcstring, | |||
offset | |||
) |
#define max | ( | a, | |
b | |||
) | (((a) > (b)) ? (a) : (b)) |
#define MIN | ( | a, | |
b | |||
) | ((a) < (b) ? (a) : (b)) |
#define PGTH_CURRENT 1 |
#define PGTHACOMMANDLONG 1 |
#define PPA_FUNC_LENGTH 256 |
#define STRINGIFY | ( | a | ) | #a |
#define XSTR | ( | a | ) | STRINGIFY(a) |
typedef char IfaedFeatureName[16] |
typedef int IfaedFeaturesLen |
typedef char IfaedProdID[8] |
typedef char IfaedProdMod[2] |
typedef char IfaedProdName[16] |
typedef char IfaedProdOwner[16] |
typedef char IfaedProdRel[2] |
typedef char IfaedProdToken[8] |
typedef char IfaedProdVers[2] |
typedef int IfaedReturnCode |
typedef struct IFAEDSTA_parms IFAEDSTA_parms_t |
typedef int IfaedType |
typedef unsigned long key_type |
typedef std::unordered_map<key_type,value_type,__hash_func>::const_iterator mem_cursor_t |
typedef struct timer_parm timer_parm_t |
typedef unsigned long value_type |
typedef int(* zoslib_env_hook_func) (char *) |
void __abend | ( | int | comp_code, |
unsigned | reason_code, | ||
int | flat_byte, | ||
void * | plist | ||
) |
Generates an SVC 13 abend.
[in] | comp_code | Completion code. |
[in] | reason_code | Reason code. |
[in] | flat_byte | Flat Byte. |
[in] | plist | Parameter list. |
void __atomic_store_real | ( | int | size, |
void * | ptr, | ||
void * | val, | ||
int | memorder | ||
) |
void __build_version | ( | void | ) |
Prints the build version of the library
int __check_le_func | ( | void * | addr, |
char * | funcname, | ||
size_t | len | ||
) |
Check if an LE function is present in the LE vector table
[in] | addr | address to LE function |
[out] | funcname | pointer to string that will hold the function name |
[out] | max | length of string corresponding to funcname |
void __cleanupipc | ( | int | others | ) |
Remove IPC semaphores and shared memory.
[in] | others | non-zero value indicates remove IPC not associated with current process. |
unsigned long __clock | ( | void | ) |
int __cond_timed_wait | ( | unsigned int | secs, |
unsigned int | nsecs, | ||
unsigned int | event_list, | ||
unsigned int * | secs_rem, | ||
unsigned int * | nsecs_rem | ||
) |
Suspend the calling thread until any one of a set of events has occurred or until a specified amount of time has passed.
[in] | secs | seconds to suspend |
[in] | nsecs | nanoseconds to suspend |
[in] | event_list | events that will trigger thread to resume (CW_INTRPT or CW_CONDVAR) |
[out] | secs_rem | seconds remaining |
[out] | nsecs_rem | nanoseconds remaining |
void __cpu_relax | ( | __crwa_t * | p | ) |
TODO(itodorov) - zos: document these interfaces
void __display_backtrace | ( | int | fd | ) |
Print backtrace of stack to file descriptor.
[in] | fd | file descriptor. |
void * __dlcb_entry_addr | ( | void * | dlcb | ) |
Get address of dlcb entry
[in] | dlcb | - current dlcb |
int __dlcb_entry_name | ( | char * | buf, |
int | size, | ||
void * | dlcb | ||
) |
Get entry name of given dlcb
[out] | buf | - DLL name of given dlcb |
[in] | size | - maximum number of bytes |
[in] | dlcb | - current dlcb |
int __dlcb_iterate | ( | int(*)(char *, void *, void *) | cb, |
void * | data | ||
) |
void * __dlcb_next | ( | void * | last | ) |
Get next dlcb entry
[in] | last | - previous dlcb entry |
bool __doLogMemoryAll | ( | ) |
Returns true if all messages from memory allocation and release are being displayed.
bool __doLogMemoryUsage | ( | ) |
Returns true if logging of memory allocation and release is specified.
bool __doLogMemoryWarning | ( | ) |
Returns true if only warnings from memory allocation and release are being displayed. Errors are always included if memory logging in on.
char ** __get_environ_np | ( | void | ) |
Get the environ.
__zinit * __get_instance | ( | ) |
char * __get_le_version | ( | void | ) |
Return the LE version as a string in the format of "Product %d%s Version %d Release %d Modification %d"
unsigned long __get_libvec_base | ( | void | ) |
Gets the LE libvec base address
int __get_no_tag_ignore_ccsid1047 | ( | ) |
notagread_t __get_no_tag_read_behaviour | ( | ) |
int * __get_stack_start | ( | ) |
Get the stack start address for the current thread
int __getargc | ( | void | ) |
Get program argument count of the current process
int __getargcv | ( | int * | argc, |
char *** | argv, | ||
pid_t | pid | ||
) |
Get program argument list of a given process id
[out] | argc | - pointer to store count of the arguments |
[out] | argv | - pointer to store an array of pointers that point to each argument |
[in] | pid | - process id to obtain the argc and argv for |
char ** __getargv | ( | void | ) |
Get program argument list of the current process
char ** __getargv_a | ( | void | ) |
int __getexepath | ( | char * | path, |
int | pathlen, | ||
pid_t | pid | ||
) |
Get the executable path of a given process id
[out] | path | - pointer to the destination array to copy the null-terminated path to |
[in] | pathlen | - length of the given array |
[in] | pid | - process id to obtain the executable path for |
char * __getMemoryUsageLogFile | ( | ) |
Returns the file name, including "stdout" or "stderr", used to log memory allocation and release to.
void * __iterate_stack_and_get | ( | void * | dsaptr, |
__stack_info * | si | ||
) |
Iterate to next stack dsa based on current dsa
[in] | dsaptr | - current dsa entry |
[out] | si | - stack information of next dsa |
unsigned long __mach_absolute_time | ( | void | ) |
Obtain the mach absolute time
void __mainTerminating | ( | ) |
Tell zoslib that the main process is terminating, for its diagnostics.
int __nanosleep | ( | const struct timespec * | req, |
struct timespec * | rem | ||
) |
Suspends the execution of the calling thread until either at least the time specified in *req has elapsed, an event occurs, or a signal arrives.
[in] | req | struct used to specify intervals of time with nanosecond precision |
[out] | rem | the remaining time if the call is interrupted |
int __print_zoslib_help | ( | FILE * | fp, |
const char * | title | ||
) |
Prints zoslib help information to specified FILE pointer
[in] | FILE | pointer to write to |
[in] | title | header, specify NULL for default |
unsigned long long __registerProduct | ( | const char * | major_version, |
const char * | product_owner, | ||
const char * | feature_name, | ||
const char * | product_name, | ||
const char * | pid | ||
) |
Registers product for SMF 89 Type 1 records using IFAUSAGE macro.
[in] | major_version | The major version of Product (e.g. 14) |
[in] | product_owner | The product owner (e.g. IBM) |
[in] | feature_name | The feature name (e.g. Node.js) |
[in] | product_name | The product name (e.g. Node.js for z/OS) |
[in] | pid | The Product ID (e.g. 5676-SDK) |
void __set_backtrace_on_abort | ( | bool | flag | ) |
Enable or disable abort() from calling display_backtrace(). Default is true.
void __set_ccsid_guess_buf_size | ( | int | nbytes | ) |
int __setenv_a | ( | const char * | , |
const char * | , | ||
int | |||
) |
void __setLogMemoryUsage | ( | bool | v | ) |
|
extern |
void __tb | ( | void | ) |
void __tcp_clear_to_close | ( | int | socket, |
unsigned int | secs | ||
) |
Attempts to a close a socket for a period of time
[in] | socket | socket handle |
[in] | secs | number of seconds to attempt the close |
int __testread | ( | const void * | location | ) |
TODO(itodorov) - zos: document these interfaces
|
extern |
int __update_envar_names | ( | zoslib_config_t *const | config | ) |
Changes the names of one or more of the environment variables zoslib uses
[in] | zoslib_confit_t | structure that defines the new environment variable name(s) |
int __update_envar_settings | ( | const char * | envar | ) |
Updates the zoslib global variables associated with the zoslib environment variables
[in] | envar | environment variable to update, specify NULL to update all |
void __xfer_env | ( | void | ) |
Convert environment variables from EBCDIC to ASCII.
void * __zalloc | ( | size_t | len, |
size_t | alignment | ||
) |
Allocate memory in 64-bit virtual storage when size is a megabyte multiple or above 2GB, or in 31-bit storage otherwise, and if none is available, attempt to allocate from 64-bit virtual storage.
[in] | len | length in bytes of memory to allocate |
[in] | alignment | in bytes and applies only to 31-bit storage (64-bit storage is always megabyte-aligned) |
void * __zalloc_for_fd | ( | size_t | len, |
const char * | filename, | ||
int | fd, | ||
off_t | offset | ||
) |
Allocate memory (using __zalloc()) and read into it contents of given file
[in] | len | length in bytes of memory to allocate |
[in] | filename | filename to read |
[in] | fd | file descriptor |
[in] | offset | offset in bytes into the file to read |
int __zfree | ( | void * | addr, |
int | len | ||
) |
Deallocate memory
[in] | addr | start address of memory |
[in] | len | length in bytes |
void * _gdsa | ( | ) |
void abort | ( | void | ) |
void * anon_mmap | ( | void * | _, |
size_t | len | ||
) |
Allocate memory in 64-bit virtual storage when size is a megabyte multiple or above 2GB, or in 31-bit storage (with PAGE_SIZE bytes alignment) otherwise, and if none is available, attempt to allocate from 64-bit virtual storage.
[in] | _ | ignored |
[in] | len | length in bytes of memory to allocate |
int anon_munmap | ( | void * | addr, |
size_t | len | ||
) |
Deallocate memory
[in] | addr | start address of memory |
[in] | len | length in bytes |
int backtrace | ( | void ** | buffer, |
int | size | ||
) |
Generate a backtrace and store into *Buffer.
[out] | buffer | Address of location to store backtrace to. |
[in] | size | Maximum number of bytes to store. |
char ** backtrace_symbols | ( | void *const * | buffer, |
int | size | ||
) |
Generate a backtrace symbols and store into *Buffer.
[out] | buffer | Address of location to store backtrace to. |
[in] | size | Maximum number of bytes to store. |
void backtrace_symbols_fd | ( | void *const * | buffer, |
int | size, | ||
int | fd | ||
) |
Generate a backtrace symbols and store into *Buffer.
[out] | buffer | Address of location to store backtrace to. |
[in] | size | Maximum number of bytes to store. |
[in] | fd | file descriptor. |
int clock_gettime | ( | clockid_t | clk_id, |
struct timespec * | tp | ||
) |
int execvpe | ( | const char * | name, |
char *const | argv[], | ||
char *const | envp[] | ||
) |
Execute a file.
[in] | name | used to construct a pathname that identifies the new process image file. |
[in] | argv | an array of character pointers to NULL-terminated strings. |
[in] | envp | an array of character pointers to NULL-terminated strings. |
int futimes | ( | int | fd, |
const struct timeval | tv[2] | ||
) |
(__EDC_TARGET < 0x42050000) && defined(ZOSLIB_ENABLE_V2R5_FEATURES)
Changes the access and modification times of a file
[in] | fd | file descriptor to modify |
[in] | tv | timeval structure containing new time |
int get_ipcs_overview | ( | IPCQPROC * | info | ) |
Returns the overview structure of IPCQPROC
[out] | info | address of allocated IPCQPROC structure |
const char * getIFAUsageErrorString | ( | unsigned long | rc | ) |
Retrieves error message from __registerProduct IFAUSAGE macro.
[in] | rc | return code from __registerProduct. |
unsigned long getipttoken | ( | void | ) |
int gettid | ( | ) |
Get the Thread ID.
void init_zoslib | ( | const zoslib_config_t | config | ) |
Initialize zoslib library
[in] | config | struct to configure zoslib. |
void init_zoslib_config | ( | zoslib_config_t & | config | ) |
void init_zoslib_config | ( | zoslib_config_t *const | config | ) |
Initialize the struct used to configure zoslib with default values.
[in] | config | struct to configure zoslib. |
int kill | ( | int | pid, |
int | sig | ||
) |
int lutimes | ( | const char * | filename, |
const struct timeval | tv[2] | ||
) |
Changes the access and modification times of a file
[in] | filename | file path to modify |
[in] | tv | timeval structure containing new time |
void * roanon_mmap | ( | void * | _, |
size_t | len, | ||
int | prot, | ||
int | flags, | ||
const char * | filename, | ||
int | fd, | ||
off_t | offset | ||
) |
Allocate memory (using __zalloc()) and read into it contents of given file at the given offset.
[in] | _ | ignored |
[in] | len | length in bytes of memory map |
[in] | prot | protection bits |
[in] | flags | mmap flags |
[in] | filename | filename to read |
[in] | fd | file descriptor |
[in] | offset | offset in bytes into the file to read |
int strcasecmp_ignorecp | ( | const char * | a, |
const char * | b | ||
) |
String case comparision that ignores code page.
[in] | a | - null-terminated character string. |
[in] | b | - null-terminated character string. |
int strncasecmp_ignorecp | ( | const char * | a, |
const char * | b, | ||
size_t | n | ||
) |
String case comparision that ignores code page.
[in] | a | - Character String. |
[in] | b | - Character String. |
[in] | n | - Number of bytes to compare. |
const char* __zoslib_version = DEFAULT_BUILD_STRING |
|
extern |
const char* IFAUsageErrorStrings[] |
const char* MODULE_REGISTER_USAGE = "IFAUSAGE" |