32 #include <sys/types.h>
33 #include <sys/socket.h>
34 #include <sys/ioctl.h>
36 #include <netinet/in.h>
37 #include <arpa/inet.h>
45 #include <sys/protosw.h>
48 #include <sys/procfs.h>
52 #include <sys/mntctl.h>
53 #include <sys/vmount.h>
56 #include <sys/vnode.h>
58 #include <as400_protos.h>
59 #include <as400_types.h>
68 char current_date_and_time[8];
107 unsigned char loca_adapter_address[12];
118 static const unsigned char e2a[256] = {
119 0, 1, 2, 3, 156, 9, 134, 127, 151, 141, 142, 11, 12, 13, 14, 15,
120 16, 17, 18, 19, 157, 133, 8, 135, 24, 25, 146, 143, 28, 29, 30, 31,
121 128, 129, 130, 131, 132, 10, 23, 27, 136, 137, 138, 139, 140, 5, 6, 7,
122 144, 145, 22, 147, 148, 149, 150, 4, 152, 153, 154, 155, 20, 21, 158, 26,
123 32, 160, 161, 162, 163, 164, 165, 166, 167, 168, 91, 46, 60, 40, 43, 33,
124 38, 169, 170, 171, 172, 173, 174, 175, 176, 177, 93, 36, 42, 41, 59, 94,
125 45, 47, 178, 179, 180, 181, 182, 183, 184, 185, 124, 44, 37, 95, 62, 63,
126 186, 187, 188, 189, 190, 191, 192, 193, 194, 96, 58, 35, 64, 39, 61, 34,
127 195, 97, 98, 99, 100, 101, 102, 103, 104, 105, 196, 197, 198, 199, 200, 201,
128 202, 106, 107, 108, 109, 110, 111, 112, 113, 114, 203, 204, 205, 206, 207, 208,
129 209, 126, 115, 116, 117, 118, 119, 120, 121, 122, 210, 211, 212, 213, 214, 215,
130 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231,
131 123, 65, 66, 67, 68, 69, 70, 71, 72, 73, 232, 233, 234, 235, 236, 237,
132 125, 74, 75, 76, 77, 78, 79, 80, 81, 82, 238, 239, 240, 241, 242, 243,
133 92, 159, 83, 84, 85, 86, 87, 88, 89, 90, 244, 245, 246, 247, 248, 249,
134 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 250, 251, 252, 253, 254, 255};
137 static const unsigned char a2e[256] = {
138 0, 1, 2, 3, 55, 45, 46, 47, 22, 5, 37, 11, 12, 13, 14, 15,
139 16, 17, 18, 19, 60, 61, 50, 38, 24, 25, 63, 39, 28, 29, 30, 31,
140 64, 79, 127, 123, 91, 108, 80, 125, 77, 93, 92, 78, 107, 96, 75, 97,
141 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 122, 94, 76, 126, 110, 111,
142 124, 193, 194, 195, 196, 197, 198, 199, 200, 201, 209, 210, 211, 212, 213, 214,
143 215, 216, 217, 226, 227, 228, 229, 230, 231, 232, 233, 74, 224, 90, 95, 109,
144 121, 129, 130, 131, 132, 133, 134, 135, 136, 137, 145, 146, 147, 148, 149, 150,
145 151, 152, 153, 162, 163, 164, 165, 166, 167, 168, 169, 192, 106, 208, 161, 7,
146 32, 33, 34, 35, 36, 21, 6, 23, 40, 41, 42, 43, 44, 9, 10, 27,
147 48, 49, 26, 51, 52, 53, 54, 8, 56, 57, 58, 59, 4, 20, 62, 225,
148 65, 66, 67, 68, 69, 70, 71, 72, 73, 81, 82, 83, 84, 85, 86, 87,
149 88, 89, 98, 99, 100, 101, 102, 103, 104, 105, 112, 113, 114, 115, 116, 117,
150 118, 119, 120, 128, 138, 139, 140, 141, 142, 143, 144, 154, 155, 156, 157, 158,
151 159, 160, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183,
152 184, 185, 186, 187, 188, 189, 190, 191, 202, 203, 204, 205, 206, 207, 218, 219,
153 220, 221, 222, 223, 234, 235, 236, 237, 238, 239, 250, 251, 252, 253, 254, 255};
167 srclen = strlen(
src);
170 for (
i = 0;
i < srclen;
i++)
183 unsigned int rcvrlen =
sizeof(*rcvr);
184 unsigned char format[8], reset_status[10];
187 iconv_a2e(
"SSTS0200", format,
sizeof(format));
189 iconv_a2e(
"*NO", reset_status,
sizeof(reset_status));
198 void* qwcrssts_argv[6];
201 int rc = _RSLOBJ2(&qwcrssts_pointer, RSLOBJ_TS_PGM,
"QWCRSSTS",
"QSYS");
207 memset(rcvr, 0,
sizeof(*rcvr));
210 memset(&errcode, 0,
sizeof(errcode));
214 qwcrssts_argv[0] = rcvr;
215 qwcrssts_argv[1] = &rcvrlen;
216 qwcrssts_argv[2] = &format;
217 qwcrssts_argv[3] = &reset_status;
218 qwcrssts_argv[4] = &errcode;
219 qwcrssts_argv[5] =
NULL;
222 rc = _PGMCALL(&qwcrssts_pointer, qwcrssts_argv, 0);
257 avg[0] = avg[1] = avg[2] = 0;
265 double processing_unit_used_percent =
268 avg[0] = avg[1] = avg[2] = processing_unit_used_percent;
284 unsigned int numcpus,
idx = 0;
290 numcpus = sysconf(_SC_NPROCESSORS_ONLN);
297 cpu_info = *cpu_infos;
317 unsigned int rcvrlen =
sizeof(rcvr);
318 unsigned char format[8], line_name[10];
323 iconv_a2e(
"LIND0500", format,
sizeof(format));
335 void* qdcrlind_argv[6];
338 int rc = _RSLOBJ2(&qdcrlind_pointer, RSLOBJ_TS_PGM,
"QDCRLIND",
"QSYS");
344 memset(&rcvr, 0,
sizeof(rcvr));
348 err.bytes_provided =
sizeof(
err);
351 qdcrlind_argv[0] = &rcvr;
352 qdcrlind_argv[1] = &rcvrlen;
353 qdcrlind_argv[2] = &format;
354 qdcrlind_argv[3] = &line_name;
355 qdcrlind_argv[4] = &
err;
356 qdcrlind_argv[5] =
NULL;
359 rc = _PGMCALL(&qdcrlind_pointer, qdcrlind_argv, 0);
368 int r = sscanf(mac_addr,
"%02x%02x%02x%02x%02x%02x",
369 &
c[0], &
c[1], &
c[2], &
c[3], &
c[4], &
c[5]);
372 (*phys_addr)[0] =
c[0];
373 (*phys_addr)[1] =
c[1];
374 (*phys_addr)[2] =
c[2];
375 (*phys_addr)[3] =
c[3];
376 (*phys_addr)[4] =
c[4];
377 (*phys_addr)[5] =
c[5];
379 memset(*phys_addr, 0,
sizeof(*phys_addr));
388 struct ifaddrs_pase *ifap =
NULL, *cur;
394 if (Qp2getifaddrs(&ifap))
398 for (cur = ifap; cur; cur = cur->ifa_next) {
399 if (!(cur->ifa_addr->sa_family ==
AF_INET6 ||
400 cur->ifa_addr->sa_family ==
AF_INET))
403 if (!(cur->ifa_flags & IFF_UP && cur->ifa_flags & IFF_RUNNING))
410 Qp2freeifaddrs(ifap);
416 if (*addresses ==
NULL) {
417 Qp2freeifaddrs(ifap);
420 address = *addresses;
423 for (cur = ifap; cur; cur = cur->ifa_next) {
424 if (!(cur->ifa_addr->sa_family ==
AF_INET6 ||
425 cur->ifa_addr->sa_family ==
AF_INET))
428 if (!(cur->ifa_flags & IFF_UP && cur->ifa_flags & IFF_RUNNING))
433 inet6 = (cur->ifa_addr->sa_family ==
AF_INET6);
444 address->
is_internal = cur->ifa_flags & IFF_LOOPBACK ? 1 : 0;
454 Qp2freeifaddrs(ifap);
476 size =
sizeof(exepath);
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void count
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void static offset struct stat static buf void long static basep static whence static length const void static len static semflg const void static shmflg const struct timespec struct timespec static rem const char static group const void length
static void iconv_a2e(const char *src, unsigned char dst[], size_t length)
uint64_t uv_get_total_memory(void)
void uv_loadavg(double avg[3])
uint64_t uv_get_free_memory(void)
int uv_interface_addresses(uv_interface_address_t **addresses, int *count)
static int get_ibmi_physical_address(const char *line, char(*phys_addr)[6])
static const unsigned char a2e[256]
void uv__process_title_cleanup(void)
uv_once_t process_title_mutex_once
void init_process_title_mutex_once(void)
char ** uv_setup_args(int argc, char **argv)
int uv_uptime(double *uptime)
void uv_free_interface_addresses(uv_interface_address_t *addresses, int count)
int uv_cpu_info(uv_cpu_info_t **cpu_infos, int *count)
uint64_t uv_get_constrained_memory(void)
static const unsigned char e2a[256]
static int get_ibmi_system_status(SSTS0200 *rcvr)
static void iconv_e2a(unsigned char src[], unsigned char dst[], size_t length)
int uv_set_process_title(const char *title)
int uv_get_process_title(char *buffer, size_t size)
int uv_resident_set_memory(size_t *rss)
uv_mutex_t process_title_mutex
return memset(p, 0, total)
static static fork const void static count static fd const char const char static newpath char char argv
#define header(is_bt, len_min, ret_op)
unsigned char loca_adapter_address[12]
int percent_system_asp_used
int current_unprotected_storage_used
int percent_temporary_addresses
int percent_temporary_256mb_segments_used
int percent_permanent_addresses
int percent_permanent_256mb_segments_used
int maximum_jobs_in_system
int percent_processing_unit_used
int percent_temporary_4gb_segments_used
int percent_shared_processor_pool_used
int percent_current_interactive_performance
int current_processing_capacity
char processor_sharing_attribute
int total_auxiliary_storage
int active_jobs_in_system
int percent_db_capability
int maximum_unprotected_storage_used
long main_storage_size_long
char restricted_state_flag
int active_threads_in_system
int percent_uncapped_cpu_capacity_used
int percent_permanent_4gb_segments_used
struct uv_cpu_times_s cpu_times
struct sockaddr_in6 netmask6
struct sockaddr_in6 address6
struct sockaddr_in netmask4
union uv_interface_address_s::@399 netmask
union uv_interface_address_s::@398 address
struct sockaddr_in address4
int uv__search_path(const char *prog, char *buf, size_t *buflen)
pthread_mutex_t uv_mutex_t
char * uv__strdup(const char *s)
void * uv__malloc(size_t size)
void * uv__calloc(size_t count, size_t size)
UV_EXTERN void uv_mutex_lock(uv_mutex_t *handle)
UV_EXTERN void uv_once(uv_once_t *guard, void(*callback)(void))
UV_EXTERN void uv_mutex_unlock(uv_mutex_t *handle)
UV_EXTERN int uv_mutex_init(uv_mutex_t *handle)