Rizin
unix-like reverse engineering framework and cli tools
|
#include <assert.h>
#include <direct.h>
#include <limits.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <wchar.h>
#include "uv.h"
#include "internal.h"
#include <winsock2.h>
#include <winperf.h>
#include <iphlpapi.h>
#include <psapi.h>
#include <tlhelp32.h>
#include <windows.h>
#include <userenv.h>
#include <math.h>
Go to the source code of this file.
Macros | |
#define | MAX_TITLE_LENGTH 8192 |
#define | UV__NANOSEC 1000000000 |
#define | UNLEN 256 |
Variables | |
static char * | process_title |
static CRITICAL_SECTION | process_title_lock |
static uint64_t | hrtime_frequency_ = 0 |
|
static |
Definition at line 790 of file util.c.
References AF_INET6, assert(), and i.
Referenced by uv_interface_addresses().
|
static |
Referenced by uv__random_rtlgenrandom().
Definition at line 1280 of file util.c.
References DWORD, NULL, uv__free(), uv__malloc(), and uv_translate_sys_error().
Referenced by fs__readdir(), uv__get_process_title(), uv__getpwuid_r(), uv_cpu_info(), uv_os_environ(), and uv_process_fs_event_req().
Definition at line 1335 of file util.c.
References L, NULL, uv__free(), uv__malloc(), and uv_translate_sys_error().
Referenced by uv_os_getenv(), uv_os_setenv(), and uv_os_unsetenv().
Definition at line 1692 of file util.c.
References access, FALSE, handle, NULL, pid, r, and uv_translate_sys_error().
Referenced by uv_os_getpriority(), and uv_os_setpriority().
|
static |
Definition at line 443 of file util.c.
References MAX_TITLE_LENGTH, process_title, and uv__convert_utf16_to_utf8().
Referenced by uv_get_process_title().
int uv__getpwuid_r | ( | uv_passwd_t * | pwd | ) |
Definition at line 1369 of file util.c.
References ARRAY_SIZE, DWORD, uv_passwd_s::gid, HANDLE, uv_passwd_s::homedir, NULL, path, r, uv_passwd_s::shell, uv_passwd_s::uid, UNLEN, uv_passwd_s::username, uv__convert_utf16_to_utf8(), uv__free(), uv__malloc(), and uv_translate_sys_error().
Referenced by uv_os_get_passwd(), and uv_os_homedir().
Definition at line 495 of file util.c.
References assert(), counter, hrtime_frequency_, and uv_fatal_error().
Referenced by uv_hrtime().
Definition at line 1965 of file util.c.
References buflen, FALSE, and SystemFunction036().
Referenced by fs__mktemp(), and uv__random().
void uv__util_init | ( | void | ) |
Definition at line 79 of file util.c.
References hrtime_frequency_, process_title_lock, and uv_fatal_error().
Referenced by uv_init().
Definition at line 227 of file util.c.
References chdir, L, NULL, UV__ERR, uv__free(), uv__malloc(), and uv_translate_sys_error().
int uv_cpu_info | ( | uv_cpu_info_t ** | cpu_infos_ptr, |
int * | cpu_count_ptr | ||
) |
Definition at line 634 of file util.c.
References ARRAY_SIZE, assert(), count, uv_cpu_info_s::cpu_times, DWORD, err, error(), i, uv_cpu_times_s::idle, _SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION::IdleTime, setup::idx, int, _SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION::InterruptTime, uv_cpu_times_s::irq, _SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION::KernelTime, L, len, uv_cpu_info_s::model, ncpus, uv_cpu_times_s::nice, NT_SUCCESS, NULL, pNtQuerySystemInformation, pRtlNtStatusToDosError, uv_cpu_info_s::speed, status, uv_cpu_times_s::sys, SystemProcessorPerformanceInformation, ULONG, uv_cpu_times_s::user, _SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION::UserTime, uv__calloc(), uv__convert_utf16_to_utf8(), uv__free(), uv__malloc(), uv__once_init(), uv__strdup(), uv__strscpy(), and uv_translate_sys_error().
Referenced by setup_workers().
Definition at line 154 of file util.c.
References DWORD, ERANGE, INT_MAX, L, NULL, r, UV__ERR, uv__free(), uv__malloc(), UV__PATH_MAX, and uv_translate_sys_error().
Definition at line 96 of file util.c.
References args, err, error(), init_process_title_mutex_once(), int, L, memcpy(), NULL, original_exepath, process_title_mutex, process_title_mutex_once, uv__free(), uv__malloc(), UV__PATH_MAX, uv__search_path(), uv_mutex_lock(), uv_mutex_unlock(), uv_once(), and uv_translate_sys_error().
Referenced by invoke_cgi_script(), main(), and setup_workers().
void uv_free_interface_addresses | ( | uv_interface_address_t * | addresses, |
int | count | ||
) |
uint64_t uv_get_constrained_memory | ( | void | ) |
uint64_t uv_get_free_memory | ( | void | ) |
Definition at line 457 of file util.c.
References assert(), init_process_title_mutex_once(), len, memcpy(), NULL, process_argv, process_title, process_title_lock, process_title_mutex, process_title_mutex_once, uv__get_process_title(), uv__once_init(), uv_mutex_lock(), uv_mutex_unlock(), uv_once(), and uv_translate_sys_error().
uint64_t uv_get_total_memory | ( | void | ) |
int uv_getrusage | ( | uv_rusage_t * | uv_rusage | ) |
Definition at line 1104 of file util.c.
References memset(), rusage::ru_idrss, rusage::ru_inblock, uv_rusage_t::ru_inblock, rusage::ru_isrss, rusage::ru_ixrss, rusage::ru_majflt, uv_rusage_t::ru_majflt, rusage::ru_maxrss, uv_rusage_t::ru_maxrss, rusage::ru_minflt, rusage::ru_msgrcv, rusage::ru_msgsnd, rusage::ru_nivcsw, rusage::ru_nsignals, rusage::ru_nswap, rusage::ru_nvcsw, rusage::ru_oublock, uv_rusage_t::ru_oublock, rusage::ru_stime, uv_rusage_t::ru_stime, rusage::ru_utime, uv_rusage_t::ru_utime, timeval::tv_sec, uv_timeval_t::tv_sec, timeval::tv_usec, uv_timeval_t::tv_usec, usage(), UV__ERR, and uv_translate_sys_error().
int uv_gettimeofday | ( | uv_timeval64_t * | tv | ) |
Definition at line 1948 of file util.c.
References gettimeofday, NULL, time, tv, and UV__ERR.
uint64_t uv_hrtime | ( | void | ) |
Definition at line 490 of file util.c.
References uv__hrtime(), UV__NANOSEC, uv__once_init(), and UV_CLOCK_PRECISE.
Referenced by uv__metrics_set_provider_entry_time(), uv__metrics_update_idle_time(), and uv_metrics_idle_time().
int uv_interface_addresses | ( | uv_interface_address_t ** | addresses_ptr, |
int * | count_ptr | ||
) |
Definition at line 824 of file util.c.
References ADDR_SIZE, uv_interface_address_s::address, uv_interface_address_s::address4, uv_interface_address_s::address6, address_prefix_match(), AF_INET, AF_INET6, AF_UNSPEC, assert(), cleanup(), count, FALSE, flags, i, INT_MAX, ioctl, uv_interface_address_s::is_internal, is_windows_version_or_greater(), memcpy(), memset(), uv_interface_address_s::name, uv_interface_address_s::netmask, uv_interface_address_s::netmask4, uv_interface_address_s::netmask6, NULL, p, uv_interface_address_s::phys_addr, prefix, r, in_addr::s_addr, sockaddr_in6::sin6_addr, sockaddr_in::sin_addr, SOCK_DGRAM, socket, sockfd, ULONG, uv__calloc(), uv__close(), UV__ERR, uv__free(), uv__malloc(), uv__strdup(), uv__strscpy(), uv_free_interface_addresses(), and uv_translate_sys_error().
Referenced by main().
void uv_loadavg | ( | double | avg[3] | ) |
int uv_os_environ | ( | uv_env_item_t ** | envitems, |
int * | count | ||
) |
Definition at line 1447 of file util.c.
References buf, count, env, environ, fail, i, L, uv_env_item_s::name, NULL, uv__calloc(), uv__convert_utf16_to_utf8(), uv__free(), uv__strdup(), and uv_env_item_s::value.
void uv_os_free_passwd | ( | uv_passwd_t * | pwd | ) |
Definition at line 1262 of file util.c.
References uv_passwd_s::homedir, NULL, uv_passwd_s::shell, uv_passwd_s::username, and uv__free().
Referenced by uv_os_homedir().
int uv_os_get_passwd | ( | uv_passwd_t * | pwd | ) |
Definition at line 1518 of file util.c.
References ARRAY_SIZE, DWORD, fail, getenv(), len, memcpy(), NULL, r, uv__convert_utf8_to_utf16(), uv__free(), uv__malloc(), and uv_translate_sys_error().
Referenced by uv_os_homedir().
Definition at line 1666 of file util.c.
References buf, len, memcpy(), NULL, UV__ERR, uv__once_init(), UV_MAXHOSTNAMESIZE, and uv_translate_sys_error().
uv_pid_t uv_os_getpid | ( | void | ) |
uv_pid_t uv_os_getppid | ( | void | ) |
Definition at line 1713 of file util.c.
References getpriority, handle, HANDLE, NULL, pid, r, UV__ERR, uv__get_handle(), UV_PRIORITY_ABOVE_NORMAL, UV_PRIORITY_BELOW_NORMAL, UV_PRIORITY_HIGH, UV_PRIORITY_HIGHEST, UV_PRIORITY_LOW, UV_PRIORITY_NORMAL, and uv_translate_sys_error().
Definition at line 1160 of file util.c.
References uv_passwd_s::homedir, len, memcpy(), r, uv__getpwuid_r(), uv_os_free_passwd(), and uv_os_getenv().
Definition at line 1613 of file util.c.
References NULL, r, uv__convert_utf8_to_utf16(), UV__ERR, uv__free(), uv_translate_sys_error(), and value.
Definition at line 1752 of file util.c.
References handle, HANDLE, pid, r, setpriority, UV__ERR, uv__get_handle(), UV_PRIORITY_ABOVE_NORMAL, UV_PRIORITY_BELOW_NORMAL, UV_PRIORITY_HIGH, UV_PRIORITY_LOW, UV_PRIORITY_NORMAL, and uv_translate_sys_error().
Definition at line 1197 of file util.c.
References buf, CHECK_ENV_VAR, DWORD, L, len, memcpy(), NULL, path, uv__free(), uv__malloc(), and uv_translate_sys_error().
int uv_os_uname | ( | uv_utsname_t * | buffer | ) |
Definition at line 1786 of file util.c.
References assert(), DWORD, error(), L, NULL, pRtlGetVersion, PVOID, r, snprintf, uname, UV__ERR, uv__once_init(), uv__strscpy(), and uv_translate_sys_error().
Definition at line 1644 of file util.c.
References NULL, r, uv__convert_utf8_to_utf16(), UV__ERR, uv__free(), and uv_translate_sys_error().
Definition at line 394 of file util.c.
References args_mem, done, err, init_process_title_mutex_once(), L, length, MAX_TITLE_LENGTH, NULL, process_argc, process_argv, process_title, process_title_lock, process_title_mutex, process_title_mutex_once, process_title_ptr, uv__free(), uv__malloc(), uv__once_init(), uv__strdup(), uv_fatal_error(), uv_mutex_lock(), uv_mutex_unlock(), uv_once(), and uv_translate_sys_error().
char** uv_setup_args | ( | int | argc, |
char ** | argv | ||
) |
Definition at line 385 of file util.c.
References args_mem, argv, i, init_process_title_mutex_once(), memcpy(), NULL, original_exepath, process_argc, process_argv, process_title_mutex, process_title_mutex_once, s, uv__malloc(), UV__PATH_MAX, uv__search_path(), uv__strdup(), uv_mutex_lock(), uv_mutex_unlock(), and uv_once().
int uv_uptime | ( | double * | uptime | ) |
Definition at line 533 of file util.c.
References buffer_size, DWORD, entries(), i, L, LONG, NULL, time, uv__free(), uv__malloc(), uv_translate_sys_error(), and value.
|
static |
Definition at line 73 of file util.c.
Referenced by uv__hrtime(), and uv__util_init().
|
static |
Definition at line 69 of file util.c.
Referenced by uv__get_process_title(), uv_get_process_title(), and uv_set_process_title().
|
static |
Definition at line 70 of file util.c.
Referenced by uv__util_init(), uv_get_process_title(), and uv_set_process_title().