|
zoslib
z/OS C/C++ Library
|
#include <_Nascii.h>#include <stdarg.h>#include <stdbool.h>#include <stdio.h>#include <sys/__getipc.h>#include <sys/ipc.h>#include <sys/shm.h>#include <sys/time.h>#include <sys/types.h>#include <sys/socket.h>#include <time.h>#include <unistd.h>#include "zos-macros.h"#include "zos-bpx.h"#include "zos-char-util.h"#include "zos-io.h"#include "zos-savstack.h"#include "zos-sys-info.h"#include "zos-tls.h"#include "zos-getentropy.h"Go to the source code of this file.
Classes | |
| struct | __stack_info |
| struct | __cpu_relax_workarea |
| struct | zoslib_config |
Macros | |
| #define | __ZOS_EXT__ 1 |
| #define | __ZOS_CC |
| #define | IPC_CLEANUP_ENVAR_DEFAULT "__IPC_CLEANUP" |
| #define | RUNTIME_LIMIT_ENVAR_DEFAULT "__RUNTIMELIMIT" |
| #define | CCSID_GUESS_BUF_SIZE_DEFAULT "__CCSIDGUESSBUFSIZE" |
| #define | UNTAGGED_READ_MODE_DEFAULT "__UNTAGGED_READ_MODE" |
| #define | UNTAGGED_READ_MODE_CCSID1047_DEFAULT "__UNTAGGED_READ_MODE_CCSID1047" |
| #define | MEMORY_USAGE_LOG_FILE_ENVAR_DEFAULT "__MEMORY_USAGE_LOG_FILE" |
| #define | MEMORY_USAGE_LOG_LEVEL_ENVAR_DEFAULT "__MEMORY_USAGE_LOG_LEVEL" |
Typedefs | |
| typedef struct __stack_info | __stack_info |
| typedef struct __cpu_relax_workarea | __crwa_t |
| typedef struct __Z_EXPORT zoslib_config | zoslib_config_t |
Enumerations | |
| enum | notagread_t { __NO_TAG_READ_DEFAULT = 0 , __NO_TAG_READ_DEFAULT_WITHWARNING = 1 , __NO_TAG_READ_V6 = 2 , __NO_TAG_READ_STRICT = 3 } |
| enum | COND_TIME_WAIT_CONSTANTS { CW_INTRPT = 1 , CW_CONDVAR = 32 } |
Functions | |
| __Z_EXPORT char ** | __get_environ_np (void) |
| __Z_EXPORT void | __xfer_env (void) |
| __Z_EXPORT void | __cleanupipc (int others) |
| __Z_EXPORT const char * | getIFAUsageErrorString (unsigned long rc) |
| __Z_EXPORT unsigned long long | __registerProduct (const char *major_version, const char *product_owner, const char *feature_name, const char *product_name, const char *pid) |
| __Z_EXPORT int | gettid () |
| __Z_EXPORT int | __getMainThreadId () |
| __Z_EXPORT pthread_t | __getMainThreadSelf () |
| __Z_EXPORT void | __display_backtrace (int fd) |
| __Z_EXPORT void | __set_backtrace_on_abort (bool flag) |
| __Z_EXPORT int | backtrace (void **buffer, int size) |
| __Z_EXPORT char ** | backtrace_symbols (void *const *buffer, int size) |
| __Z_EXPORT void | backtrace_symbols_fd (void *const *buffer, int size, int fd) |
| __Z_EXPORT void | __abend (int comp_code, unsigned reason_code, int flat_byte, void *plist) |
| __Z_EXPORT int | strncasecmp_ignorecp (const char *a, const char *b, size_t n) |
| __Z_EXPORT int | strcasecmp_ignorecp (const char *a, const char *b) |
| __Z_EXPORT int | __getargcv (int *argc, char ***argv, pid_t pid) |
| __Z_EXPORT int | __getexepath (char *path, int pathlen, pid_t pid) |
| __Z_EXPORT char ** | __getargv (void) |
| __Z_EXPORT int | __getargc (void) |
| __Z_EXPORT int * | __get_stack_start () |
| __Z_EXPORT void * | __iterate_stack_and_get (void *dsaptr, __stack_info *si) |
| __Z_EXPORT void * | __dlcb_next (void *last) |
| __Z_EXPORT int | __dlcb_entry_name (char *buf, int size, void *dlcb) |
| __Z_EXPORT void * | __dlcb_entry_addr (void *dlcb) |
| __Z_EXPORT int | __dlcb_iterate (int(*cb)(char *name, void *addr, void *data), void *data) |
| __Z_EXPORT unsigned long | __mach_absolute_time (void) |
| __Z_EXPORT void * | __zalloc (size_t len, size_t alignment) |
| __Z_EXPORT void * | anon_mmap (void *_, size_t len) |
| __Z_EXPORT void * | __zalloc_for_fd (size_t len, const char *filename, int fd, off_t offset) |
| __Z_EXPORT void * | roanon_mmap (void *_, size_t len, int prot, int flags, const char *filename, int fd, off_t offset) |
| __Z_EXPORT int | __zfree (void *addr, int len) |
| __Z_EXPORT int | anon_munmap (void *addr, size_t len) |
| int | __check_le_func (void *addr, char *funcname, size_t len) |
| __Z_EXPORT int | __cond_timed_wait (unsigned int secs, unsigned int nsecs, unsigned int event_list, unsigned int *secs_rem, unsigned int *nsecs_rem) |
| __Z_EXPORT int | __getentropy (void *buffer, size_t length) |
| __Z_EXPORT char * | __get_le_version (void) |
| __Z_EXPORT void | __build_version (void) |
| __Z_EXPORT void | __tcp_clear_to_close (int socket, unsigned int secs) |
| __Z_EXPORT int | get_ipcs_overview (IPCQPROC *info) |
| __Z_EXPORT int | __print_zoslib_help (FILE *fp, const char *title) |
| __Z_EXPORT void | __cpu_relax (__crwa_t *) |
| __Z_EXPORT int | __testread (const void *location) |
| __Z_EXPORT void | __tb (void) |
| __Z_EXPORT notagread_t | __get_no_tag_read_behaviour () |
| __Z_EXPORT int | __get_no_tag_ignore_ccsid1047 () |
| __Z_EXPORT void | init_zoslib (const zoslib_config_t config) |
| __Z_EXPORT void | init_zoslib_config (zoslib_config_t *const config) |
| __Z_EXPORT int | __update_envar_settings (const char *envar) |
| unsigned long | __get_libvec_base (void) |
| __Z_EXPORT int | __update_envar_names (zoslib_config_t *const config) |
| __Z_EXPORT bool | __doLogMemoryUsage () |
| __Z_EXPORT char * | __getMemoryUsageLogFile () |
| __Z_EXPORT bool | __doLogMemoryAll () |
| __Z_EXPORT bool | __doLogMemoryWarning () |
| __Z_EXPORT void | __mainTerminating () |
Variables | |
| const char * | __zoslib_version |
| #define __ZOS_CC |
| #define __ZOS_EXT__ 1 |
| #define CCSID_GUESS_BUF_SIZE_DEFAULT "__CCSIDGUESSBUFSIZE" |
| #define IPC_CLEANUP_ENVAR_DEFAULT "__IPC_CLEANUP" |
| #define MEMORY_USAGE_LOG_FILE_ENVAR_DEFAULT "__MEMORY_USAGE_LOG_FILE" |
| #define MEMORY_USAGE_LOG_LEVEL_ENVAR_DEFAULT "__MEMORY_USAGE_LOG_LEVEL" |
| #define RUNTIME_LIMIT_ENVAR_DEFAULT "__RUNTIMELIMIT" |
| #define UNTAGGED_READ_MODE_CCSID1047_DEFAULT "__UNTAGGED_READ_MODE_CCSID1047" |
| #define UNTAGGED_READ_MODE_DEFAULT "__UNTAGGED_READ_MODE" |
| typedef struct __cpu_relax_workarea __crwa_t |
| typedef struct __stack_info __stack_info |
| typedef struct __Z_EXPORT zoslib_config zoslib_config_t |
Configuration for zoslib library
| enum notagread_t |
| __Z_EXPORT 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. |
| __Z_EXPORT 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 |
| __Z_EXPORT void __cleanupipc | ( | int | others | ) |
Remove IPC semaphores and shared memory.
| [in] | others | non-zero value indicates remove IPC not associated with current process. |
| __Z_EXPORT 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 |
| __Z_EXPORT void __cpu_relax | ( | __crwa_t * | p | ) |
TODO(itodorov) - zos: document these interfaces
| __Z_EXPORT void __display_backtrace | ( | int | fd | ) |
Print backtrace of stack to file descriptor.
| [in] | fd | file descriptor. |
| __Z_EXPORT void * __dlcb_entry_addr | ( | void * | dlcb | ) |
Get address of dlcb entry
| [in] | dlcb | - current dlcb |
| __Z_EXPORT 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 |
| __Z_EXPORT int __dlcb_iterate | ( | int(*)(char *name, void *addr, void *data) | cb, |
| void * | data | ||
| ) |
Walk through list of dlcb
| [in] | cb | - callback function for each dlcb, the callback will have the name, the address and data, which is a copy of whatever value was passed as the second argument, as input parameters |
| [in] | data | - pass to callback |
| __Z_EXPORT void * __dlcb_next | ( | void * | last | ) |
Get next dlcb entry
| [in] | last | - previous dlcb entry |
| __Z_EXPORT bool __doLogMemoryAll | ( | ) |
Returns true if all messages from memory allocation and release are being displayed.
| __Z_EXPORT bool __doLogMemoryUsage | ( | ) |
Returns true if logging of memory allocation and release is specified.
| __Z_EXPORT bool __doLogMemoryWarning | ( | ) |
Returns true if only warnings from memory allocation and release are being displayed. Errors are always included if memory logging in on.
| __Z_EXPORT char ** __get_environ_np | ( | void | ) |
Get the environ.
| __Z_EXPORT 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
| __Z_EXPORT int __get_no_tag_ignore_ccsid1047 | ( | ) |
| __Z_EXPORT notagread_t __get_no_tag_read_behaviour | ( | ) |
| __Z_EXPORT int * __get_stack_start | ( | ) |
Get the stack start address for the current thread
| __Z_EXPORT int __getargc | ( | void | ) |
Get program argument count of the current process
| __Z_EXPORT 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 |
| __Z_EXPORT char ** __getargv | ( | void | ) |
Get program argument list of the current process
| __Z_EXPORT int __getentropy | ( | void * | buffer, |
| size_t | length | ||
| ) |
Fill a buffer with random bytes
| [out] | buffer | to store random bytes to. |
| [in] | number | of random bytes to generate. |
| __Z_EXPORT 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 |
| __Z_EXPORT int __getMainThreadId | ( | ) |
Get the main Thread ID. If a process is started with sh -c, main thread id is 0; if started with bash -c, main thread id is 2; if started directly from the shell, main thread id is 1.
| __Z_EXPORT pthread_t __getMainThreadSelf | ( | ) |
Get the pthread_self() for the main thread.
| __Z_EXPORT char * __getMemoryUsageLogFile | ( | ) |
Returns the file name, including "stdout" or "stderr", used to log memory allocation and release to.
| __Z_EXPORT 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 |
| __Z_EXPORT unsigned long __mach_absolute_time | ( | void | ) |
Obtain the mach absolute time
| __Z_EXPORT void __mainTerminating | ( | ) |
Tell zoslib that the main process is terminating, for its diagnostics.
| __Z_EXPORT 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 |
| __Z_EXPORT 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) |
| __Z_EXPORT void __set_backtrace_on_abort | ( | bool | flag | ) |
Enable or disable abort() from calling display_backtrace(). Default is true.
| __Z_EXPORT void __tb | ( | void | ) |
| __Z_EXPORT 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 |
| __Z_EXPORT int __testread | ( | const void * | location | ) |
TODO(itodorov) - zos: document these interfaces
| __Z_EXPORT 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) |
| __Z_EXPORT 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 |
| __Z_EXPORT void __xfer_env | ( | void | ) |
Convert environment variables from EBCDIC to ASCII.
| __Z_EXPORT 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) |
| __Z_EXPORT 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 |
| __Z_EXPORT int __zfree | ( | void * | addr, |
| int | len | ||
| ) |
Deallocate memory
| [in] | addr | start address of memory |
| [in] | len | length in bytes |
| __Z_EXPORT 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 |
| __Z_EXPORT int anon_munmap | ( | void * | addr, |
| size_t | len | ||
| ) |
Deallocate memory
| [in] | addr | start address of memory |
| [in] | len | length in bytes |
| __Z_EXPORT 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. |
| __Z_EXPORT 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. |
| __Z_EXPORT 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. |
| __Z_EXPORT int get_ipcs_overview | ( | IPCQPROC * | info | ) |
Returns the overview structure of IPCQPROC
| [out] | info | address of allocated IPCQPROC structure |
| __Z_EXPORT const char * getIFAUsageErrorString | ( | unsigned long | rc | ) |
Retrieves error message from __registerProduct IFAUSAGE macro.
| [in] | rc | return code from __registerProduct. |
| __Z_EXPORT int gettid | ( | ) |
Get the Thread ID.
| __Z_EXPORT void init_zoslib | ( | const zoslib_config_t | config | ) |
Initialize zoslib library
| [in] | config | struct to configure zoslib. |
| __Z_EXPORT 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. |
| __Z_EXPORT 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 |
| __Z_EXPORT 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. |
| __Z_EXPORT 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. |
|
extern |