commit 45fff0a511942d410d657be31bdbdf10a45a6a57 (tree) parent 87083e8e7e440548599b88eb9ce02e4914a72809 Author: Alex Rønne Petersen <alex@alexrp.com> Date: Sat, 30 Nov 2024 13:13:08 +0100 mingw: Update sources to dcd7fefc703fb4b12187235386900d34cc13fdc5. Diffstat:
139 files changed, 12908 insertions(+), 3954 deletions(-)
diff --git a/lib/libc/mingw/crt/crtdll.c b/lib/libc/mingw/crt/crtdll.c @@ -204,6 +204,8 @@ i__leave: int __cdecl atexit (_PVFV func) { + /* Do not use msvcrt's atexit() or UCRT's _crt_atexit() function as it + * cannot be called from DLL library which may be unloaded at runtime. */ return _register_onexit_function(&atexit_table, (_onexit_t)func); } diff --git a/lib/libc/mingw/crt/crtexe.c b/lib/libc/mingw/crt/crtexe.c @@ -20,21 +20,12 @@ #include <tchar.h> #include <sect_attribs.h> #include <locale.h> +#include <corecrt_startup.h> #if defined(__SEH__) && (!defined(__clang__) || __clang_major__ >= 7) #define SEH_INLINE_ASM #endif -#ifndef __winitenv -extern wchar_t *** __MINGW_IMP_SYMBOL(__winitenv); -#define __winitenv (* __MINGW_IMP_SYMBOL(__winitenv)) -#endif - -#if !defined(__initenv) -extern char *** __MINGW_IMP_SYMBOL(__initenv); -#define __initenv (* __MINGW_IMP_SYMBOL(__initenv)) -#endif - extern IMAGE_DOS_HEADER __ImageBase; extern void _fpreset (void); @@ -43,6 +34,7 @@ int *__cdecl __p__commode(void); #undef _fmode extern int _fmode; +#undef _commode extern int _commode; extern int _dowildcard; @@ -334,7 +326,12 @@ static void duplicate_ppstrings (int ac, _TCHAR ***av) int __cdecl atexit (_PVFV func) { - return _onexit((_onexit_t)func) ? 0 : -1; + /* + * msvcrt def file renames the real atexit() function to _crt_atexit(). + * UCRT provides atexit() function only under name _crt_atexit(). + * So redirect call to _crt_atexit() function. + */ + return _crt_atexit(func); } char __mingw_module_is_dll = 0; diff --git a/lib/libc/mingw/crt/tls_atexit.c b/lib/libc/mingw/crt/tls_atexit.c @@ -169,4 +169,4 @@ static void WINAPI tls_callback(HANDLE hDllHandle, DWORD dwReason, LPVOID __UNUS } } -_CRTALLOC(".CRT$XLB") PIMAGE_TLS_CALLBACK __xl_b = (PIMAGE_TLS_CALLBACK) tls_callback; +_CRTALLOC(".CRT$XLB") PIMAGE_TLS_CALLBACK __xl_b = tls_callback; diff --git a/lib/libc/mingw/crt/tlssup.c b/lib/libc/mingw/crt/tlssup.c @@ -71,9 +71,10 @@ static __CRT_THREAD TlsDtorNode dtor_list_head; extern int _CRT_MT; -BOOL WINAPI __dyn_tls_init (HANDLE, DWORD, LPVOID); +void WINAPI __dyn_tls_init (HANDLE, DWORD, LPVOID); +void WINAPI __dyn_tls_dtor (HANDLE, DWORD, LPVOID); -BOOL WINAPI +void WINAPI __dyn_tls_init (HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved) { _PVFV *pfunc; @@ -87,7 +88,7 @@ __dyn_tls_init (HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved) { if (dwReason == DLL_PROCESS_ATTACH) __mingw_TLScallback (hDllHandle, dwReason, lpreserved); - return TRUE; + return; } ps = (uintptr_t) &__xd_a; @@ -98,11 +99,10 @@ __dyn_tls_init (HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved) if (*pfunc != NULL) (*pfunc)(); } - return TRUE; } -const PIMAGE_TLS_CALLBACK __dyn_tls_init_callback = (const PIMAGE_TLS_CALLBACK) __dyn_tls_init; -_CRTALLOC(".CRT$XLC") PIMAGE_TLS_CALLBACK __xl_c = (PIMAGE_TLS_CALLBACK) __dyn_tls_init; +const PIMAGE_TLS_CALLBACK __dyn_tls_init_callback = __dyn_tls_init; +_CRTALLOC(".CRT$XLC") PIMAGE_TLS_CALLBACK __xl_c = __dyn_tls_init; int __cdecl __tlregdtor (_PVFV); @@ -133,7 +133,7 @@ __tlregdtor (_PVFV func) return 0; } -static BOOL WINAPI +void WINAPI __dyn_tls_dtor (HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved) { #if !defined (DISABLE_MS_TLS) @@ -142,7 +142,7 @@ __dyn_tls_dtor (HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved) #endif if (dwReason != DLL_THREAD_DETACH && dwReason != DLL_PROCESS_DETACH) - return TRUE; + return; /* As TLS variables are detroyed already by DLL_THREAD_DETACH call, we have to avoid access on the possible DLL_PROCESS_DETACH call the already destroyed TLS vars. @@ -165,10 +165,9 @@ __dyn_tls_dtor (HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved) } #endif __mingw_TLScallback (hDllHandle, dwReason, lpreserved); - return TRUE; } -_CRTALLOC(".CRT$XLD") PIMAGE_TLS_CALLBACK __xl_d = (PIMAGE_TLS_CALLBACK) __dyn_tls_dtor; +_CRTALLOC(".CRT$XLD") PIMAGE_TLS_CALLBACK __xl_d = __dyn_tls_dtor; int __mingw_initltsdrot_force = 0; diff --git a/lib/libc/mingw/crt/ucrtbase_compat.c b/lib/libc/mingw/crt/ucrtbase_compat.c @@ -1,169 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - -#ifdef __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Winline" -#endif - -#undef __MSVCRT_VERSION__ -#define _UCRT - -#define __getmainargs crtimp___getmainargs -#define __wgetmainargs crtimp___wgetmainargs -#define _amsg_exit crtimp__amsg_exit -#define _get_output_format crtimp__get_output_format - -#include <internal.h> -#include <sect_attribs.h> -#include <stdio.h> -#include <time.h> -#include <corecrt_startup.h> - -#undef __getmainargs -#undef __wgetmainargs -#undef _amsg_exit -#undef _get_output_format - - - -// Declarations of non-static functions implemented within this file (that aren't -// declared in any of the included headers, and that isn't mapped away with a define -// to get rid of the _CRTIMP in headers). -int __cdecl __getmainargs(int * _Argc, char *** _Argv, char ***_Env, int _DoWildCard, _startupinfo *_StartInfo); -int __cdecl __wgetmainargs(int * _Argc, wchar_t *** _Argv, wchar_t ***_Env, int _DoWildCard, _startupinfo *_StartInfo); -void __cdecl __MINGW_ATTRIB_NORETURN _amsg_exit(int ret); -unsigned int __cdecl _get_output_format(void); - -int __cdecl __ms_fwprintf(FILE *, const wchar_t *, ...); - -// Declarations of functions from ucrtbase.dll that we use below -_CRTIMP int* __cdecl __p___argc(void); -_CRTIMP char*** __cdecl __p___argv(void); -_CRTIMP wchar_t*** __cdecl __p___wargv(void); -_CRTIMP char*** __cdecl __p__environ(void); -_CRTIMP wchar_t*** __cdecl __p__wenviron(void); - -_CRTIMP int __cdecl _initialize_narrow_environment(void); -_CRTIMP int __cdecl _initialize_wide_environment(void); -_CRTIMP int __cdecl _configure_narrow_argv(int mode); -_CRTIMP int __cdecl _configure_wide_argv(int mode); - -// Declared in new.h, but only visible to C++ -_CRTIMP int __cdecl _set_new_mode(int _NewMode); - -extern char __mingw_module_is_dll; - - -// Wrappers with legacy msvcrt.dll style API, based on the new ucrtbase.dll functions. -int __cdecl __getmainargs(int * _Argc, char *** _Argv, char ***_Env, int _DoWildCard, _startupinfo *_StartInfo) -{ - _initialize_narrow_environment(); - _configure_narrow_argv(_DoWildCard ? 2 : 1); - *_Argc = *__p___argc(); - *_Argv = *__p___argv(); - *_Env = *__p__environ(); - if (_StartInfo) - _set_new_mode(_StartInfo->newmode); - return 0; -} - -int __cdecl __wgetmainargs(int * _Argc, wchar_t *** _Argv, wchar_t ***_Env, int _DoWildCard, _startupinfo *_StartInfo) -{ - _initialize_wide_environment(); - _configure_wide_argv(_DoWildCard ? 2 : 1); - *_Argc = *__p___argc(); - *_Argv = *__p___wargv(); - *_Env = *__p__wenviron(); - if (_StartInfo) - _set_new_mode(_StartInfo->newmode); - return 0; -} - -_onexit_t __cdecl _onexit(_onexit_t func) -{ - return _crt_atexit((_PVFV)func) == 0 ? func : NULL; -} - -_onexit_t __cdecl (*__MINGW_IMP_SYMBOL(_onexit))(_onexit_t func) = _onexit; - -int __cdecl at_quick_exit(void (__cdecl *func)(void)) -{ - // In a DLL, we can't register a function with _crt_at_quick_exit, because - // we can't unregister it when the DLL is unloaded. This matches how - // at_quick_exit/quick_exit work with MSVC with a dynamically linked CRT. - if (__mingw_module_is_dll) - return 0; - return _crt_at_quick_exit(func); -} - -int __cdecl (*__MINGW_IMP_SYMBOL(at_quick_exit))(void (__cdecl *)(void)) = at_quick_exit; - -void __cdecl __MINGW_ATTRIB_NORETURN _amsg_exit(int ret) { - fprintf(stderr, "runtime error %d\n", ret); - _exit(255); -} - -unsigned int __cdecl _get_output_format(void) -{ - return 0; -} - - -// These are required to provide the unrepfixed data symbols "timezone" -// and "tzname"; we can't remap "timezone" via a define due to clashes -// with e.g. "struct timezone". -typedef void __cdecl (*_tzset_func)(void); -extern _tzset_func __MINGW_IMP_SYMBOL(_tzset); - -// Default initial values until _tzset has been called; these are the same -// as the initial values in msvcrt/ucrtbase. -static char initial_tzname0[] = "PST"; -static char initial_tzname1[] = "PDT"; -static char *initial_tznames[] = { initial_tzname0, initial_tzname1 }; -static long initial_timezone = 28800; -static int initial_daylight = 1; -char** __MINGW_IMP_SYMBOL(tzname) = initial_tznames; -long * __MINGW_IMP_SYMBOL(timezone) = &initial_timezone; -int * __MINGW_IMP_SYMBOL(daylight) = &initial_daylight; - -void __cdecl _tzset(void) -{ - __MINGW_IMP_SYMBOL(_tzset)(); - // Redirect the __imp_ pointers to the actual data provided by the UCRT. - // From this point, the exposed values should stay in sync. - __MINGW_IMP_SYMBOL(tzname) = _tzname; - __MINGW_IMP_SYMBOL(timezone) = __timezone(); - __MINGW_IMP_SYMBOL(daylight) = __daylight(); -} - -void __cdecl tzset(void) -{ - _tzset(); -} - -// This is called for wchar cases with __USE_MINGW_ANSI_STDIO enabled (where the -// char case just uses fputc). -int __cdecl __ms_fwprintf(FILE *file, const wchar_t *fmt, ...) -{ - va_list ap; - int ret; - va_start(ap, fmt); - ret = __stdio_common_vfwprintf(_CRT_INTERNAL_PRINTF_LEGACY_WIDE_SPECIFIERS, file, fmt, NULL, ap); - va_end(ap); - return ret; -} - -// Dummy/unused __imp_ wrappers, to make GNU ld not autoexport these symbols. -int __cdecl (*__MINGW_IMP_SYMBOL(__getmainargs))(int *, char ***, char ***, int, _startupinfo *) = __getmainargs; -int __cdecl (*__MINGW_IMP_SYMBOL(__wgetmainargs))(int *, wchar_t ***, wchar_t ***, int, _startupinfo *) = __wgetmainargs; -void __cdecl (*__MINGW_IMP_SYMBOL(_amsg_exit))(int) = _amsg_exit; -unsigned int __cdecl (*__MINGW_IMP_SYMBOL(_get_output_format))(void) = _get_output_format; -void __cdecl (*__MINGW_IMP_SYMBOL(tzset))(void) = tzset; -int __cdecl (*__MINGW_IMP_SYMBOL(__ms_fwprintf))(FILE *, const wchar_t *, ...) = __ms_fwprintf; -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif diff --git a/lib/libc/mingw/def-include/crt-aliases.def.in b/lib/libc/mingw/def-include/crt-aliases.def.in @@ -0,0 +1,585 @@ +#include "func.def.in" + +#define ADD_UNDERSCORE(symbol) symbol == _ ## symbol +#define ADD_UNDERSCORE_DATA(symbol) symbol DATA == _ ## symbol +#define ADD_UNDERSCORE_DATA_DLL(symbol) symbol DATA == _ ## symbol ## _dll +#define ADD_DOUBLE_UNDERSCORE(symbol) symbol == __ ## symbol + +; This is list of symbol aliases from the Visual C++ 1.0 oldnames.lib library +; FIXME: some of these symbol aliases are commented, check and document why +#ifdef UCRTBASE +; access is provided as an alias for __mingw_access +#else +ADD_UNDERSCORE(access) +#endif +#ifndef CRTAPP +; ADD_UNDERSCORE(cgets) +ADD_UNDERSCORE(chdir) +#endif +ADD_UNDERSCORE(chmod) +ADD_UNDERSCORE(chsize) +ADD_UNDERSCORE(close) +#ifndef CRTAPP +; ADD_UNDERSCORE(cprintf) +; ADD_UNDERSCORE(cputs) +#endif +ADD_UNDERSCORE(creat) +#ifndef CRTAPP +; ADD_UNDERSCORE(cscanf) +ADD_UNDERSCORE(cwait) +#endif +#if defined(UCRTBASE) +; daylight variable is provided by misc/ucrt_tzset.c +#elif defined(CRTDLL) +ADD_UNDERSCORE_DATA_DLL(daylight) +#else +ADD_UNDERSCORE_DATA(daylight) +#endif +ADD_UNDERSCORE(dup) +ADD_UNDERSCORE(dup2) +ADD_UNDERSCORE(ecvt) +#if defined(UCRTBASE) +; _environ variable is not available in ucrtbase.dll and there is no replacement for it +#elif defined(CRTDLL) +; ADD_UNDERSCORE_DATA_DLL(environ) +#else +; ADD_UNDERSCORE_DATA(environ) +#endif +ADD_UNDERSCORE(eof) +#ifndef CRTAPP +ADD_UNDERSCORE(execl) +ADD_UNDERSCORE(execle) +ADD_UNDERSCORE(execlp) +ADD_UNDERSCORE(execlpe) +ADD_UNDERSCORE(execv) +ADD_UNDERSCORE(execve) +ADD_UNDERSCORE(execvp) +ADD_UNDERSCORE(execvpe) +#endif +ADD_UNDERSCORE(fcloseall) +ADD_UNDERSCORE(fcvt) +ADD_UNDERSCORE(fdopen) +ADD_UNDERSCORE(fgetchar) +ADD_UNDERSCORE(filelength) +ADD_UNDERSCORE(fileno) +; ADD_UNDERSCORE(flushall) +ADD_UNDERSCORE(fputchar) +#ifdef FIXED_SIZE_SYMBOLS +#ifndef CRTDLL +ADD_UNDERSCORE(fstat) +#endif +#else +F32(fstat == _fstat32) +F64(fstat == _fstat64i32) +#endif +#ifdef FIXED_SIZE_SYMBOLS +ADD_UNDERSCORE(ftime) +#else +F32(ftime == _ftime32) +F64(ftime == _ftime64) +#endif +#if defined(UCRTBASE) +; HUGE alias and _HUGE variable are provided by math/_huge.c +#elif defined(CRTDLL) +ADD_UNDERSCORE_DATA_DLL(HUGE) +#else +ADD_UNDERSCORE_DATA(HUGE) +#endif +ADD_UNDERSCORE(gcvt) +#ifndef CRTAPP +ADD_UNDERSCORE(getch) +ADD_UNDERSCORE(getche) +ADD_UNDERSCORE(getcwd) +#endif +#ifdef UCRTBASE +; ucrtbase.dll has got _getpid for all archs +ADD_UNDERSCORE(getpid) +#elif !defined(CRTAPP) +; msvcrt.dll for arm/arm64 lacks _getpid +F_X86_ANY(ADD_UNDERSCORE(getpid)) +#endif +#ifndef CRTAPP +ADD_UNDERSCORE(getw) +#endif +ADD_UNDERSCORE(isatty) +ADD_UNDERSCORE(itoa) +#ifndef CRTAPP +ADD_UNDERSCORE(kbhit) +#endif +ADD_UNDERSCORE(lfind) +; ADD_UNDERSCORE(locking) +ADD_UNDERSCORE(lsearch) +ADD_UNDERSCORE(lseek) +ADD_UNDERSCORE(ltoa) +ADD_UNDERSCORE(memccpy) +ADD_UNDERSCORE(memicmp) +ADD_UNDERSCORE(mkdir) +ADD_UNDERSCORE(mktemp) +; onexit function alias is provided by misc/_onexit.c +ADD_UNDERSCORE(open) +#ifndef CRTAPP +ADD_UNDERSCORE(putch) +ADD_UNDERSCORE(putenv) +#endif +ADD_UNDERSCORE(putw) +ADD_UNDERSCORE(read) +ADD_UNDERSCORE(rmdir) +ADD_UNDERSCORE(rmtmp) +ADD_UNDERSCORE(setmode) +ADD_UNDERSCORE(sopen) +#ifndef CRTAPP +ADD_UNDERSCORE(spawnl) +ADD_UNDERSCORE(spawnle) +ADD_UNDERSCORE(spawnlp) +ADD_UNDERSCORE(spawnlpe) +ADD_UNDERSCORE(spawnv) +ADD_UNDERSCORE(spawnve) +ADD_UNDERSCORE(spawnvp) +ADD_UNDERSCORE(spawnvpe) +#endif +#ifndef CRTDLL +; stat is provided by mingw to workaround trailing slash issue in _stat +#endif +#ifdef NO_STRCMPI_ALIAS +; Symbol _strcmpi is natively present and defined in the library def file +; So define strcmpi as an alias to _strcmpi +ADD_UNDERSCORE(strcmpi) +#else +; Symbol _strcmpi is not present in the library, it provides only _stricmp symbol +; So define strcmpi as an alias to _stricmp +strcmpi == _stricmp +#endif +ADD_UNDERSCORE(strdup) +ADD_UNDERSCORE(stricmp) +ADD_UNDERSCORE(strlwr) +ADD_UNDERSCORE(strnicmp) +ADD_UNDERSCORE(strnset) +ADD_UNDERSCORE(strrev) +ADD_UNDERSCORE(strset) +ADD_UNDERSCORE(strupr) +ADD_UNDERSCORE(swab) +#if defined(UCRTBASE) +; _sys_errlist variable is not available in ucrtbase.dll and there is no replacement for it +#else +// sys_errlist variable is without _dll suffix in crtdll.dll +; ADD_UNDERSCORE_DATA(sys_errlist) +#endif +#if defined(UCRTBASE) +; _sys_nerr variable is not available in ucrtbase.dll and there is no replacement for it +#elif defined(CRTDLL) +; ADD_UNDERSCORE_DATA_DLL(sys_nerr) +#else +; ADD_UNDERSCORE_DATA(sys_nerr) +#endif +ADD_UNDERSCORE(tell) +ADD_UNDERSCORE(tempnam) +#if defined(UCRTBASE) +; timezone variable is provided by misc/ucrt_tzset.c +#elif defined(CRTDLL) +ADD_UNDERSCORE_DATA_DLL(timezone) +#else +ADD_UNDERSCORE_DATA(timezone) +#endif +#if defined(UCRTBASE) +; tzname variable is provided by misc/ucrt_tzset.c +#else +// tzname variable is without _dll suffix in crtdll.dll +ADD_UNDERSCORE_DATA(tzname) +#endif +#if defined(UCRTBASE) +; tzset function is provided by misc/ucrt_tzset.c +#else +ADD_UNDERSCORE(tzset) +#endif +; ADD_UNDERSCORE(ultoa) +ADD_UNDERSCORE(umask) +#ifndef CRTAPP +ADD_UNDERSCORE(ungetch) +#endif +ADD_UNDERSCORE(unlink) +#ifdef FIXED_SIZE_SYMBOLS +ADD_UNDERSCORE(utime) +#else +F32(utime == _utime32) +F64(utime == _utime64) +#endif +ADD_UNDERSCORE(write) + +; This is list of symbol aliases added in the Visual C++ 2.0 oldnames.lib library +; All these symbols with leading underscore are present also in pre-2.0 CRT versions: crtdll.dll and msvcrt10.dll +; ADD_UNDERSCORE(control87) +; ADD_UNDERSCORE(fpreset) ; Alias fpreset is set in CRT_fp10.c and CRT_fp8.c +ADD_UNDERSCORE(wcsdup) +ADD_UNDERSCORE(wcsicmp) +ADD_UNDERSCORE(wcsicoll) +ADD_UNDERSCORE(wcslwr) +ADD_UNDERSCORE(wcsnicmp) +ADD_UNDERSCORE(wcsnset) +ADD_UNDERSCORE(wcsrev) +ADD_UNDERSCORE(wcsset) +ADD_UNDERSCORE(wcsupr) + +; This is list of symbol aliases added in the Visual C++ 4.0 oldnames.lib library +; All these symbols with leading underscore are present also in pre-4.0 CRT versions: crtdll.dll, msvcrt10.dll and msvcrt20.dll +; ADD_UNDERSCORE(cabs) +ADD_UNDERSCORE(hypot) +ADD_UNDERSCORE(j0) +ADD_UNDERSCORE(j1) +ADD_UNDERSCORE(jn) +ADD_UNDERSCORE(y0) +ADD_UNDERSCORE(y1) +ADD_UNDERSCORE(yn) + +; This is list of symbol aliases for C95 functions +#ifdef USE_WCSTOK_S_FOR_WCSTOK +wcstok == wcstok_s +#endif + +; This is list of symbol aliases for C99 functions +; ADD_UNDERSCORE(logb) +#ifdef WITH_NEXTAFTER_ALIAS +ADD_UNDERSCORE(nextafter) +#endif + +#if defined(DEF_ARM32) || defined(DEF_ARM64) +; This is list of symbol aliases for C99 ARM long double functions +; They are defined as aliases to regular double symbols as on ARM, long double is equal to regular double +acosl == acos +asinl == asin +atan2l == atan2 +atanl == atan +ceill == ceil +cosl == cos +expl == exp +floorl == floor +fmodl == fmod +log10l == log10 +logl == log +; FIXME: Why is powl alias defined only for UCRT? +#ifdef UCRTBASE +powl == pow +#endif +sinl == sin +tanl == tan +#endif + +; This is list of symbol aliases for C11 functions +#ifdef UCRTBASE +F32(timespec_get == _timespec32_get) +F64(timespec_get == _timespec64_get) +#endif + +; This is list of symbol aliases for POSIX functions +ADD_DOUBLE_UNDERSCORE(isascii) +ADD_DOUBLE_UNDERSCORE(toascii) +#ifndef CRTAPP +ADD_UNDERSCORE(pclose) +ADD_UNDERSCORE(popen) +#endif +; ADD_UNDERSCORE(scalb) + +; This is list of symbol aliases for Large File Specification (extension to Single UNIX Specification) +#ifndef NO_FPOS64_ALIASES +; fgetpos and fsetpos are already 64-bit +fgetpos64 == fgetpos +fsetpos64 == fsetpos +#endif + +; This is list of symbol aliases for GNU functions which are not part of POSIX or ISO C +strcasecmp == _stricmp +strncasecmp == _strnicmp + +; This is list of various symbol aliases which are needed for compatibility +; Some symbols in some version of CRT library were added and some other symbols were removed or renamed +; This list provides some level of backward and forward compatibility + +#ifndef NO_STRCMPI_ALIAS +_strcmpi == _stricmp +#endif + +#ifdef WITH_IOB_FUNC_ALIAS +__iob_func == __p__iob +#endif + +#ifdef WITH_TZ_ALIASES +__daylight == __p__daylight +#ifndef NO_DSTBIAS +__dstbias == __p__dstbias +#endif +__timezone == __p__timezone +__tzname == __p__tzname +#endif + +#ifdef WITH_ATOLL_ALIAS +atoll == _atoi64 +_wtoll == _wtoi64 +#endif + +#ifdef WITH_ATOLL_L_ALIAS +_atoll_l == _atoi64_l +_wtoll_l == _wtoi64_l +#endif + +#ifdef WITH_LLABS_ALIAS +llabs == _abs64 +imaxabs == _abs64 +#elif defined(WITH_IMAXABS_ALIAS) +imaxabs == llabs +#endif + +#ifdef WITH_IMAXDIV_ALIAS +imaxdiv == lldiv +#endif + +#ifdef WITH_STRTO64_ALIAS +strtoll == _strtoi64 +strtoull == _strtoui64 +strtoimax == _strtoi64 +strtoumax == _strtoui64 +wcstoll == _wcstoi64 +wcstoull == _wcstoui64 +wcstoimax == _wcstoi64 +wcstoumax == _wcstoui64 +#endif + +#ifdef WITH_STRTO64_L_ALIAS +_strtoll_l == _strtoi64_l +_strtoull_l == _strtoui64_l +_strtoimax_l == _strtoi64_l +_strtoumax_l == _strtoui64_l +_wcstoll_l == _wcstoi64_l +_wcstoull_l == _wcstoui64_l +_wcstoimax_l == _wcstoi64_l +_wcstoumax_l == _wcstoui64_l +#endif + +; This is list of find symbol aliases, every CRT library has either find symbols with SIZE suffix or without them +#ifdef FIXED_SIZE_SYMBOLS +F32(_findfirst32 == _findfirst) +F64(_findfirst64i32 == _findfirst) +#ifndef NO_I64_FIXED_SIZE +F32(_findfirst32i64 == _findfirsti64) +#ifndef NO_FIXED_SIZE_64_ALIAS +F64(_findfirst64 == _findfirsti64) +#endif +#endif +F32(_findnext32 == _findnext) +F64(_findnext64i32 == _findnext) +#ifndef NO_I64_FIXED_SIZE +F32(_findnext32i64 == _findnexti64) +#ifndef NO_FIXED_SIZE_64_ALIAS +F64(_findnext64 == _findnexti64) +#endif +#endif +#ifndef NO_WIDE_FIXED_SIZE +F32(_wfindfirst32 == _wfindfirst) +F64(_wfindfirst64i32 == _wfindfirst) +#ifndef NO_I64_FIXED_SIZE +F32(_wfindfirst32i64 == _wfindfirsti64) +#ifndef NO_FIXED_SIZE_64_ALIAS +F64(_wfindfirst64 == _wfindfirsti64) +#endif +#endif +F32(_wfindnext32 == _wfindnext) +F64(_wfindnext64i32 == _wfindnext) +#ifndef NO_I64_FIXED_SIZE +F32(_wfindnext32i64 == _wfindnexti64) +#ifndef NO_FIXED_SIZE_64_ALIAS +F64(_wfindnext64 == _wfindnexti64) +#endif +#endif +#endif +#else +F32(_findfirst == _findfirst32) +F64(_findfirst == _findfirst64i32) +F32(_findfirsti64 == _findfirst32i64) +F64(_findfirsti64 == _findfirst64) +F32(_findnext == _findnext32) +F64(_findnext == _findnext64i32) +F32(_findnexti64 == _findnext32i64) +F64(_findnexti64 == _findnext64) +F32(_wfindfirst == _wfindfirst32) +F64(_wfindfirst == _wfindfirst64i32) +F32(_wfindfirsti64 == _wfindfirst32i64) +F64(_wfindfirsti64 == _wfindfirst64) +F32(_wfindnext == _wfindnext32) +F64(_wfindnext == _wfindnext64i32) +F32(_wfindnexti64 == _wfindnext32i64) +F64(_wfindnexti64 == _wfindnext64) +#endif + +; This is list of stat symbol aliases, every CRT library has either stat symbols with SIZE suffix or without them +#ifdef FIXED_SIZE_SYMBOLS +#ifndef CRTDLL +F32(_fstat32 == _fstat) +#endif +F64(_fstat64i32 == _fstat) +#ifndef NO_I64_FIXED_SIZE +F32(_fstat32i64 == _fstati64) +#ifndef NO_FIXED_SIZE_64_ALIAS +F64(_fstat64 == _fstati64) +#endif +#endif +#ifndef CRTDLL +F32(_stat32 == _stat) +#endif +F64(_stat64i32 == _stat) +#ifndef NO_I64_FIXED_SIZE +F32(_stat32i64 == _stati64) +#ifndef NO_FIXED_SIZE_64_ALIAS +F64(_stat64 == _stati64) +#endif +#endif +#ifndef NO_WIDE_FIXED_SIZE +F32(_wstat32 == _wstat) +F64(_wstat64i32 == _wstat) +#ifndef NO_I64_FIXED_SIZE +F32(_wstat32i64 == _wstati64) +#ifndef NO_FIXED_SIZE_64_ALIAS +F64(_wstat64 == _wstati64) +#endif +#endif +#endif +#else +F32(_fstat == _fstat32) +F64(_fstat == _fstat64i32) +F32(_fstati64 == _fstat32i64) +F64(_fstati64 == _fstat64) +F32(_stat == _stat32) +F64(_stat == _stat64i32) +F32(_stati64 == _stat32i64) +F64(_stati64 == _stat64) +F32(_wstat == _wstat32) +F64(_wstat == _wstat64i32) +F32(_wstati64 == _wstat32i64) +F64(_wstati64 == _wstat64) +#endif + +; This is list of time symbol aliases, every CRT library except msvcrt.dll has either time symbols with SIZE suffix or without them +#ifndef NO_TIME_ALIAS +#ifdef FIXED_SIZE_SYMBOLS +F32(_ctime32 == ctime) +F64(_ctime64 == ctime) +F32(_difftime32 == difftime) +F64(_difftime64 == difftime) +F32(_ftime32 == _ftime) +F64(_ftime64 == _ftime) +F32(_futime32 == _futime) +F64(_futime64 == _futime) +F32(_gmtime32 == gmtime) +F64(_gmtime64 == gmtime) +F32(_localtime32 == localtime) +F64(_localtime64 == localtime) +; Skip _mkgmtime as it is present only in msvcrt.dll +F32(_mktime32 == mktime) +F64(_mktime64 == mktime) +F32(_time32 == time) +F64(_time64 == time) +F32(_utime32 == _utime) +F64(_utime64 == _utime) +#ifndef NO_WIDE_FIXED_SIZE +F32(_wctime32 == _wctime) +F64(_wctime64 == _wctime) +F32(_wutime32 == _wutime) +F64(_wutime64 == _wutime) +#endif +#else +F32(ctime == _ctime32) +F64(ctime == _ctime64) +F32(difftime == _difftime32) +F64(difftime == _difftime64) +F32(_ftime == _ftime32) +F64(_ftime == _ftime64) +F32(_futime == _futime32) +F64(_futime == _futime64) +F32(gmtime == _gmtime32) +F64(gmtime == _gmtime64) +F32(localtime == _localtime32) +F64(localtime == _localtime64) +F32(_mkgmtime == _mkgmtime32) +F64(_mkgmtime == _mkgmtime64) +F32(mktime == _mktime32) +F64(mktime == _mktime64) +F32(time == _time32) +F64(time == _time64) +F32(_utime == _utime32) +F64(_utime == _utime64) +F32(_wctime == _wctime32) +F64(_wctime == _wctime64) +F32(_wutime == _wutime32) +F64(_wutime == _wutime64) +#endif +#endif + +; This is list of symbols which are present in msvcrt but not in UCRT +#ifdef UCRTBASE +__lconv_init == __initialize_lconv_for_unsigned_char +__set_app_type == _set_app_type +__p__daylight == __daylight +__p__dstbias == __dstbias +__p__timezone == __timezone +__p__tzname == __tzname +#endif + +; This is list of printf/scanf symbol aliases with __ms_ prefix +#ifndef UCRTBASE +__ms_fprintf == fprintf +__ms_fscanf == fscanf +__ms_fwprintf == fwprintf +__ms_fwscanf == fwscanf +__ms_printf == printf +__ms_scanf == scanf +__ms_sprintf == sprintf +__ms_sscanf == sscanf +#ifdef PRE_C95_SWPRINTF +__ms_swprintf == swprintf +#else +__ms_swprintf == _swprintf +#endif +__ms_swscanf == swscanf +__ms_vfprintf == vfprintf +__ms_vfwprintf == vfwprintf +__ms_vprintf == vprintf +__ms_vsprintf == vsprintf +#ifdef PRE_C95_SWPRINTF +__ms_vswprintf == vswprintf +#else +__ms_vswprintf == _vswprintf +#endif +__ms_vwprintf == vwprintf +__ms_wprintf == wprintf +__ms_wscanf == wscanf +#endif + +; This is list of additional symbol aliases not available in any library as neither native symbols nor aliases +; FIXME: check if these really are needed + +; Origin of the symbol wcscmpi is unknown. This symbol is not present in +; crtdll.dll and neither in any msvcr* version. The only source of wcscmpi is +; wcstr.h header file from the Microsoft Visual C++ 1.0 (32-bit for NT) and +; Microsoft Windows NT 3.1 SDK where wcscmpi and _wcscmpi are defined as +; macros which expand to _wcsicmp. So the raw wcscmpi is not linkable symbol +; even in the old Visual C++ versions. +wcscmpi == _wcsicmp + +; Origin of these symbols is unknown too. +ADD_UNDERSCORE(chgsign) +ADD_UNDERSCORE(fgetwchar) +ADD_UNDERSCORE(finite) +ADD_UNDERSCORE(fpclass) +ADD_UNDERSCORE(fputwchar) +#ifndef CRTAPP +ADD_UNDERSCORE(heapwalk) +#endif +ADD_DOUBLE_UNDERSCORE(iscsymf) +ADD_DOUBLE_UNDERSCORE(iscsym) +#ifndef CRTAPP +ADD_UNDERSCORE(searchenv) +#endif +ADD_UNDERSCORE(stricoll) +#ifndef UCRTBASE +ADD_UNDERSCORE(vsnprintf_s) +#endif +#ifndef CRTAPP +ADD_UNDERSCORE(wpopen) +#endif diff --git a/lib/libc/mingw/def-include/func.def.in b/lib/libc/mingw/def-include/func.def.in @@ -1,3 +1,6 @@ +#ifndef FUNC_DEF_IN +#define FUNC_DEF_IN + // F32 - function available on all 32 bit architectures // F64 - function available on all 64 bit architectures // F_X86_ANY - function available on i386 and x86_64 @@ -7,25 +10,35 @@ // F_ARM64 - function available only on arm64 // F_ARM_ANY - function available on 32 and 64 bit arm // F_NON_I386 - function available on everything but i386 +// F_NON_X64 - function available on everything but x86_64 +// F_NON_ARM64 - function available on everything but arm64 #if defined(DEF_X64) #define F64(x) x #define F_X64(x) x #define F_X86_ANY(x) x #define F_NON_I386(x) x +#define F_NON_ARM64(x) x #elif defined(DEF_I386) #define F32(x) x #define F_I386(x) x #define F_X86_ANY(x) x +#define F_NON_X64(x) x +#define F_NON_ARM64(x) x #elif defined(DEF_ARM32) #define F32(x) x #define F_ARM32(x) x #define F_ARM_ANY(x) x #define F_NON_I386(x) x +#define F_NON_X64(x) x +#define F_NON_ARM64(x) x #elif defined(DEF_ARM64) #define F64(x) x #define F_ARM64(x) x #define F_ARM_ANY(x) x #define F_NON_I386(x) x +#define F_NON_X64(x) x +#else +#error No DEF_<ARCH> is defined #endif #ifndef F32 @@ -55,3 +68,16 @@ #ifndef F_NON_I386 #define F_NON_I386(x) #endif +#ifndef F_NON_X64 +#define F_NON_X64(x) +#endif +#ifndef F_NON_ARM64 +#define F_NON_ARM64(x) +#endif + +#if defined(DEF_I386) +#define STDCALL_DECORATED_EXPORT(symbol) symbol == _ ## symbol +#define FASTCALL_DECORATED_EXPORT(symbol) symbol == symbol +#endif + +#endif // FUNC_DEF_IN diff --git a/lib/libc/mingw/def-include/msvcrt-common.def.in b/lib/libc/mingw/def-include/msvcrt-common.def.in @@ -1,154 +0,0 @@ -#include "func.def.in" - -#define ADD_UNDERSCORE(symbol) symbol == _ ## symbol -#define ADD_DOUBLE_UNDERSCORE(symbol) symbol == __ ## symbol - -ADD_DOUBLE_UNDERSCORE(iscsymf) -ADD_DOUBLE_UNDERSCORE(iscsym) -ADD_DOUBLE_UNDERSCORE(isascii) -ADD_DOUBLE_UNDERSCORE(toascii) - -wcscmpi == _wcsicmp -strcasecmp == _stricmp -strncasecmp == _strnicmp - -#ifdef UCRTBASE -; access is provided as an alias for __mingw_access -#else -ADD_UNDERSCORE(access) -#endif -ADD_UNDERSCORE(chdir) -ADD_UNDERSCORE(chmod) -ADD_UNDERSCORE(chsize) -ADD_UNDERSCORE(close) -ADD_UNDERSCORE(creat) -ADD_UNDERSCORE(cwait) -ADD_UNDERSCORE(dup) -ADD_UNDERSCORE(dup2) -ADD_UNDERSCORE(ecvt) -ADD_UNDERSCORE(eof) -ADD_UNDERSCORE(execl) -ADD_UNDERSCORE(execle) -ADD_UNDERSCORE(execlp) -ADD_UNDERSCORE(execlpe) -ADD_UNDERSCORE(execv) -ADD_UNDERSCORE(execve) -ADD_UNDERSCORE(execvp) -ADD_UNDERSCORE(execvpe) -ADD_UNDERSCORE(fcloseall) -ADD_UNDERSCORE(fcvt) -ADD_UNDERSCORE(fdopen) -ADD_UNDERSCORE(fgetchar) -ADD_UNDERSCORE(fgetwchar) -ADD_UNDERSCORE(filelength) -ADD_UNDERSCORE(fileno) -; Alias fpreset is set in CRT_fp10.c and CRT_fp8.c. -; ADD_UNDERSCORE(fpreset) -ADD_UNDERSCORE(fputchar) -ADD_UNDERSCORE(fputwchar) -; ADD_UNDERSCORE(fstat) -; ADD_UNDERSCORE(ftime) -ADD_UNDERSCORE(gcvt) -ADD_UNDERSCORE(getch) -ADD_UNDERSCORE(getche) -ADD_UNDERSCORE(getcwd) -#ifdef UCRTBASE -; ucrtbase.dll has got _getpid for all archs -ADD_UNDERSCORE(getpid) -#elif !defined(NO_GETPID_ALIAS) -; msvcrt.dll for arm/arm64 lacks _getpid -F_X86_ANY(ADD_UNDERSCORE(getpid)) -#endif -ADD_UNDERSCORE(getw) -ADD_UNDERSCORE(heapwalk) -ADD_UNDERSCORE(isatty) -ADD_UNDERSCORE(itoa) -ADD_UNDERSCORE(kbhit) -ADD_UNDERSCORE(lfind) -ADD_UNDERSCORE(lsearch) -ADD_UNDERSCORE(lseek) -ADD_UNDERSCORE(ltoa) -ADD_UNDERSCORE(memccpy) -ADD_UNDERSCORE(memicmp) -ADD_UNDERSCORE(mkdir) -ADD_UNDERSCORE(mktemp) -ADD_UNDERSCORE(open) -ADD_UNDERSCORE(pclose) -ADD_UNDERSCORE(popen) -ADD_UNDERSCORE(putch) -ADD_UNDERSCORE(putenv) -ADD_UNDERSCORE(putw) -ADD_UNDERSCORE(read) -ADD_UNDERSCORE(rmdir) -ADD_UNDERSCORE(rmtmp) -ADD_UNDERSCORE(searchenv) -ADD_UNDERSCORE(setmode) -ADD_UNDERSCORE(sopen) -ADD_UNDERSCORE(spawnl) -ADD_UNDERSCORE(spawnle) -ADD_UNDERSCORE(spawnlp) -ADD_UNDERSCORE(spawnlpe) -ADD_UNDERSCORE(spawnv) -ADD_UNDERSCORE(spawnve) -ADD_UNDERSCORE(spawnvp) -ADD_UNDERSCORE(spawnvpe) -; ADD_UNDERSCORE(stat) -#ifndef UCRTBASE -ADD_UNDERSCORE(strcmpi) -#endif -ADD_UNDERSCORE(strdup) -ADD_UNDERSCORE(stricmp) -ADD_UNDERSCORE(stricoll) -ADD_UNDERSCORE(strlwr) -ADD_UNDERSCORE(strnicmp) -ADD_UNDERSCORE(strnset) -ADD_UNDERSCORE(strrev) -ADD_UNDERSCORE(strset) -ADD_UNDERSCORE(strupr) -ADD_UNDERSCORE(swab) -ADD_UNDERSCORE(tell) -ADD_UNDERSCORE(tempnam) -#ifndef UCRTBASE -ADD_UNDERSCORE(tzset) -#endif -ADD_UNDERSCORE(umask) -ADD_UNDERSCORE(ungetch) -ADD_UNDERSCORE(unlink) -#ifndef UCRTBASE -ADD_UNDERSCORE(utime) -#endif -ADD_UNDERSCORE(wcsdup) -ADD_UNDERSCORE(wcsicmp) -ADD_UNDERSCORE(wcsicoll) -ADD_UNDERSCORE(wcslwr) -ADD_UNDERSCORE(wcsnicmp) -ADD_UNDERSCORE(wcsnset) -ADD_UNDERSCORE(wcsrev) -ADD_UNDERSCORE(wcsset) -ADD_UNDERSCORE(wcsupr) -ADD_UNDERSCORE(wpopen) -ADD_UNDERSCORE(write) -; non-ANSI functions declared in math.h -ADD_UNDERSCORE(j0) -ADD_UNDERSCORE(j1) -ADD_UNDERSCORE(jn) -ADD_UNDERSCORE(y0) -ADD_UNDERSCORE(y1) -ADD_UNDERSCORE(yn) -ADD_UNDERSCORE(chgsign) -; ADD_UNDERSCORE(scalb) -ADD_UNDERSCORE(finite) -ADD_UNDERSCORE(fpclass) -; C99 functions -; ADD_UNDERSCORE(cabs) -ADD_UNDERSCORE(hypot) -; ADD_UNDERSCORE(logb) -ADD_UNDERSCORE(nextafter) - -#ifndef UCRTBASE -daylight DATA == _daylight -timezone DATA == _timezone -tzname DATA == _tzname - -ADD_UNDERSCORE(vsnprintf_s) -#endif diff --git a/lib/libc/mingw/include/internal.h b/lib/libc/mingw/include/internal.h @@ -59,7 +59,7 @@ extern "C" { #define _tm_unicode_safe(i) (_pioinfo_safe(i)->unicode) #ifndef __badioinfo - extern ioinfo ** __MINGW_IMP_SYMBOL(__badioinfo)[]; + extern ioinfo * __MINGW_IMP_SYMBOL(__badioinfo); #define __badioinfo (* __MINGW_IMP_SYMBOL(__badioinfo)) #endif @@ -96,17 +96,13 @@ extern "C" { extern int _dowildcard; extern int _newmode; -#ifndef __winitenv -extern wchar_t *** __MINGW_IMP_SYMBOL(__winitenv); -#define __winitenv (* __MINGW_IMP_SYMBOL(__winitenv)) -#endif + _CRTIMP wchar_t *** __cdecl __p___winitenv(void); +#define __winitenv (*__p___winitenv()) -#if !defined(__initenv) -extern char *** __MINGW_IMP_SYMBOL(__initenv); -#define __initenv (* __MINGW_IMP_SYMBOL(__initenv)) -#endif + _CRTIMP char *** __cdecl __p___initenv(void); +#define __initenv (*__p___initenv()) - _CRTIMP void __cdecl _amsg_exit(int); + _CRTIMP void __cdecl _amsg_exit(int) __MINGW_ATTRIB_NORETURN; int __CRTDECL _setargv(void); int __CRTDECL __setargv(void); @@ -150,6 +146,14 @@ extern char *** __MINGW_IMP_SYMBOL(__initenv); PIMAGE_SECTION_HEADER __cdecl _FindPESection (PBYTE pImageBase, DWORD_PTR rva); BOOL __cdecl _IsNonwritableInCurrentImage (PBYTE pTarget); +#if defined(__SSE__) +# define __mingw_has_sse() 1 +#elif defined(__i386__) + int __mingw_has_sse(void); +#else +# define __mingw_has_sse() 0 +#endif + #ifdef __cplusplus } #endif diff --git a/lib/libc/mingw/lib-common/api-ms-win-crt-convert-l1-1-0.def.in b/lib/libc/mingw/lib-common/api-ms-win-crt-convert-l1-1-0.def.in @@ -47,7 +47,7 @@ _strtoi64 _strtoi64_l _strtoimax_l _strtol_l -_strtold_l +F_ARM_ANY(_strtold_l) ; Can't use long double functions from the CRT on x86 _strtoll_l _strtoui64 _strtoui64_l @@ -68,7 +68,7 @@ _wcstoi64 _wcstoi64_l _wcstoimax_l _wcstol_l -_wcstold_l +F_ARM_ANY(_wcstold_l) ; Can't use long double functions from the CRT on x86 _wcstoll_l _wcstombs_l _wcstombs_s_l @@ -108,8 +108,7 @@ strtod strtof strtoimax strtol -; Can't use long double functions from the CRT on x86 -F_ARM_ANY(strtold) +F_ARM_ANY(strtold) ; Can't use long double functions from the CRT on x86 strtoll strtoul strtoull @@ -122,8 +121,7 @@ wcstod wcstof wcstoimax wcstol -; Can't use long double functions from the CRT on x86 -F_ARM_ANY(wcstold) +F_ARM_ANY(wcstold) ; Can't use long double functions from the CRT on x86 wcstoll wcstombs wcstombs_s diff --git a/lib/libc/mingw/lib-common/api-ms-win-crt-filesystem-l1-1-0.def b/lib/libc/mingw/lib-common/api-ms-win-crt-filesystem-l1-1-0.def @@ -1,79 +0,0 @@ -LIBRARY api-ms-win-crt-filesystem-l1-1-0 - -EXPORTS - -_access -; access is provided as an alias for __mingw_access -; access == _access -_access_s -_chdir -chdir == _chdir -_chdrive -_chmod -chmod == _chmod -_findclose -_findfirst == _findfirst64 -_findfirst32 -_findfirst32i64 -_findfirst64 -_findfirst64i32 -_findnext == _findnext64 -_findnext32 -_findnext32i64 -_findnext64 -_findnext64i32 -_fstat32 -_fstat32i64 -_fstat64 -_fstat64i32 -_fullpath -_getdiskfree -_getdrive -_getdrives -_lock_file -_makepath -_makepath_s -_mkdir -mkdir == _mkdir -_rmdir -rmdir == _rmdir -_splitpath -_splitpath_s -_stat32 -_stat32i64 -_stat64 -_stat64i32 -_umask -umask == _umask -_umask_s -_unlink -unlink == _unlink -_unlock_file -_waccess -_waccess_s -_wchdir -_wchmod -_wfindfirst32 -_wfindfirst32i64 -_wfindfirst64 -_wfindfirst64i32 -_wfindnext32 -_wfindnext32i64 -_wfindnext64 -_wfindnext64i32 -_wfullpath -_wmakepath -_wmakepath_s -_wmkdir -_wremove -_wrename -_wrmdir -_wsplitpath -_wsplitpath_s -_wstat32 -_wstat32i64 -_wstat64 -_wstat64i32 -_wunlink -remove -rename diff --git a/lib/libc/mingw/lib-common/api-ms-win-crt-filesystem-l1-1-0.def.in b/lib/libc/mingw/lib-common/api-ms-win-crt-filesystem-l1-1-0.def.in @@ -0,0 +1,109 @@ +LIBRARY api-ms-win-crt-filesystem-l1-1-0 + +EXPORTS + +#include "func.def.in" + +_access +; access is provided as an alias for __mingw_access +; access == _access +_access_s +_chdir +chdir == _chdir +_chdrive +_chmod +chmod == _chmod +_findclose +F32(_findfirst == _findfirst32) +F64(_findfirst == _findfirst64i32) +F32(_findfirsti64 == _findfirst32i64) +F64(_findfirsti64 == _findfirst64) +_findfirst32 +_findfirst32i64 +_findfirst64 +_findfirst64i32 +F32(_findnext == _findnext32) +F64(_findnext == _findnext64i32) +F32(_findnexti64 == _findnext32i64) +F64(_findnexti64 == _findnext64) +_findnext32 +_findnext32i64 +_findnext64 +_findnext64i32 +F32(fstat == _fstat32) +F64(fstat == _fstat64i32) +F32(_fstat == _fstat32) +F64(_fstat == _fstat64i32) +F32(_fstati64 == _fstat32i64) +F64(_fstati64 == _fstat64) +_fstat32 +_fstat32i64 +_fstat64 +_fstat64i32 +_fullpath +_getdiskfree +_getdrive +_getdrives +_lock_file +_makepath +_makepath_s +_mkdir +mkdir == _mkdir +_rmdir +rmdir == _rmdir +_splitpath +_splitpath_s +F32(_stat == _stat32) +F64(_stat == _stat64i32) +F32(_stati64 == _stat32i64) +F64(_stati64 == _stat64) +_stat32 +_stat32i64 +_stat64 +_stat64i32 +_umask +umask == _umask +_umask_s +_unlink +unlink == _unlink +_unlock_file +_waccess +_waccess_s +_wchdir +_wchmod +F32(_wfindfirst == _wfindfirst32) +F64(_wfindfirst == _wfindfirst64i32) +F32(_wfindfirsti64 == _wfindfirst32i64) +F64(_wfindfirsti64 == _wfindfirst64) +_wfindfirst32 +_wfindfirst32i64 +_wfindfirst64 +_wfindfirst64i32 +F32(_wfindnext == _wfindnext32) +F64(_wfindnext == _wfindnext64i32) +F32(_wfindnexti64 == _wfindnext32i64) +F64(_wfindnexti64 == _wfindnext64) +_wfindnext32 +_wfindnext32i64 +_wfindnext64 +_wfindnext64i32 +_wfullpath +_wmakepath +_wmakepath_s +_wmkdir +_wremove +_wrename +_wrmdir +_wsplitpath +_wsplitpath_s +F32(_wstat == _wstat32) +F64(_wstat == _wstat64i32) +F32(_wstati64 == _wstat32i64) +F64(_wstati64 == _wstat64) +_wstat32 +_wstat32i64 +_wstat64 +_wstat64i32 +_wunlink +remove +rename diff --git a/lib/libc/mingw/lib-common/api-ms-win-crt-math-l1-1-0.def.in b/lib/libc/mingw/lib-common/api-ms-win-crt-math-l1-1-0.def.in @@ -150,13 +150,13 @@ F_NON_I386(acosf) F_ARM_ANY(acosl == acos) acosh acoshf -acoshl F_X86_ANY(DATA) +F_ARM_ANY(acoshl) ; Can't use long double functions from the CRT on x86 asin F_NON_I386(asinf) F_ARM_ANY(asinl == asin) asinh asinhf -asinhl F_X86_ANY(DATA) +F_ARM_ANY(asinhl) ; Can't use long double functions from the CRT on x86 atan atan2 F_NON_I386(atan2f) @@ -165,61 +165,61 @@ F_NON_I386(atanf) F_ARM_ANY(atanl == atan) atanh atanhf -atanhl F_X86_ANY(DATA) +F_ARM_ANY(atanhl) ; Can't use long double functions from the CRT on x86 cabs cabsf -cabsl +F_ARM_ANY(cabsl) ; Can't use long double functions from the CRT on x86 cacos cacosf cacosh cacoshf -cacoshl -cacosl +F_ARM_ANY(cacoshl) ; Can't use long double functions from the CRT on x86 +F_ARM_ANY(cacosl) ; Can't use long double functions from the CRT on x86 carg cargf -cargl +F_ARM_ANY(cargl) ; Can't use long double functions from the CRT on x86 casin casinf casinh casinhf -casinhl -casinl +F_ARM_ANY(casinhl) ; Can't use long double functions from the CRT on x86 +F_ARM_ANY(casinl) ; Can't use long double functions from the CRT on x86 catan catanf catanh catanhf -catanhl -catanl +F_ARM_ANY(catanhl) ; Can't use long double functions from the CRT on x86 +F_ARM_ANY(catanl) ; Can't use long double functions from the CRT on x86 cbrt cbrtf -cbrtl F_X86_ANY(DATA) +F_ARM_ANY(cbrtl) ; Can't use long double functions from the CRT on x86 ccos ccosf ccosh ccoshf -ccoshl -ccosl +F_ARM_ANY(ccoshl) ; Can't use long double functions from the CRT on x86 +F_ARM_ANY(ccosl) ; Can't use long double functions from the CRT on x86 ceil F_NON_I386(ceilf) F_ARM_ANY(ceill == ceil) cexp cexpf -cexpl +F_ARM_ANY(cexpl) ; Can't use long double functions from the CRT on x86 cimag cimagf -cimagl +F_ARM_ANY(cimagl) ; Can't use long double functions from the CRT on x86 clog clog10 clog10f -clog10l +F_ARM_ANY(clog10l) ; Can't use long double functions from the CRT on x86 clogf -clogl +F_ARM_ANY(clogl) ; Can't use long double functions from the CRT on x86 conj conjf -conjl +F_ARM_ANY(conjl) ; Can't use long double functions from the CRT on x86 copysign copysignf -copysignl F_X86_ANY(DATA) +F_ARM_ANY(copysignl) ; Can't use long double functions from the CRT on x86 cos F_NON_I386(cosf) F_ARM_ANY(cosl == cos) @@ -227,60 +227,60 @@ cosh F_NON_I386(coshf) cpow cpowf -cpowl +F_ARM_ANY(cpowl) ; Can't use long double functions from the CRT on x86 cproj cprojf -cprojl +F_ARM_ANY(cprojl) ; Can't use long double functions from the CRT on x86 creal crealf -creall +F_ARM_ANY(creall) ; Can't use long double functions from the CRT on x86 csin csinf csinh csinhf -csinhl -csinl +F_ARM_ANY(csinhl) ; Can't use long double functions from the CRT on x86 +F_ARM_ANY(csinl) ; Can't use long double functions from the CRT on x86 csqrt csqrtf -csqrtl +F_ARM_ANY(csqrtl) ; Can't use long double functions from the CRT on x86 ctan ctanf ctanh ctanhf -ctanhl -ctanl +F_ARM_ANY(ctanhl) ; Can't use long double functions from the CRT on x86 +F_ARM_ANY(ctanl) ; Can't use long double functions from the CRT on x86 erf erfc erfcf -erfcl F_X86_ANY(DATA) +F_ARM_ANY(erfcl) ; Can't use long double functions from the CRT on x86 erff -erfl F_X86_ANY(DATA) +F_ARM_ANY(erfl) ; Can't use long double functions from the CRT on x86 exp exp2 exp2f -exp2l F_X86_ANY(DATA) +F_ARM_ANY(exp2l) ; Can't use long double functions from the CRT on x86 F_NON_I386(expf) F_ARM_ANY(expl == exp) expm1 expm1f -expm1l F_X86_ANY(DATA) +F_ARM_ANY(expm1l) ; Can't use long double functions from the CRT on x86 fabs F_ARM_ANY(fabsf) fdim fdimf -fdiml F_X86_ANY(DATA) +F_ARM_ANY(fdiml) ; Can't use long double functions from the CRT on x86 floor F_NON_I386(floorf) F_ARM_ANY(floorl == floor) fma fmaf -fmal F_X86_ANY(DATA) +F_ARM_ANY(fmal) ; Can't use long double functions from the CRT on x86 fmax fmaxf -fmaxl F_X86_ANY(DATA) +F_ARM_ANY(fmaxl) ; Can't use long double functions from the CRT on x86 fmin fminf -fminl F_X86_ANY(DATA) +F_ARM_ANY(fminl) ; Can't use long double functions from the CRT on x86 fmod F_NON_I386(fmodf) F_ARM_ANY(fmodl == fmod) @@ -288,80 +288,80 @@ frexp hypot ilogb ilogbf -ilogbl F_X86_ANY(DATA) +F_ARM_ANY(ilogbl) ; Can't use long double functions from the CRT on x86 ldexp ; The UCRT lgamma functions don't set/provide the signgam variable like ; the mingw ones do. Therefore prefer the libmingwex version instead. lgamma DATA lgammaf DATA -lgammal DATA +F_ARM_ANY(lgammal DATA) ; Can't use long double functions from the CRT on x86 llrint llrintf -llrintl F_X86_ANY(DATA) +F_ARM_ANY(llrintl) ; Can't use long double functions from the CRT on x86 llround llroundf -llroundl F_X86_ANY(DATA) +F_ARM_ANY(llroundl) ; Can't use long double functions from the CRT on x86 log log10 F_NON_I386(log10f) F_ARM_ANY(log10l == log10) log1p log1pf -log1pl F_X86_ANY(DATA) +F_ARM_ANY(log1pl) ; Can't use long double functions from the CRT on x86 log2 log2f -log2l F_X86_ANY(DATA) +F_ARM_ANY(log2l) ; Can't use long double functions from the CRT on x86 logb logbf -logbl F_X86_ANY(DATA) +F_ARM_ANY(logbl) ; Can't use long double functions from the CRT on x86 F_NON_I386(logf) F_ARM_ANY(logl == log) lrint lrintf -lrintl F_X86_ANY(DATA) +F_ARM_ANY(lrintl) ; Can't use long double functions from the CRT on x86 lround lroundf -lroundl F_X86_ANY(DATA) +F_ARM_ANY(lroundl) ; Can't use long double functions from the CRT on x86 modf F_NON_I386(modff) nan nanf -nanl F_X86_ANY(DATA) +F_ARM_ANY(nanl) ; Can't use long double functions from the CRT on x86 nearbyint nearbyintf -nearbyintl F_X86_ANY(DATA) +F_ARM_ANY(nearbyintl) ; Can't use long double functions from the CRT on x86 nextafter nextafterf -nextafterl F_X86_ANY(DATA) -; All of the nexttoward functions take the second parameter as long doubke, +F_ARM_ANY(nextafterl) ; Can't use long double functions from the CRT on x86 +; All of the nexttoward functions take the second parameter as long double, ; making them unusable for x86. -nexttoward F_X86_ANY(DATA) -nexttowardf F_X86_ANY(DATA) -nexttowardl F_X86_ANY(DATA) +F_ARM_ANY(nexttoward) ; Can't use long double functions from the CRT on x86 +F_ARM_ANY(nexttowardf) ; Can't use long double functions from the CRT on x86 +F_ARM_ANY(nexttowardl) ; Can't use long double functions from the CRT on x86 norm normf norml pow -F_NON_I386(powf) +F_NON_I386(powf) ; Missing in Wine's ucrtbase.dll for i386 in Wine 9.15 and older F_ARM_ANY(powl == pow) remainder remainderf -remainderl F_X86_ANY(DATA) +F_ARM_ANY(remainderl) ; Can't use long double functions from the CRT on x86 remquo remquof -remquol F_X86_ANY(DATA) +F_ARM_ANY(remquol) ; Can't use long double functions from the CRT on x86 rint rintf -rintl F_X86_ANY(DATA) +F_ARM_ANY(rintl) ; Can't use long double functions from the CRT on x86 round roundf -roundl F_X86_ANY(DATA) +F_ARM_ANY(roundl) ; Can't use long double functions from the CRT on x86 scalbln scalblnf -scalblnl F_X86_ANY(DATA) +F_ARM_ANY(scalblnl) ; Can't use long double functions from the CRT on x86 scalbn scalbnf -scalbnl F_X86_ANY(DATA) +F_ARM_ANY(scalbnl) ; Can't use long double functions from the CRT on x86 sin F_NON_I386(sinf) F_ARM_ANY(sinl == sin) @@ -378,7 +378,7 @@ tanh F_NON_I386(tanhf) tgamma tgammaf -tgammal F_X86_ANY(DATA) +F_ARM_ANY(tgammal) ; Can't use long double functions from the CRT on x86 trunc truncf -truncl F_X86_ANY(DATA) +F_ARM_ANY(truncl) ; Can't use long double functions from the CRT on x86 diff --git a/lib/libc/mingw/lib-common/api-ms-win-crt-private-l1-1-0.def.in b/lib/libc/mingw/lib-common/api-ms-win-crt-private-l1-1-0.def.in @@ -43,7 +43,7 @@ __TypeMatch __current_exception __current_exception_context __dcrt_get_wide_environment_from_os -__dcrt_initial_narrow_environment +__dcrt_initial_narrow_environment DATA __intrinsic_abnormal_termination __intrinsic_setjmp F64(__intrinsic_setjmpex) diff --git a/lib/libc/mingw/lib-common/api-ms-win-crt-stdio-l1-1-0.def b/lib/libc/mingw/lib-common/api-ms-win-crt-stdio-l1-1-0.def @@ -155,6 +155,7 @@ ferror fflush fgetc fgetpos +fgetpos64 == fgetpos fgets fgetwc fgetws @@ -170,6 +171,7 @@ freopen freopen_s fseek fsetpos +fsetpos64 == fsetpos ftell fwrite getc diff --git a/lib/libc/mingw/lib-common/api-ms-win-crt-string-l1-1-0.def b/lib/libc/mingw/lib-common/api-ms-win-crt-string-l1-1-0.def @@ -128,7 +128,7 @@ _wcsupr_l _wcsupr_s _wcsupr_s_l _wcsxfrm_l -_wctype +_wctype DATA is_wctype isalnum isalpha @@ -175,7 +175,7 @@ strncat_s strncmp strncpy strncpy_s -; strnlen replaced by emu +strnlen strpbrk strspn strtok @@ -199,8 +199,7 @@ wcsncat_s wcsncmp wcsncpy wcsncpy_s -; We provide replacement implementation in libmingwex -wcsnlen DATA +wcsnlen wcspbrk wcsspn wcstok diff --git a/lib/libc/mingw/lib-common/api-ms-win-crt-time-l1-1-0.def b/lib/libc/mingw/lib-common/api-ms-win-crt-time-l1-1-0.def @@ -1,89 +0,0 @@ -LIBRARY api-ms-win-crt-time-l1-1-0 - -EXPORTS - -__daylight -__dstbias -__timezone -__tzname -_ctime32 -_ctime32_s -_ctime64 -_ctime64_s -_difftime32 -_difftime64 -_ftime == _ftime64 -_ftime32 -_ftime32_s -_ftime64 -_ftime64_s -_futime == _futime64 -_futime32 -_futime64 -_get_daylight -_get_dstbias -_get_timezone -_get_tzname -_getsystime -_Getdays -_Getmonths -_Gettnames -_gmtime32 -_gmtime32_s -_gmtime64 -_gmtime64_s -_localtime32 -_localtime32_s -_localtime64 -_localtime64_s -_mkgmtime32 -_mkgmtime64 -_mktime32 -_mktime64 -_setsystime -_strdate -_strdate_s -_Strftime -_strftime_l -_strtime -_strtime_s -_time32 -_time64 -_timespec32_get -_timespec64_get -; This is wrapped in the compat code. -_tzset DATA -_utime == _utime64 -utime == _utime64 -_utime32 -_utime64 -_W_Getdays -_W_Getmonths -_W_Gettnames -_wasctime -_wasctime_s -_Wcsftime -_wcsftime_l -_wctime32 -_wctime32_s -_wctime64 -_wctime64_s -_wstrdate -_wstrdate_s -_wstrtime -_wstrtime_s -_wutime == _wutime64 -_wutime32 -_wutime64 -asctime -asctime_s -clock -strftime -wcsftime -; These functions may satisfy configure scripts. -ctime == _ctime64 -gmtime == _gmtime64 -localtime == _localtime64 -mktime == _mktime64 -time == _time64 -timespec_get == _timespec64_get diff --git a/lib/libc/mingw/lib-common/api-ms-win-crt-time-l1-1-0.def.in b/lib/libc/mingw/lib-common/api-ms-win-crt-time-l1-1-0.def.in @@ -0,0 +1,108 @@ +LIBRARY api-ms-win-crt-time-l1-1-0 + +EXPORTS + +#include "func.def.in" + +__daylight +__dstbias +__timezone +__tzname +_ctime32 +_ctime32_s +_ctime64 +_ctime64_s +F32(difftime == _difftime32) +F64(difftime == _difftime64) +_difftime32 +_difftime64 +F32(_ftime == _ftime32) +F64(_ftime == _ftime64) +_ftime32 +_ftime32_s +_ftime64 +_ftime64_s +F32(_futime == _futime32) +F64(_futime == _futime64) +_futime32 +_futime64 +_get_daylight +_get_dstbias +_get_timezone +_get_tzname +_getsystime +_Getdays +_Getmonths +_Gettnames +_gmtime32 +_gmtime32_s +_gmtime64 +_gmtime64_s +_localtime32 +_localtime32_s +_localtime64 +_localtime64_s +F32(_mkgmtime == _mkgmtime32) +F64(_mkgmtime == _mkgmtime64) +_mkgmtime32 +_mkgmtime64 +_mktime32 +_mktime64 +_setsystime +_strdate +_strdate_s +_Strftime +_strftime_l +_strtime +_strtime_s +_time32 +_time64 +_timespec32_get +_timespec64_get +; This is wrapped in the compat code. +_tzset DATA +F32(_utime == _utime32) +F64(_utime == _utime64) +F32(utime == _utime32) +F64(utime == _utime64) +_utime32 +_utime64 +_W_Getdays +_W_Getmonths +_W_Gettnames +_wasctime +_wasctime_s +_Wcsftime +_wcsftime_l +F32(_wctime == _wctime32) +F64(_wctime == _wctime64) +_wctime32 +_wctime32_s +_wctime64 +_wctime64_s +_wstrdate +_wstrdate_s +_wstrtime +_wstrtime_s +F32(_wutime == _wutime32) +F64(_wutime == _wutime64) +_wutime32 +_wutime64 +asctime +asctime_s +clock +strftime +wcsftime +; These functions may satisfy configure scripts. +F32(ctime == _ctime32) +F64(ctime == _ctime64) +F32(gmtime == _gmtime32) +F64(gmtime == _gmtime64) +F32(localtime == _localtime32) +F64(localtime == _localtime64) +F32(mktime == _mktime32) +F64(mktime == _mktime64) +F32(time == _time32) +F64(time == _time64) +F32(timespec_get == _timespec32_get) +F64(timespec_get == _timespec64_get) diff --git a/lib/libc/mingw/lib-common/bcryptprimitives.def b/lib/libc/mingw/lib-common/bcryptprimitives.def @@ -0,0 +1,18 @@ +; +; Definition file of bcryptPrimitives.dll +; Automatic generated by gendef 1.1 +; written by Kai Tietz 2008 +; The def file has to be processed by --kill-at (-k) option of dlltool or ld +; +LIBRARY "bcryptPrimitives.dll" +EXPORTS +GetAsymmetricEncryptionInterface +GetCipherInterface +GetHashInterface +GetKeyDerivationInterface +GetRngInterface +GetSecretAgreementInterface +GetSignatureInterface +MSCryptConvertRsaPrivateBlobToFullRsaBlob +ProcessPrng +ProcessPrngGuid diff --git a/lib/libc/mingw/lib-common/cfgmgr32.def b/lib/libc/mingw/lib-common/cfgmgr32.def @@ -7,12 +7,12 @@ LIBRARY "CFGMGR32.dll" EXPORTS CMP_GetBlockedDriverInfo CMP_GetServerSideDeviceInstallFlags +CMP_Get_Device_ID_List +CMP_Get_Device_ID_List_Size CMP_Init_Detection -CMP_RegisterNotification CMP_RegisterServiceNotification CMP_Register_Notification CMP_Report_LogOn -CMP_UnregisterNotification CMP_WaitNoPendingInstallEvents CMP_WaitServicesAvailable CM_Add_Driver_PackageW @@ -61,6 +61,7 @@ CM_Enumerate_EnumeratorsA CM_Enumerate_EnumeratorsW CM_Enumerate_Enumerators_ExA CM_Enumerate_Enumerators_ExW +CM_Export_Pnp_StateW CM_Find_Range CM_First_Range CM_Free_Log_Conf @@ -167,6 +168,7 @@ CM_Get_Version_Ex CM_Import_PowerScheme CM_Install_DevNodeW CM_Install_DevNode_ExW +CM_Install_DriverW CM_Intersect_Range_List CM_Invert_Range_List CM_Is_Dock_Station_Present @@ -253,6 +255,7 @@ CM_Setup_DevNode_Ex CM_Test_Range_Available CM_Uninstall_DevNode CM_Uninstall_DevNode_Ex +CM_Uninstall_DriverW CM_Unregister_Device_InterfaceA CM_Unregister_Device_InterfaceW CM_Unregister_Device_Interface_ExA diff --git a/lib/libc/mingw/lib-common/computecore.def b/lib/libc/mingw/lib-common/computecore.def @@ -9,6 +9,7 @@ HcsEnumerateVmWorkerProcesses HcsFindVmWorkerProcesses HcsGetWorkerProcessJob HcsStartVmWorkerProcess +HcsAbortSystemPreservation HcsAddResourceToOperation HcsCancelOperation HcsCloseComputeSystem @@ -24,6 +25,8 @@ HcsCreateOperationWithNotifications HcsCreateProcess HcsEnumerateComputeSystems HcsEnumerateComputeSystemsInNamespace +HcsFinalizeLiveMigration +HcsFinalizeSystemPreservation HcsGetComputeSystemFromOperation HcsGetComputeSystemProperties HcsGetOperationContext @@ -39,6 +42,7 @@ HcsGetProcessorCompatibilityFromSavedState HcsGetServiceProperties HcsGrantVmAccess HcsGrantVmGroupAccess +HcsInitializeLiveMigrationOnSource HcsModifyComputeSystem HcsModifyProcess HcsModifyServiceSettings @@ -57,6 +61,9 @@ HcsSetProcessCallback HcsShutDownComputeSystem HcsSignalProcess HcsStartComputeSystem +HcsStartLiveMigrationOnSource +HcsStartLiveMigrationTransfer +HcsStartSystemPreservation HcsSubmitWerReport HcsSystemControl HcsTerminateComputeSystem diff --git a/lib/libc/mingw/lib-common/computenetwork.def b/lib/libc/mingw/lib-common/computenetwork.def @@ -18,6 +18,7 @@ HcnModifySdnRoute HcnOpenGuestNetworkService HcnOpenSdnRoute HcnQueryGuestNetworkServiceProperties +HcnQueryMetrics HcnQuerySdnRouteProperties HcnRegisterGuestNetworkServiceCallback HcnRegisterNetworkCallback diff --git a/lib/libc/mingw/lib-common/computestorage.def b/lib/libc/mingw/lib-common/computestorage.def @@ -6,8 +6,10 @@ LIBRARY "computestorage.dll" EXPORTS HcsAttachLayerStorageFilter +HcsAttachOverlayFilter HcsDestroyLayer HcsDetachLayerStorageFilter +HcsDetachOverlayFilter HcsExportLayer HcsExportLegacyWritableLayer HcsFormatWritableLayerVhd diff --git a/lib/libc/mingw/lib-common/kernel32.def.in b/lib/libc/mingw/lib-common/kernel32.def.in @@ -121,9 +121,11 @@ BuildCommDCBW BuildIoRingCancelRequest BuildIoRingFlushFile BuildIoRingReadFile +BuildIoRingReadFileScatter BuildIoRingRegisterBuffers BuildIoRingRegisterFileHandles BuildIoRingWriteFile +BuildIoRingWriteFileGather CallNamedPipeA CallNamedPipeW CallbackMayRunLong diff --git a/lib/libc/mingw/lib-common/ninput.def b/lib/libc/mingw/lib-common/ninput.def @@ -0,0 +1,37 @@ +; +; Definition file of ninput.dll +; Automatic generated by gendef +; written by Kai Tietz 2008-2014 +; +LIBRARY "ninput.dll" +EXPORTS +AddPointerInteractionContext +BufferPointerPacketsInteractionContext +CreateInteractionContext +DestroyInteractionContext +GetCrossSlideParameterInteractionContext +GetHoldParameterInteractionContext +GetInertiaParameterInteractionContext +GetInteractionConfigurationInteractionContext +GetMouseWheelParameterInteractionContext +GetPropertyInteractionContext +GetStateInteractionContext +GetTapParameterInteractionContext +GetTranslationParameterInteractionContext +ProcessBufferedPacketsInteractionContext +ProcessInertiaInteractionContext +ProcessPointerFramesInteractionContext +RegisterOutputCallbackInteractionContext +RegisterOutputCallbackInteractionContext2 +RemovePointerInteractionContext +ResetInteractionContext +SetCrossSlideParametersInteractionContext +SetHoldParameterInteractionContext +SetInertiaParameterInteractionContext +SetInteractionConfigurationInteractionContext +SetMouseWheelParameterInteractionContext +SetPivotInteractionContext +SetPropertyInteractionContext +SetTapParameterInteractionContext +SetTranslationParameterInteractionContext +StopInteractionContext diff --git a/lib/libc/mingw/lib-common/tbs.def b/lib/libc/mingw/lib-common/tbs.def @@ -17,6 +17,7 @@ Tbsi_GetDeviceInfo Tbsi_Get_OwnerAuth Tbsi_Get_TCG_Log Tbsi_Get_TCG_Log_Ex +Tbsi_Is_Tpm_Present Tbsi_Physical_Presence_Command Tbsi_Revoke_Attestation Tbsi_ShaHash diff --git a/lib/libc/mingw/lib-common/ucrtbase-common.def.in b/lib/libc/mingw/lib-common/ucrtbase-common.def.in @@ -0,0 +1,2709 @@ +#ifdef DEF_DEBUG +#define F_DEBUG(x) x +#define F_NON_DEBUG(x) +#else +#define F_DEBUG(x) +#define F_NON_DEBUG(x) x +#endif + +; This is list of symbols available in the first public UCRT version (ucrtbase.dll and ucrtbased.dll) +; First public ucrtbase.dll version is 10.0.10137.0 and is part of the Microsoft Visual C++ 2015 Redistributable version 14.0.23026.0 +; First public ucrtbased.dll version is 10.0.10150.0 and is part of the Microsoft Visual Studio 2015 (Universal CRT Headers Libraries and Sources) +F_I386(_CIacos) +F_I386(_CIasin) +F_I386(_CIatan) +F_I386(_CIatan2) +F_I386(_CIcos) +F_I386(_CIcosh) +F_I386(_CIexp) +F_I386(_CIfmod) +F_I386(_CIlog) +F_I386(_CIlog10) +F_I386(_CIpow) +F_I386(_CIsin) +F_I386(_CIsinh) +F_I386(_CIsqrt) +F_I386(_CItan) +F_I386(_CItanh) +_Cbuild +_Cmulcc +_Cmulcr +_CreateFrameInfo +F_DEBUG(_CrtCheckMemory) +F_DEBUG(_CrtDbgReport) +F_DEBUG(_CrtDbgReportW) +F_DEBUG(_CrtDoForAllClientObjects) +F_DEBUG(_CrtDumpMemoryLeaks) +F_DEBUG(_CrtGetAllocHook) +F_DEBUG(_CrtGetDebugFillThreshold) +F_DEBUG(_CrtGetDumpClient) +F_DEBUG(_CrtGetReportHook) +F_DEBUG(_CrtIsMemoryBlock) +F_DEBUG(_CrtIsValidHeapPointer) +F_DEBUG(_CrtIsValidPointer) +F_DEBUG(_CrtMemCheckpoint) +F_DEBUG(_CrtMemDifference) +F_DEBUG(_CrtMemDumpAllObjectsSince) +F_DEBUG(_CrtMemDumpStatistics) +F_DEBUG(_CrtReportBlockType) +F_DEBUG(_CrtSetAllocHook) +F_DEBUG(_CrtSetBreakAlloc) +F_DEBUG(_CrtSetDbgBlockType) +F_DEBUG(_CrtSetDbgFlag) +F_DEBUG(_CrtSetDebugFillThreshold) +F_DEBUG(_CrtSetDumpClient) +F_DEBUG(_CrtSetReportFile) +F_DEBUG(_CrtSetReportHook) +F_DEBUG(_CrtSetReportHook2) +F_DEBUG(_CrtSetReportHookW2) +F_DEBUG(_CrtSetReportMode) +F_I386(_CxxThrowException@8) +F_NON_I386(_CxxThrowException) +F_I386(_EH_prolog) +_Exit +_FCbuild +_FCmulcc +_FCmulcr +F_ARM32(_FPE_Raise) +_FindAndUnlinkFrame +F_X64(_GetImageBase) +F_X64(_GetThrowImageBase) +_Getdays +_Getmonths +_Gettnames +_IsExceptionObjectToBeDestroyed +_LCbuild +_LCmulcc +_LCmulcr +F_I386(_NLG_Dispatch2@4) +F_I386(_NLG_Return@12) +F_I386(_NLG_Return2) +F_X64(_SetImageBase) +F_X64(_SetThrowImageBase) +_SetWinRTOutOfMemoryExceptionCallback +_Strftime +F_DEBUG(_VCrtDbgReportA) +F_DEBUG(_VCrtDbgReportW) +_W_Getdays +_W_Getmonths +_W_Gettnames +_Wcsftime +__AdjustPointer +__BuildCatchObject +__BuildCatchObjectHelper +F_NON_I386(__C_specific_handler) +__CxxDetectRethrow +__CxxExceptionFilter +__CxxFrameHandler +__CxxFrameHandler2 +__CxxFrameHandler3 +F_I386(__CxxLongjmpUnwind@4) +__CxxQueryExceptionSize +__CxxRegisterExceptionObject +__CxxUnregisterExceptionObject +__DestructExceptionObject +__FrameUnwindFilter +__GetPlatformExceptionInfo +F_NON_I386(__NLG_Dispatch2) +F_NON_I386(__NLG_Return2) +__RTCastToVoid +__RTDynamicCast +__RTtypeid +__TypeMatch +___lc_codepage_func +___lc_collate_cp_func +___lc_locale_name_func +___mb_cur_max_func +___mb_cur_max_l_func +__acrt_iob_func +__conio_common_vcprintf +__conio_common_vcprintf_p +__conio_common_vcprintf_s +__conio_common_vcscanf +__conio_common_vcwprintf +__conio_common_vcwprintf_p +__conio_common_vcwprintf_s +__conio_common_vcwscanf +F_I386(__control87_2) +__current_exception +__current_exception_context +__daylight +__dcrt_get_wide_environment_from_os +__dcrt_initial_narrow_environment DATA +__doserrno +__dstbias +__fpe_flt_rounds +__fpecode +__initialize_lconv_for_unsigned_char +F_I386(__intrinsic_abnormal_termination) +F_NON_ARM64(__intrinsic_setjmp) +F64(__intrinsic_setjmpex) +__isascii +__iscsym +__iscsymf +__iswcsym +__iswcsymf +F_ARM32(__jump_unwind) +F_I386(__libm_sse2_acos) +F_I386(__libm_sse2_acosf) +F_I386(__libm_sse2_asin) +F_I386(__libm_sse2_asinf) +F_I386(__libm_sse2_atan) +F_I386(__libm_sse2_atan2) +F_I386(__libm_sse2_atanf) +F_I386(__libm_sse2_cos) +F_I386(__libm_sse2_cosf) +F_I386(__libm_sse2_exp) +F_I386(__libm_sse2_expf) +F_I386(__libm_sse2_log) +F_I386(__libm_sse2_log10) +F_I386(__libm_sse2_log10f) +F_I386(__libm_sse2_logf) +F_I386(__libm_sse2_pow) +F_I386(__libm_sse2_powf) +F_I386(__libm_sse2_sin) +F_I386(__libm_sse2_sinf) +F_I386(__libm_sse2_tan) +F_I386(__libm_sse2_tanf) +__p___argc +__p___argv +__p___wargv +__p__acmdln +__p__commode +F_DEBUG(__p__crtBreakAlloc) +F_DEBUG(__p__crtDbgFlag) +__p__environ +__p__fmode +__p__mbcasemap +__p__mbctype +__p__pgmptr +__p__wcmdln +__p__wenviron +__p__wpgmptr +__pctype_func +__processing_throw +__pwctype_func +__pxcptinfoptrs +__report_gsfailure +__setusermatherr +__std_exception_copy +__std_exception_destroy +__std_type_info_compare +__std_type_info_destroy_list +__std_type_info_hash +__std_type_info_name +__stdio_common_vfprintf +__stdio_common_vfprintf_p +__stdio_common_vfprintf_s +__stdio_common_vfscanf +__stdio_common_vfwprintf +__stdio_common_vfwprintf_p +__stdio_common_vfwprintf_s +__stdio_common_vfwscanf +__stdio_common_vsnprintf_s +__stdio_common_vsnwprintf_s +__stdio_common_vsprintf +__stdio_common_vsprintf_p +__stdio_common_vsprintf_s +__stdio_common_vsscanf +__stdio_common_vswprintf +__stdio_common_vswprintf_p +__stdio_common_vswprintf_s +__stdio_common_vswscanf +__strncnt +__sys_errlist +__sys_nerr +__threadhandle +__threadid +__timezone +__toascii +__tzname +#if !defined(DEF_DEBUG) || !defined(DEF_ARM64) +; symbols __unDName and __unDNameEx are available in all versions except ARM64 ucrtbased.dll +__unDName +__unDNameEx +#endif +__uncaught_exception +__wcserror +__wcserror_s +__wcsncnt +_abs64 +_access +_access_s +_aligned_free +F_DEBUG(_aligned_free_dbg) +_aligned_malloc +F_DEBUG(_aligned_malloc_dbg) +_aligned_msize +F_DEBUG(_aligned_msize_dbg) +_aligned_offset_malloc +F_DEBUG(_aligned_offset_malloc_dbg) +_aligned_offset_realloc +F_DEBUG(_aligned_offset_realloc_dbg) +_aligned_offset_recalloc +F_DEBUG(_aligned_offset_recalloc_dbg) +_aligned_realloc +F_DEBUG(_aligned_realloc_dbg) +_aligned_recalloc +F_DEBUG(_aligned_recalloc_dbg) +_assert +_atodbl +_atodbl_l +_atof_l +_atoflt +_atoflt_l +_atoi64 +_atoi64_l +_atoi_l +_atol_l +_atoldbl +_atoldbl_l +_atoll_l +_beep +_beginthread +_beginthreadex +_byteswap_uint64 +_byteswap_ulong +_byteswap_ushort +_c_exit +_cabs DATA ; DATA set manually +_callnewh +_calloc_base +F_DEBUG(_calloc_dbg) +_cexit +_cgets +_cgets_s +_cgetws +_cgetws_s +_chdir +_chdrive +_chgsign +_chgsignf +F_I386(_chkesp) +_chmod +_chsize +_chsize_s +F_DEBUG(_chvalidator) +F_DEBUG(_chvalidator_l) +_clearfp +_close +_commit +_configthreadlocale +_configure_narrow_argv +_configure_wide_argv +_control87 +_controlfp +_controlfp_s +_copysign +_copysignf +_cputs +_cputws +_creat +_create_locale +_crt_at_quick_exit +_crt_atexit +F_I386(_crt_debugger_hook) +_ctime32 +_ctime32_s +_ctime64 +_ctime64_s +_cwait +_d_int +_dclass +_dexp +_difftime32 +_difftime64 +_dlog +_dnorm +_dpcomp +_dpoly +_dscale +_dsign +_dsin +_dtest +_dunscale +_dup +_dup2 +_dupenv_s +F_DEBUG(_dupenv_s_dbg) +_ecvt +_ecvt_s +_endthread +_endthreadex +_eof +_errno +_except1 +F_I386(_except_handler2) +F_I386(_except_handler3) +F_I386(_except_handler4_common) +_execl +_execle +_execlp +_execlpe +_execute_onexit_table +_execv +_execve +_execvp +_execvpe +_exit +_expand +F_DEBUG(_expand_dbg) +_fclose_nolock +_fcloseall +_fcvt +_fcvt_s +_fd_int +_fdclass +_fdexp +_fdlog +_fdnorm +_fdopen +_fdpcomp +_fdpoly +_fdscale +_fdsign +_fdsin +_fdtest +_fdunscale +_fflush_nolock +_fgetc_nolock +_fgetchar +_fgetwc_nolock +_fgetwchar +_filelength +_filelengthi64 +_fileno +_findclose +_findfirst32 +_findfirst32i64 +_findfirst64 +_findfirst64i32 +_findnext32 +_findnext32i64 +_findnext64 +_findnext64i32 +_finite +F_NON_I386(_finitef) +_flushall +_fpclass +F_X64(_fpclassf) +_fpieee_flt +_fpreset DATA ; DATA added manually +_fputc_nolock +_fputchar +_fputwc_nolock +_fputwchar +_fread_nolock +_fread_nolock_s +_free_base +F_DEBUG(_free_dbg) +_free_locale +_fseek_nolock +_fseeki64 +_fseeki64_nolock +_fsopen +_fstat32 +_fstat32i64 +_fstat64 +_fstat64i32 +_ftell_nolock +_ftelli64 +_ftelli64_nolock +_ftime32 +_ftime32_s +_ftime64 +_ftime64_s +F_I386(_ftol) +_fullpath +F_DEBUG(_fullpath_dbg) +_futime32 +_futime64 +_fwrite_nolock +_gcvt +_gcvt_s +F_X64(_get_FMA3_enable) +_get_current_locale +_get_daylight +_get_doserrno +_get_dstbias +_get_errno +_get_fmode +_get_heap_handle +_get_initial_narrow_environment +_get_initial_wide_environment +_get_invalid_parameter_handler +_get_narrow_winmain_command_line +_get_osfhandle +_get_pgmptr +_get_printf_count_output +_get_purecall_handler +_get_stream_buffer_pointers +_get_terminate +_get_thread_local_invalid_parameter_handler +_get_timezone +_get_tzname +_get_unexpected +_get_wide_winmain_command_line +_get_wpgmptr +_getc_nolock +_getch +_getch_nolock +_getche +_getche_nolock +_getcwd +F_DEBUG(_getcwd_dbg) +_getdcwd +F_DEBUG(_getdcwd_dbg) +_getdiskfree +_getdllprocaddr +_getdrive +_getdrives +_getmaxstdio +_getmbcp +_getpid +_getsystime +_getw +_getwc_nolock +_getwch +_getwch_nolock +_getwche +_getwche_nolock +_getws +_getws_s +F_I386(_global_unwind2) +_gmtime32 +_gmtime32_s +_gmtime64 +_gmtime64_s +_heapchk +_heapmin +_heapwalk +_hypot +_hypotf +_i64toa +_i64toa_s +_i64tow +_i64tow_s +_initialize_narrow_environment +_initialize_onexit_table +_initialize_wide_environment +_initterm +_initterm_e +F_DEBUG(_invalid_parameter) +_invalid_parameter_noinfo +_invalid_parameter_noinfo_noreturn +_invoke_watson +#if !defined(DEF_DEBUG) || !defined(DEF_ARM64) +; symbol _is_exception_typeof is available in all versions except ARM64 ucrtbased.dll +_is_exception_typeof +#endif +_isalnum_l +_isalpha_l +_isatty +_isblank_l +_iscntrl_l +_isctype +_isctype_l +_isdigit_l +_isgraph_l +_isleadbyte_l +_islower_l +_ismbbalnum +_ismbbalnum_l +_ismbbalpha +_ismbbalpha_l +_ismbbblank +_ismbbblank_l +_ismbbgraph +_ismbbgraph_l +_ismbbkalnum +_ismbbkalnum_l +_ismbbkana +_ismbbkana_l +_ismbbkprint +_ismbbkprint_l +_ismbbkpunct +_ismbbkpunct_l +_ismbblead +_ismbblead_l +_ismbbprint +_ismbbprint_l +_ismbbpunct +_ismbbpunct_l +_ismbbtrail +_ismbbtrail_l +_ismbcalnum +_ismbcalnum_l +_ismbcalpha +_ismbcalpha_l +_ismbcblank +_ismbcblank_l +_ismbcdigit +_ismbcdigit_l +_ismbcgraph +_ismbcgraph_l +_ismbchira +_ismbchira_l +_ismbckata +_ismbckata_l +_ismbcl0 +_ismbcl0_l +_ismbcl1 +_ismbcl1_l +_ismbcl2 +_ismbcl2_l +_ismbclegal +_ismbclegal_l +_ismbclower +_ismbclower_l +_ismbcprint +_ismbcprint_l +_ismbcpunct +_ismbcpunct_l +_ismbcspace +_ismbcspace_l +_ismbcsymbol +_ismbcsymbol_l +_ismbcupper +_ismbcupper_l +_ismbslead +_ismbslead_l +_ismbstrail +_ismbstrail_l +_isnan +F_X64(_isnanf) +_isprint_l +_ispunct_l +_isspace_l +_isupper_l +_iswalnum_l +_iswalpha_l +_iswblank_l +_iswcntrl_l +_iswcsym_l +_iswcsymf_l +_iswctype_l +_iswdigit_l +_iswgraph_l +_iswlower_l +_iswprint_l +_iswpunct_l +_iswspace_l +_iswupper_l +_iswxdigit_l +_isxdigit_l +_itoa +_itoa_s +_itow +_itow_s +_j0 +_j1 +_jn +_kbhit +_ld_int +_ldclass +_ldexp +_ldlog +_ldpcomp +_ldpoly +_ldscale +_ldsign +_ldsin +_ldtest +_ldunscale +_lfind +_lfind_s +F_I386(_libm_sse2_acos_precise) +F_I386(_libm_sse2_asin_precise) +F_I386(_libm_sse2_atan_precise) +F_I386(_libm_sse2_cos_precise) +F_I386(_libm_sse2_exp_precise) +F_I386(_libm_sse2_log10_precise) +F_I386(_libm_sse2_log_precise) +F_I386(_libm_sse2_pow_precise) +F_I386(_libm_sse2_sin_precise) +F_I386(_libm_sse2_sqrt_precise) +F_I386(_libm_sse2_tan_precise) +_loaddll +F64(_local_unwind) +F_I386(_local_unwind2) +F_I386(_local_unwind4) +_localtime32 +_localtime32_s +_localtime64 +_localtime64_s +_lock_file +_lock_locales +_locking +_logb +F_NON_I386(_logbf) +F_I386(_longjmpex) +_lrotl +_lrotr +_lsearch +_lsearch_s +_lseek +_lseeki64 +_ltoa +_ltoa_s +_ltow +_ltow_s +_makepath +_makepath_s +_malloc_base +F_DEBUG(_malloc_dbg) +_mbbtombc +_mbbtombc_l +_mbbtype +_mbbtype_l +_mbcasemap DATA +_mbccpy +_mbccpy_l +_mbccpy_s +_mbccpy_s_l +_mbcjistojms +_mbcjistojms_l +_mbcjmstojis +_mbcjmstojis_l +_mbclen +_mbclen_l +_mbctohira +_mbctohira_l +_mbctokata +_mbctokata_l +_mbctolower +_mbctolower_l +_mbctombb +_mbctombb_l +_mbctoupper +_mbctoupper_l +_mblen_l +_mbsbtype +_mbsbtype_l +_mbscat_s +_mbscat_s_l +_mbschr +_mbschr_l +_mbscmp +_mbscmp_l +_mbscoll +_mbscoll_l +_mbscpy_s +_mbscpy_s_l +_mbscspn +_mbscspn_l +_mbsdec +_mbsdec_l +_mbsdup +F_DEBUG(_mbsdup_dbg) +_mbsicmp +_mbsicmp_l +_mbsicoll +_mbsicoll_l +_mbsinc +_mbsinc_l +_mbslen +_mbslen_l +_mbslwr +_mbslwr_l +_mbslwr_s +_mbslwr_s_l +_mbsnbcat +_mbsnbcat_l +_mbsnbcat_s +_mbsnbcat_s_l +_mbsnbcmp +_mbsnbcmp_l +_mbsnbcnt +_mbsnbcnt_l +_mbsnbcoll +_mbsnbcoll_l +_mbsnbcpy +_mbsnbcpy_l +_mbsnbcpy_s +_mbsnbcpy_s_l +_mbsnbicmp +_mbsnbicmp_l +_mbsnbicoll +_mbsnbicoll_l +_mbsnbset +_mbsnbset_l +_mbsnbset_s +_mbsnbset_s_l +_mbsncat +_mbsncat_l +_mbsncat_s +_mbsncat_s_l +_mbsnccnt +_mbsnccnt_l +_mbsncmp +_mbsncmp_l +_mbsncoll +_mbsncoll_l +_mbsncpy +_mbsncpy_l +_mbsncpy_s +_mbsncpy_s_l +_mbsnextc +_mbsnextc_l +_mbsnicmp +_mbsnicmp_l +_mbsnicoll +_mbsnicoll_l +_mbsninc +_mbsninc_l +_mbsnlen +_mbsnlen_l +_mbsnset +_mbsnset_l +_mbsnset_s +_mbsnset_s_l +_mbspbrk +_mbspbrk_l +_mbsrchr +_mbsrchr_l +_mbsrev +_mbsrev_l +_mbsset +_mbsset_l +_mbsset_s +_mbsset_s_l +_mbsspn +_mbsspn_l +_mbsspnp +_mbsspnp_l +_mbsstr +_mbsstr_l +_mbstok +_mbstok_l +_mbstok_s +_mbstok_s_l +_mbstowcs_l +_mbstowcs_s_l +_mbstrlen +_mbstrlen_l +_mbstrnlen +_mbstrnlen_l +_mbsupr +_mbsupr_l +_mbsupr_s +_mbsupr_s_l +_mbtowc_l +_memccpy +_memicmp +_memicmp_l +_mkdir +_mkgmtime32 +_mkgmtime64 +_mktemp +_mktemp_s +_mktime32 +_mktime64 +_msize +F_DEBUG(_msize_dbg) +_nextafter +F_X64(_nextafterf) +F_I386(_o__CIacos) +F_I386(_o__CIasin) +F_I386(_o__CIatan) +F_I386(_o__CIatan2) +F_I386(_o__CIcos) +F_I386(_o__CIcosh) +F_I386(_o__CIexp) +F_I386(_o__CIfmod) +F_I386(_o__CIlog) +F_I386(_o__CIlog10) +F_I386(_o__CIpow) +F_I386(_o__CIsin) +F_I386(_o__CIsinh) +F_I386(_o__CIsqrt) +F_I386(_o__CItan) +F_I386(_o__CItanh) +_o__Getdays +_o__Getmonths +_o__Gettnames +_o__Strftime +_o__W_Getdays +_o__W_Getmonths +_o__W_Gettnames +_o__Wcsftime +_o___acrt_iob_func +_o___conio_common_vcprintf +_o___conio_common_vcprintf_p +_o___conio_common_vcprintf_s +_o___conio_common_vcscanf +_o___conio_common_vcwprintf +_o___conio_common_vcwprintf_p +_o___conio_common_vcwprintf_s +_o___conio_common_vcwscanf +_o___daylight +_o___dstbias +_o___fpe_flt_rounds +F_I386(_o___libm_sse2_acos) +F_I386(_o___libm_sse2_acosf) +F_I386(_o___libm_sse2_asin) +F_I386(_o___libm_sse2_asinf) +F_I386(_o___libm_sse2_atan) +F_I386(_o___libm_sse2_atan2) +F_I386(_o___libm_sse2_atanf) +F_I386(_o___libm_sse2_cos) +F_I386(_o___libm_sse2_cosf) +F_I386(_o___libm_sse2_exp) +F_I386(_o___libm_sse2_expf) +F_I386(_o___libm_sse2_log) +F_I386(_o___libm_sse2_log10) +F_I386(_o___libm_sse2_log10f) +F_I386(_o___libm_sse2_logf) +F_I386(_o___libm_sse2_pow) +F_I386(_o___libm_sse2_powf) +F_I386(_o___libm_sse2_sin) +F_I386(_o___libm_sse2_sinf) +F_I386(_o___libm_sse2_tan) +F_I386(_o___libm_sse2_tanf) +_o___p___argc +_o___p___argv +_o___p___wargv +_o___p__acmdln +_o___p__commode +_o___p__environ +_o___p__fmode +_o___p__mbcasemap +_o___p__mbctype +_o___p__pgmptr +_o___p__wcmdln +_o___p__wenviron +_o___p__wpgmptr +_o___pctype_func +_o___pwctype_func +_o___stdio_common_vfprintf +_o___stdio_common_vfprintf_p +_o___stdio_common_vfprintf_s +_o___stdio_common_vfscanf +_o___stdio_common_vfwprintf +_o___stdio_common_vfwprintf_p +_o___stdio_common_vfwprintf_s +_o___stdio_common_vfwscanf +_o___stdio_common_vsnprintf_s +_o___stdio_common_vsnwprintf_s +_o___stdio_common_vsprintf +_o___stdio_common_vsprintf_p +_o___stdio_common_vsprintf_s +_o___stdio_common_vsscanf +_o___stdio_common_vswprintf +_o___stdio_common_vswprintf_p +_o___stdio_common_vswprintf_s +_o___stdio_common_vswscanf +_o___timezone +_o___tzname +_o___wcserror +_o__access +_o__access_s +_o__aligned_free +_o__aligned_malloc +_o__aligned_msize +_o__aligned_offset_malloc +_o__aligned_offset_realloc +_o__aligned_offset_recalloc +_o__aligned_realloc +_o__aligned_recalloc +_o__atodbl +_o__atodbl_l +_o__atof_l +_o__atoflt +_o__atoflt_l +_o__atoi64 +_o__atoi64_l +_o__atoi_l +_o__atol_l +_o__atoldbl +_o__atoldbl_l +_o__atoll_l +_o__beep +_o__beginthread +_o__beginthreadex +_o__cabs +_o__callnewh +_o__calloc_base +_o__cgets +_o__cgets_s +_o__cgetws +_o__cgetws_s +_o__chdir +_o__chdrive +_o__chmod +_o__chsize +_o__chsize_s +_o__close +_o__commit +_o__configure_wide_argv +_o__cputs +_o__cputws +_o__creat +_o__create_locale +_o__ctime32_s +_o__ctime64_s +_o__cwait +_o__d_int +_o__dclass +_o__difftime32 +_o__difftime64 +_o__dlog +_o__dnorm +_o__dpcomp +_o__dpoly +_o__dscale +_o__dsign +_o__dsin +_o__dtest +_o__dunscale +_o__dup +_o__dup2 +_o__dupenv_s +_o__ecvt +_o__ecvt_s +_o__endthread +_o__endthreadex +_o__eof +_o__errno +_o__except1 +_o__execute_onexit_table +_o__execv +_o__execve +_o__execvp +_o__execvpe +_o__expand +_o__fclose_nolock +_o__fcloseall +_o__fcvt +_o__fcvt_s +_o__fd_int +_o__fdclass +_o__fdexp +_o__fdlog +_o__fdopen +_o__fdpcomp +_o__fdpoly +_o__fdscale +_o__fdsign +_o__fdsin +_o__fflush_nolock +_o__fgetc_nolock +_o__fgetchar +_o__fgetwc_nolock +_o__fgetwchar +_o__filelength +_o__filelengthi64 +_o__fileno +_o__findclose +_o__findfirst32 +_o__findfirst32i64 +_o__findfirst64 +_o__findfirst64i32 +_o__findnext32 +_o__findnext32i64 +_o__findnext64 +_o__findnext64i32 +_o__flushall +_o__fpclass +F_X64(_o__fpclassf) +_o__fputc_nolock +_o__fputchar +_o__fputwc_nolock +_o__fputwchar +_o__fread_nolock +_o__fread_nolock_s +_o__free_base +_o__free_locale +_o__fseek_nolock +_o__fseeki64 +_o__fseeki64_nolock +_o__fsopen +_o__fstat32 +_o__fstat32i64 +_o__fstat64 +_o__fstat64i32 +_o__ftell_nolock +_o__ftelli64 +_o__ftelli64_nolock +_o__ftime32 +_o__ftime32_s +_o__ftime64 +_o__ftime64_s +_o__fullpath +_o__futime32 +_o__futime64 +_o__fwrite_nolock +_o__gcvt +_o__gcvt_s +_o__get_daylight +_o__get_doserrno +_o__get_dstbias +_o__get_errno +_o__get_fmode +_o__get_heap_handle +_o__get_invalid_parameter_handler +_o__get_narrow_winmain_command_line +_o__get_osfhandle +_o__get_pgmptr +_o__get_stream_buffer_pointers +_o__get_terminate +_o__get_thread_local_invalid_parameter_handler +_o__get_timezone +_o__get_tzname +_o__get_wide_winmain_command_line +_o__get_wpgmptr +_o__getc_nolock +_o__getch +_o__getch_nolock +_o__getche +_o__getche_nolock +_o__getcwd +_o__getdcwd +_o__getdiskfree +_o__getdllprocaddr +_o__getdrive +_o__getdrives +_o__getmbcp +_o__getsystime +_o__getw +_o__getwc_nolock +_o__getwch +_o__getwch_nolock +_o__getwche +_o__getwche_nolock +_o__getws +_o__getws_s +_o__gmtime32 +_o__gmtime32_s +_o__gmtime64 +_o__gmtime64_s +_o__heapchk +_o__heapmin +_o__hypot +_o__hypotf +_o__i64toa +_o__i64toa_s +_o__i64tow +_o__i64tow_s +_o__initialize_onexit_table +_o__invalid_parameter_noinfo +_o__invalid_parameter_noinfo_noreturn +_o__isatty +_o__isctype +_o__isctype_l +_o__isleadbyte_l +_o__ismbbalnum +_o__ismbbalnum_l +_o__ismbbalpha +_o__ismbbalpha_l +_o__ismbbblank +_o__ismbbblank_l +_o__ismbbgraph +_o__ismbbgraph_l +_o__ismbbkalnum +_o__ismbbkalnum_l +_o__ismbbkana +_o__ismbbkana_l +_o__ismbbkprint +_o__ismbbkprint_l +_o__ismbbkpunct +_o__ismbbkpunct_l +_o__ismbblead +_o__ismbblead_l +_o__ismbbprint +_o__ismbbprint_l +_o__ismbbpunct +_o__ismbbpunct_l +_o__ismbbtrail +_o__ismbbtrail_l +_o__ismbcalnum +_o__ismbcalnum_l +_o__ismbcalpha +_o__ismbcalpha_l +_o__ismbcblank +_o__ismbcblank_l +_o__ismbcdigit +_o__ismbcdigit_l +_o__ismbcgraph +_o__ismbcgraph_l +_o__ismbchira +_o__ismbchira_l +_o__ismbckata +_o__ismbckata_l +_o__ismbcl0 +_o__ismbcl0_l +_o__ismbcl1 +_o__ismbcl1_l +_o__ismbcl2 +_o__ismbcl2_l +_o__ismbclegal +_o__ismbclegal_l +_o__ismbclower +_o__ismbclower_l +_o__ismbcprint +_o__ismbcprint_l +_o__ismbcpunct +_o__ismbcpunct_l +_o__ismbcspace +_o__ismbcspace_l +_o__ismbcsymbol +_o__ismbcsymbol_l +_o__ismbcupper +_o__ismbcupper_l +_o__ismbslead +_o__ismbslead_l +_o__ismbstrail +_o__ismbstrail_l +_o__iswctype_l +_o__itoa +_o__itoa_s +_o__itow +_o__itow_s +_o__j0 +_o__j1 +_o__jn +_o__kbhit +_o__ld_int +_o__ldclass +_o__ldexp +_o__ldlog +_o__ldpcomp +_o__ldpoly +_o__ldscale +_o__ldsign +_o__ldsin +_o__ldtest +_o__ldunscale +_o__lfind +_o__lfind_s +F_I386(_o__libm_sse2_acos_precise) +F_I386(_o__libm_sse2_asin_precise) +F_I386(_o__libm_sse2_atan_precise) +F_I386(_o__libm_sse2_cos_precise) +F_I386(_o__libm_sse2_exp_precise) +F_I386(_o__libm_sse2_log10_precise) +F_I386(_o__libm_sse2_log_precise) +F_I386(_o__libm_sse2_pow_precise) +F_I386(_o__libm_sse2_sin_precise) +F_I386(_o__libm_sse2_sqrt_precise) +F_I386(_o__libm_sse2_tan_precise) +_o__loaddll +_o__localtime32 +_o__localtime32_s +_o__localtime64 +_o__localtime64_s +_o__lock_file +_o__locking +_o__logb +F_NON_I386(_o__logbf) +_o__lsearch +_o__lsearch_s +_o__lseek +_o__lseeki64 +_o__ltoa +_o__ltoa_s +_o__ltow +_o__ltow_s +_o__makepath +_o__makepath_s +_o__malloc_base +_o__mbbtombc +_o__mbbtombc_l +_o__mbbtype +_o__mbbtype_l +_o__mbccpy +_o__mbccpy_l +_o__mbccpy_s +_o__mbccpy_s_l +_o__mbcjistojms +_o__mbcjistojms_l +_o__mbcjmstojis +_o__mbcjmstojis_l +_o__mbclen +_o__mbclen_l +_o__mbctohira +_o__mbctohira_l +_o__mbctokata +_o__mbctokata_l +_o__mbctolower +_o__mbctolower_l +_o__mbctombb +_o__mbctombb_l +_o__mbctoupper +_o__mbctoupper_l +_o__mblen_l +_o__mbsbtype +_o__mbsbtype_l +_o__mbscat_s +_o__mbscat_s_l +_o__mbschr +_o__mbschr_l +_o__mbscmp +_o__mbscmp_l +_o__mbscoll +_o__mbscoll_l +_o__mbscpy_s +_o__mbscpy_s_l +_o__mbscspn +_o__mbscspn_l +_o__mbsdec +_o__mbsdec_l +_o__mbsicmp +_o__mbsicmp_l +_o__mbsicoll +_o__mbsicoll_l +_o__mbsinc +_o__mbsinc_l +_o__mbslen +_o__mbslen_l +_o__mbslwr +_o__mbslwr_l +_o__mbslwr_s +_o__mbslwr_s_l +_o__mbsnbcat +_o__mbsnbcat_l +_o__mbsnbcat_s +_o__mbsnbcat_s_l +_o__mbsnbcmp +_o__mbsnbcmp_l +_o__mbsnbcnt +_o__mbsnbcnt_l +_o__mbsnbcoll +_o__mbsnbcoll_l +_o__mbsnbcpy +_o__mbsnbcpy_l +_o__mbsnbcpy_s +_o__mbsnbcpy_s_l +_o__mbsnbicmp +_o__mbsnbicmp_l +_o__mbsnbicoll +_o__mbsnbicoll_l +_o__mbsnbset +_o__mbsnbset_l +_o__mbsnbset_s +_o__mbsnbset_s_l +_o__mbsncat +_o__mbsncat_l +_o__mbsncat_s +_o__mbsncat_s_l +_o__mbsnccnt +_o__mbsnccnt_l +_o__mbsncmp +_o__mbsncmp_l +_o__mbsncoll +_o__mbsncoll_l +_o__mbsncpy +_o__mbsncpy_l +_o__mbsncpy_s +_o__mbsncpy_s_l +_o__mbsnextc +_o__mbsnextc_l +_o__mbsnicmp +_o__mbsnicmp_l +_o__mbsnicoll +_o__mbsnicoll_l +_o__mbsninc +_o__mbsninc_l +_o__mbsnlen +_o__mbsnlen_l +_o__mbsnset +_o__mbsnset_l +_o__mbsnset_s +_o__mbsnset_s_l +_o__mbspbrk +_o__mbspbrk_l +_o__mbsrchr +_o__mbsrchr_l +_o__mbsrev +_o__mbsrev_l +_o__mbsset +_o__mbsset_l +_o__mbsset_s +_o__mbsset_s_l +_o__mbsspn +_o__mbsspn_l +_o__mbsspnp +_o__mbsspnp_l +_o__mbsstr +_o__mbsstr_l +_o__mbstok +_o__mbstok_l +_o__mbstok_s +_o__mbstok_s_l +_o__mbstowcs_l +_o__mbstowcs_s_l +_o__mbstrlen +_o__mbstrlen_l +_o__mbstrnlen +_o__mbstrnlen_l +_o__mbsupr +_o__mbsupr_l +_o__mbsupr_s +_o__mbsupr_s_l +_o__mbtowc_l +_o__memicmp +_o__memicmp_l +_o__mkdir +_o__mkgmtime32 +_o__mkgmtime64 +_o__mktemp +_o__mktemp_s +_o__mktime32 +_o__mktime64 +_o__msize +_o__nextafter +F_X64(_o__nextafterf) +_o__open_osfhandle +_o__pclose +_o__pipe +_o__popen +_o__putc_nolock +_o__putch +_o__putch_nolock +_o__putenv +_o__putenv_s +_o__putw +_o__putwc_nolock +_o__putwch +_o__putwch_nolock +_o__putws +_o__read +_o__realloc_base +_o__recalloc +_o__register_onexit_function +_o__resetstkoflw +_o__rmdir +_o__rmtmp +_o__scalb +F_X64(_o__scalbf) +_o__searchenv +_o__searchenv_s +_o__set_abort_behavior +_o__set_doserrno +_o__set_errno +_o__set_invalid_parameter_handler +_o__set_new_handler +_o__set_new_mode +_o__set_thread_local_invalid_parameter_handler +_o__seterrormode +_o__setmbcp +_o__setmode +_o__setsystime +_o__sleep +_o__sopen +_o__sopen_dispatch +_o__sopen_s +_o__spawnv +_o__spawnve +_o__spawnvp +_o__spawnvpe +_o__splitpath +_o__splitpath_s +_o__stat32 +_o__stat32i64 +_o__stat64 +_o__stat64i32 +_o__strcoll_l +_o__strdate +_o__strdate_s +_o__strdup +_o__strerror +_o__strerror_s +_o__strftime_l +_o__stricmp +_o__stricmp_l +_o__stricoll +_o__stricoll_l +_o__strlwr +_o__strlwr_l +_o__strlwr_s +_o__strlwr_s_l +_o__strncoll +_o__strncoll_l +_o__strnicmp +_o__strnicmp_l +_o__strnicoll +_o__strnicoll_l +_o__strnset_s +_o__strset_s +_o__strtime +_o__strtime_s +_o__strtod_l +_o__strtof_l +_o__strtoi64 +_o__strtoi64_l +_o__strtol_l +F_ARM_ANY(_o__strtold_l) ; Can't use long double functions from the CRT on x86 +_o__strtoll_l +_o__strtoui64 +_o__strtoui64_l +_o__strtoul_l +_o__strtoull_l +_o__strupr +_o__strupr_l +_o__strupr_s +_o__strupr_s_l +_o__strxfrm_l +_o__swab +_o__tell +_o__telli64 +_o__timespec32_get +_o__timespec64_get +_o__tolower +_o__tolower_l +_o__toupper +_o__toupper_l +_o__towlower_l +_o__towupper_l +_o__tzset +_o__ui64toa +_o__ui64toa_s +_o__ui64tow +_o__ui64tow_s +_o__ultoa +_o__ultoa_s +_o__ultow +_o__ultow_s +_o__umask +_o__umask_s +_o__ungetc_nolock +_o__ungetch +_o__ungetch_nolock +_o__ungetwc_nolock +_o__ungetwch +_o__ungetwch_nolock +_o__unlink +_o__unloaddll +_o__unlock_file +_o__utime32 +_o__utime64 +_o__waccess +_o__waccess_s +_o__wasctime +_o__wasctime_s +_o__wchdir +_o__wchmod +_o__wcreat +_o__wcreate_locale +_o__wcscoll_l +_o__wcsdup +_o__wcserror +_o__wcserror_s +_o__wcsftime_l +_o__wcsicmp +_o__wcsicmp_l +_o__wcsicoll +_o__wcsicoll_l +_o__wcslwr +_o__wcslwr_l +_o__wcslwr_s +_o__wcslwr_s_l +_o__wcsncoll +_o__wcsncoll_l +_o__wcsnicmp +_o__wcsnicmp_l +_o__wcsnicoll +_o__wcsnicoll_l +_o__wcsnset +_o__wcsnset_s +_o__wcsset +_o__wcsset_s +_o__wcstod_l +_o__wcstof_l +_o__wcstoi64 +_o__wcstoi64_l +_o__wcstol_l +F_ARM_ANY(_o__wcstold_l) ; Can't use long double functions from the CRT on x86 +_o__wcstoll_l +_o__wcstombs_l +_o__wcstombs_s_l +_o__wcstoui64 +_o__wcstoui64_l +_o__wcstoul_l +_o__wcstoull_l +_o__wcsupr +_o__wcsupr_l +_o__wcsupr_s +_o__wcsupr_s_l +_o__wcsxfrm_l +_o__wctime32 +_o__wctime32_s +_o__wctime64 +_o__wctime64_s +_o__wctomb_l +_o__wctomb_s_l +_o__wdupenv_s +_o__wexecv +_o__wexecve +_o__wexecvp +_o__wexecvpe +_o__wfdopen +_o__wfindfirst32 +_o__wfindfirst32i64 +_o__wfindfirst64 +_o__wfindfirst64i32 +_o__wfindnext32 +_o__wfindnext32i64 +_o__wfindnext64 +_o__wfindnext64i32 +_o__wfopen +_o__wfopen_s +_o__wfreopen +_o__wfreopen_s +_o__wfsopen +_o__wfullpath +_o__wgetcwd +_o__wgetdcwd +_o__wgetenv +_o__wgetenv_s +_o__wmakepath +_o__wmakepath_s +_o__wmkdir +_o__wmktemp +_o__wmktemp_s +_o__wperror +_o__wpopen +_o__wputenv +_o__wputenv_s +_o__wremove +_o__wrename +_o__write +_o__wrmdir +_o__wsearchenv +_o__wsearchenv_s +_o__wsetlocale +_o__wsopen_dispatch +_o__wsopen_s +_o__wspawnv +_o__wspawnve +_o__wspawnvp +_o__wspawnvpe +_o__wsplitpath +_o__wsplitpath_s +_o__wstat32 +_o__wstat32i64 +_o__wstat64 +_o__wstat64i32 +_o__wstrdate +_o__wstrdate_s +_o__wstrtime +_o__wstrtime_s +_o__wsystem +_o__wtmpnam_s +_o__wtof +_o__wtof_l +_o__wtoi +_o__wtoi64 +_o__wtoi64_l +_o__wtoi_l +_o__wtol +_o__wtol_l +_o__wtoll +_o__wtoll_l +_o__wunlink +_o__wutime32 +_o__wutime64 +_o__y0 +_o__y1 +_o__yn +_o_abort +_o_acos +F_NON_I386(_o_acosf) +_o_acosh +_o_acoshf +F_ARM_ANY(_o_acoshl) ; Can't use long double functions from the CRT on x86 +_o_asctime +_o_asctime_s +_o_asin +F_NON_I386(_o_asinf) +_o_asinh +_o_asinhf +F_ARM_ANY(_o_asinhl) ; Can't use long double functions from the CRT on x86 +_o_atan +_o_atan2 +F_NON_I386(_o_atan2f) +F_NON_I386(_o_atanf) +_o_atanh +_o_atanhf +F_ARM_ANY(_o_atanhl) ; Can't use long double functions from the CRT on x86 +_o_atof +_o_atoi +_o_atol +_o_atoll +_o_bsearch +_o_bsearch_s +_o_btowc +_o_calloc +_o_cbrt +_o_cbrtf +_o_ceil +F_NON_I386(_o_ceilf) +_o_clearerr +_o_clearerr_s +_o_cos +F_NON_I386(_o_cosf) +_o_cosh +F_NON_I386(_o_coshf) +_o_erf +_o_erfc +_o_erfcf +F_ARM_ANY(_o_erfcl) ; Can't use long double functions from the CRT on x86 +_o_erff +F_ARM_ANY(_o_erfl) ; Can't use long double functions from the CRT on x86 +_o_exp +_o_exp2 +_o_exp2f +F_ARM_ANY(_o_exp2l) ; Can't use long double functions from the CRT on x86 +F_NON_I386(_o_expf) +_o_fabs +F_ARM_ANY(_o_fabsf) +_o_fclose +_o_feof +_o_ferror +_o_fflush +_o_fgetc +_o_fgetpos +_o_fgets +_o_fgetwc +_o_fgetws +_o_floor +F_NON_I386(_o_floorf) +_o_fma +_o_fmaf +F_ARM_ANY(_o_fmal) ; Can't use long double functions from the CRT on x86 +_o_fmod +F_NON_I386(_o_fmodf) +_o_fopen +_o_fopen_s +_o_fputc +_o_fputs +_o_fputwc +_o_fputws +_o_fread +_o_fread_s +_o_free +_o_freopen +_o_freopen_s +_o_frexp +_o_fseek +_o_fsetpos +_o_ftell +_o_fwrite +_o_getc +_o_getchar +_o_getenv +_o_getenv_s +_o_gets +_o_gets_s +_o_getwc +_o_getwchar +_o_hypot +_o_is_wctype +_o_isalnum +_o_isalpha +_o_isblank +_o_iscntrl +_o_isdigit +_o_isgraph +_o_isleadbyte +_o_islower +_o_isprint +_o_ispunct +_o_isspace +_o_isupper +_o_iswalnum +_o_iswalpha +_o_iswascii +_o_iswblank +_o_iswcntrl +_o_iswctype +_o_iswdigit +_o_iswgraph +_o_iswlower +_o_iswprint +_o_iswpunct +_o_iswspace +_o_iswupper +_o_iswxdigit +_o_isxdigit +_o_ldexp +_o_lgamma +_o_lgammaf +F_ARM_ANY(_o_lgammal) ; Can't use long double functions from the CRT on x86 +_o_llrint +_o_llrintf +F_ARM_ANY(_o_llrintl) ; Can't use long double functions from the CRT on x86 +_o_llround +_o_llroundf +F_ARM_ANY(_o_llroundl) ; Can't use long double functions from the CRT on x86 +_o_localeconv +_o_log +_o_log10 +F_NON_I386(_o_log10f) +_o_log1p +_o_log1pf +F_ARM_ANY(_o_log1pl) ; Can't use long double functions from the CRT on x86 +_o_log2 +_o_log2f +F_ARM_ANY(_o_log2l) ; Can't use long double functions from the CRT on x86 +_o_logb +_o_logbf +F_ARM_ANY(_o_logbl) ; Can't use long double functions from the CRT on x86 +F_NON_I386(_o_logf) +_o_lrint +_o_lrintf +F_ARM_ANY(_o_lrintl) ; Can't use long double functions from the CRT on x86 +_o_lround +_o_lroundf +F_ARM_ANY(_o_lroundl) ; Can't use long double functions from the CRT on x86 +_o_malloc +_o_mblen +_o_mbrlen +_o_mbrtoc16 +_o_mbrtoc32 +_o_mbrtowc +_o_mbsrtowcs +_o_mbsrtowcs_s +_o_mbstowcs +_o_mbstowcs_s +_o_mbtowc +_o_memset +_o_modf +F_NON_I386(_o_modff) +_o_nan +_o_nanf +F_ARM_ANY(_o_nanl) ; Can't use long double functions from the CRT on x86 +_o_nearbyint +_o_nearbyintf +F_ARM_ANY(_o_nearbyintl) ; Can't use long double functions from the CRT on x86 +_o_nextafter +_o_nextafterf +F_ARM_ANY(_o_nextafterl) ; Can't use long double functions from the CRT on x86 +F_ARM_ANY(_o_nexttoward) ; Can't use long double functions from the CRT on x86 +F_ARM_ANY(_o_nexttowardf) ; Can't use long double functions from the CRT on x86 +F_ARM_ANY(_o_nexttowardl) ; Can't use long double functions from the CRT on x86 +_o_pow +_o_powf +_o_putc +_o_putchar +_o_puts +_o_putwc +_o_putwchar +_o_qsort +_o_qsort_s +_o_raise +_o_rand +_o_rand_s +_o_realloc +_o_remainder +_o_remainderf +F_ARM_ANY(_o_remainderl) ; Can't use long double functions from the CRT on x86 +_o_remove +_o_remquo +_o_remquof +F_ARM_ANY(_o_remquol) ; Can't use long double functions from the CRT on x86 +_o_rewind +_o_rint +_o_rintf +F_ARM_ANY(_o_rintl) ; Can't use long double functions from the CRT on x86 +_o_round +_o_roundf +F_ARM_ANY(_o_roundl) ; Can't use long double functions from the CRT on x86 +_o_scalbln +_o_scalblnf +F_ARM_ANY(_o_scalblnl) ; Can't use long double functions from the CRT on x86 +_o_scalbn +_o_scalbnf +F_ARM_ANY(_o_scalbnl) ; Can't use long double functions from the CRT on x86 +_o_set_terminate +_o_setbuf +_o_setvbuf +_o_sin +F_NON_I386(_o_sinf) +_o_sinh +F_NON_I386(_o_sinhf) +_o_sqrt +F_NON_I386(_o_sqrtf) +_o_srand +_o_strcat_s +_o_strcoll +_o_strcpy_s +_o_strerror +_o_strerror_s +_o_strftime +_o_strncat_s +_o_strncpy_s +_o_strtod +_o_strtof +_o_strtok +_o_strtok_s +_o_strtol +F_ARM_ANY(_o_strtold) ; Can't use long double functions from the CRT on x86 +_o_strtoll +_o_strtoul +_o_strtoull +_o_system +_o_tan +F_NON_I386(_o_tanf) +_o_tanh +F_NON_I386(_o_tanhf) +_o_terminate +_o_tgamma +_o_tgammaf +F_ARM_ANY(_o_tgammal) ; Can't use long double functions from the CRT on x86 +_o_tmpfile_s +_o_tmpnam_s +_o_tolower +_o_toupper +_o_towlower +_o_towupper +_o_ungetc +_o_ungetwc +_o_wcrtomb +_o_wcrtomb_s +_o_wcscat_s +_o_wcscoll +_o_wcscpy +_o_wcscpy_s +_o_wcsftime +_o_wcsncat_s +_o_wcsncpy_s +_o_wcsrtombs +_o_wcsrtombs_s +_o_wcstod +_o_wcstof +_o_wcstok +_o_wcstok_s +_o_wcstol +F_ARM_ANY(_o_wcstold) ; Can't use long double functions from the CRT on x86 +_o_wcstoll +_o_wcstombs +_o_wcstombs_s +_o_wcstoul +_o_wcstoull +_o_wctob +_o_wctomb +_o_wctomb_s +_o_wmemcpy_s +_o_wmemmove_s +_open +_open_osfhandle +_pclose +_pipe +_popen +_purecall +_putc_nolock +_putch +_putch_nolock +_putenv +_putenv_s +_putw +_putwc_nolock +_putwch +_putwch_nolock +_putws +_query_app_type +_query_new_handler +_query_new_mode +_read +_realloc_base +F_DEBUG(_realloc_dbg) +_recalloc +F_DEBUG(_recalloc_dbg) +_register_onexit_function +_register_thread_local_exe_atexit_callback +_resetstkoflw +_rmdir +_rmtmp +_rotl +_rotl64 +_rotr +_rotr64 +_scalb +F_X64(_scalbf) +_searchenv +_searchenv_s +_seh_filter_dll +_seh_filter_exe +F_X64(_set_FMA3_enable) +F_I386(_seh_longjmp_unwind4@4) +F_I386(_seh_longjmp_unwind@4) +F_I386(_set_SSE2_enable) +_set_abort_behavior +_set_app_type +_set_controlfp +_set_doserrno +_set_errno +_set_error_mode +_set_fmode +_set_invalid_parameter_handler +_set_new_handler +_set_new_mode +_set_printf_count_output +_set_purecall_handler +_set_se_translator +_set_thread_local_invalid_parameter_handler +_seterrormode +F_I386(_setjmp3) +_setmaxstdio +_setmbcp +_setmode +_setsystime +_sleep +_sopen +_sopen_dispatch +_sopen_s +_spawnl +_spawnle +_spawnlp +_spawnlpe +_spawnv +_spawnve +_spawnvp +_spawnvpe +_splitpath +_splitpath_s +_stat32 +_stat32i64 +_stat64 +_stat64i32 +_statusfp +F_I386(_statusfp2) +_strcoll_l +_strdate +_strdate_s +_strdup +F_DEBUG(_strdup_dbg) +_strerror +_strerror_s +_strftime_l +_stricmp +_stricmp_l +_stricoll +_stricoll_l +_strlwr +_strlwr_l +_strlwr_s +_strlwr_s_l +_strncoll +_strncoll_l +_strnicmp +_strnicmp_l +_strnicoll +_strnicoll_l +_strnset +_strnset_s +_strrev +_strset +_strset_s +_strtime +_strtime_s +_strtod_l +_strtof_l +_strtoi64 +_strtoi64_l +_strtoimax_l +_strtol_l +F_ARM_ANY(_strtold_l) ; Can't use long double functions from the CRT on x86 +_strtoll_l +_strtoui64 +_strtoui64_l +_strtoul_l +_strtoull_l +_strtoumax_l +_strupr +_strupr_l +_strupr_s +_strupr_s_l +_strxfrm_l +_swab +_tell +_telli64 +_tempnam +F_DEBUG(_tempnam_dbg) +_time32 +_time64 +_timespec32_get +_timespec64_get +_tolower +_tolower_l +_toupper +_toupper_l +_towlower_l +_towupper_l +_tzset DATA ; This is wrapped in the compat code. +_ui64toa +_ui64toa_s +_ui64tow +_ui64tow_s +_ultoa +_ultoa_s +_ultow +_ultow_s +_umask +_umask_s +_ungetc_nolock +_ungetch +_ungetch_nolock +_ungetwc_nolock +_ungetwch +_ungetwch_nolock +_unlink +_unloaddll +_unlock_file +_unlock_locales +_utime32 +_utime64 +_waccess +_waccess_s +_wasctime +_wasctime_s +_wassert +_wchdir +_wchmod +_wcreat +_wcreate_locale +_wcscoll_l +_wcsdup +F_DEBUG(_wcsdup_dbg) +_wcserror +_wcserror_s +_wcsftime_l +_wcsicmp +_wcsicmp_l +_wcsicoll +_wcsicoll_l +_wcslwr +_wcslwr_l +_wcslwr_s +_wcslwr_s_l +_wcsncoll +_wcsncoll_l +_wcsnicmp +_wcsnicmp_l +_wcsnicoll +_wcsnicoll_l +_wcsnset +_wcsnset_s +_wcsrev +_wcsset +_wcsset_s +_wcstod_l +_wcstof_l +_wcstoi64 +_wcstoi64_l +_wcstoimax_l +_wcstol_l +F_ARM_ANY(_wcstold_l) ; Can't use long double functions from the CRT on x86 +_wcstoll_l +_wcstombs_l +_wcstombs_s_l +_wcstoui64 +_wcstoui64_l +_wcstoul_l +_wcstoull_l +_wcstoumax_l +_wcsupr +_wcsupr_l +_wcsupr_s +_wcsupr_s_l +_wcsxfrm_l +_wctime32 +_wctime32_s +_wctime64 +_wctime64_s +_wctomb_l +_wctomb_s_l +_wctype DATA +_wdupenv_s +F_DEBUG(_wdupenv_s_dbg) +_wexecl +_wexecle +_wexeclp +_wexeclpe +_wexecv +_wexecve +_wexecvp +_wexecvpe +_wfdopen +_wfindfirst32 +_wfindfirst32i64 +_wfindfirst64 +_wfindfirst64i32 +_wfindnext32 +_wfindnext32i64 +_wfindnext64 +_wfindnext64i32 +_wfopen +_wfopen_s +_wfreopen +_wfreopen_s +_wfsopen +_wfullpath +F_DEBUG(_wfullpath_dbg) +_wgetcwd +F_DEBUG(_wgetcwd_dbg) +_wgetdcwd +F_DEBUG(_wgetdcwd_dbg) +_wgetenv +_wgetenv_s +_wmakepath +_wmakepath_s +_wmkdir +_wmktemp +_wmktemp_s +_wopen +_wperror +_wpopen +_wputenv +_wputenv_s +_wremove +_wrename +_write +_wrmdir +_wsearchenv +_wsearchenv_s +_wsetlocale +_wsopen +_wsopen_dispatch +_wsopen_s +_wspawnl +_wspawnle +_wspawnlp +_wspawnlpe +_wspawnv +_wspawnve +_wspawnvp +_wspawnvpe +_wsplitpath +_wsplitpath_s +_wstat32 +_wstat32i64 +_wstat64 +_wstat64i32 +_wstrdate +_wstrdate_s +_wstrtime +_wstrtime_s +_wsystem +_wtempnam +F_DEBUG(_wtempnam_dbg) +_wtmpnam +_wtmpnam_s +_wtof +_wtof_l +_wtoi +_wtoi64 +_wtoi64_l +_wtoi_l +_wtol +_wtol_l +_wtoll +_wtoll_l +_wunlink +_wutime32 +_wutime64 +_y0 +_y1 +_yn +abort +abs +acos +F_NON_I386(acosf) +acosh +acoshf +F_ARM_ANY(acoshl) ; Can't use long double functions from the CRT on x86 +asctime +asctime_s +asin +F_NON_I386(asinf) +asinh +asinhf +F_ARM_ANY(asinhl) ; Can't use long double functions from the CRT on x86 +atan +atan2 +F_NON_I386(atan2f) +F_NON_I386(atanf) +atanh +atanhf +F_ARM_ANY(atanhl) ; Can't use long double functions from the CRT on x86 +atof +atoi +atol +atoll +bsearch +bsearch_s +btowc +c16rtomb +c32rtomb +cabs +cabsf +F_ARM_ANY(cabsl) ; Can't use long double functions from the CRT on x86 +cacos +cacosf +cacosh +cacoshf +F_ARM_ANY(cacoshl) ; Can't use long double functions from the CRT on x86 +F_ARM_ANY(cacosl) ; Can't use long double functions from the CRT on x86 +calloc +carg +cargf +F_ARM_ANY(cargl) ; Can't use long double functions from the CRT on x86 +casin +casinf +casinh +casinhf +F_ARM_ANY(casinhl) ; Can't use long double functions from the CRT on x86 +F_ARM_ANY(casinl) ; Can't use long double functions from the CRT on x86 +catan +catanf +catanh +catanhf +F_ARM_ANY(catanhl) ; Can't use long double functions from the CRT on x86 +F_ARM_ANY(catanl) ; Can't use long double functions from the CRT on x86 +cbrt +cbrtf +F_ARM_ANY(cbrtl) ; Can't use long double functions from the CRT on x86 +ccos +ccosf +ccosh +ccoshf +F_ARM_ANY(ccoshl) ; Can't use long double functions from the CRT on x86 +F_ARM_ANY(ccosl) ; Can't use long double functions from the CRT on x86 +ceil +F_NON_I386(ceilf) +cexp +cexpf +F_ARM_ANY(cexpl) ; Can't use long double functions from the CRT on x86 +cimag +cimagf +F_ARM_ANY(cimagl) ; Can't use long double functions from the CRT on x86 +clearerr +clearerr_s +clock +clog +clog10 +clog10f +F_ARM_ANY(clog10l) ; Can't use long double functions from the CRT on x86 +clogf +F_ARM_ANY(clogl) ; Can't use long double functions from the CRT on x86 +conj +conjf +F_ARM_ANY(conjl) ; Can't use long double functions from the CRT on x86 +copysign +copysignf +F_ARM_ANY(copysignl) ; Can't use long double functions from the CRT on x86 +cos +F_NON_I386(cosf) +cosh +F_NON_I386(coshf) +cpow +cpowf +F_ARM_ANY(cpowl) ; Can't use long double functions from the CRT on x86 +cproj +cprojf +F_ARM_ANY(cprojl) ; Can't use long double functions from the CRT on x86 +creal +crealf +F_ARM_ANY(creall) ; Can't use long double functions from the CRT on x86 +csin +csinf +csinh +csinhf +F_ARM_ANY(csinhl) ; Can't use long double functions from the CRT on x86 +F_ARM_ANY(csinl) ; Can't use long double functions from the CRT on x86 +csqrt +csqrtf +F_ARM_ANY(csqrtl) ; Can't use long double functions from the CRT on x86 +ctan +ctanf +ctanh +ctanhf +F_ARM_ANY(ctanhl) ; Can't use long double functions from the CRT on x86 +F_ARM_ANY(ctanl) ; Can't use long double functions from the CRT on x86 +div +erf +erfc +erfcf +F_ARM_ANY(erfcl) ; Can't use long double functions from the CRT on x86 +erff +F_ARM_ANY(erfl) ; Can't use long double functions from the CRT on x86 +exit +exp +exp2 +exp2f +F_ARM_ANY(exp2l) ; Can't use long double functions from the CRT on x86 +F_NON_I386(expf) +expm1 +expm1f +F_ARM_ANY(expm1l) ; Can't use long double functions from the CRT on x86 +fabs +F_ARM_ANY(fabsf) +fclose +fdim +fdimf +F_ARM_ANY(fdiml) ; Can't use long double functions from the CRT on x86 +; Don't use the float env functions from UCRT; fesetround doesn't seem to have +; any effect on the FPU control word as required by other libmingwex math +; routines. +feclearexcept DATA +fegetenv DATA +fegetexceptflag DATA +fegetround DATA +feholdexcept DATA +feof +ferror +fesetenv DATA +fesetexceptflag DATA +fesetround DATA +fetestexcept DATA +fflush +fgetc +fgetpos +fgets +fgetwc +fgetws +floor +F_NON_I386(floorf) +fma +fmaf +F_ARM_ANY(fmal) ; Can't use long double functions from the CRT on x86 +fmax +fmaxf +F_ARM_ANY(fmaxl) ; Can't use long double functions from the CRT on x86 +fmin +fminf +F_ARM_ANY(fminl) ; Can't use long double functions from the CRT on x86 +fmod +F_NON_I386(fmodf) +fopen +fopen_s +fputc +fputs +fputwc +fputws +fread +fread_s +free +freopen +freopen_s +frexp +fseek +fsetpos +ftell +fwrite +getc +getchar +getenv +getenv_s +gets +gets_s +getwc +getwchar +hypot +ilogb +ilogbf +F_ARM_ANY(ilogbl) ; Can't use long double functions from the CRT on x86 +imaxabs +imaxdiv +is_wctype +isalnum +isalpha +isblank +iscntrl +isdigit +isgraph +isleadbyte +islower +isprint +ispunct +isspace +isupper +iswalnum +iswalpha +iswascii +iswblank +iswcntrl +iswctype +iswdigit +iswgraph +iswlower +iswprint +iswpunct +iswspace +iswupper +iswxdigit +isxdigit +labs +ldexp +ldiv +; The UCRT lgamma functions don't set/provide the signgam variable like +; the mingw ones do. Therefore prefer the libmingwex version instead. +lgamma DATA +lgammaf DATA +F_ARM_ANY(lgammal DATA) ; Can't use long double functions from the CRT on x86 +llabs +lldiv +llrint +llrintf +F_ARM_ANY(llrintl) ; Can't use long double functions from the CRT on x86 +llround +llroundf +F_ARM_ANY(llroundl) ; Can't use long double functions from the CRT on x86 +localeconv +log +log10 +F_NON_I386(log10f) +log1p +log1pf +F_ARM_ANY(log1pl) ; Can't use long double functions from the CRT on x86 +log2 +log2f +F_ARM_ANY(log2l) ; Can't use long double functions from the CRT on x86 +logb +logbf +F_ARM_ANY(logbl) ; Can't use long double functions from the CRT on x86 +F_NON_I386(logf) +longjmp +lrint +lrintf +F_ARM_ANY(lrintl) ; Can't use long double functions from the CRT on x86 +lround +lroundf +F_ARM_ANY(lroundl) ; Can't use long double functions from the CRT on x86 +malloc +mblen +mbrlen +mbrtoc16 +mbrtoc32 +mbrtowc +mbsrtowcs +mbsrtowcs_s +mbstowcs +mbstowcs_s +mbtowc +memchr +memcmp +memcpy +memcpy_s +memmove +memmove_s +memset +modf +F_NON_I386(modff) +nan +nanf +F_ARM_ANY(nanl) ; Can't use long double functions from the CRT on x86 +nearbyint +nearbyintf +F_ARM_ANY(nearbyintl) ; Can't use long double functions from the CRT on x86 +nextafter +nextafterf +F_ARM_ANY(nextafterl) ; Can't use long double functions from the CRT on x86 +; All of the nexttoward functions take the second parameter as long double, +; making them unusable for x86. +F_ARM_ANY(nexttoward) ; Can't use long double functions from the CRT on x86 +F_ARM_ANY(nexttowardf) ; Can't use long double functions from the CRT on x86 +F_ARM_ANY(nexttowardl) ; Can't use long double functions from the CRT on x86 +norm +normf +norml +perror +pow +F_NON_I386(powf) ; Missing in Wine's ucrtbase.dll for i386 in Wine 9.15 and older +putc +putchar +puts +putwc +putwchar +qsort +qsort_s +quick_exit +raise +rand +rand_s +realloc +remainder +remainderf +F_ARM_ANY(remainderl) ; Can't use long double functions from the CRT on x86 +remove +remquo +remquof +F_ARM_ANY(remquol) ; Can't use long double functions from the CRT on x86 +rename +rewind +rint +rintf +F_ARM_ANY(rintl) ; Can't use long double functions from the CRT on x86 +round +roundf +F_ARM_ANY(roundl) ; Can't use long double functions from the CRT on x86 +scalbln +scalblnf +F_ARM_ANY(scalblnl) ; Can't use long double functions from the CRT on x86 +scalbn +scalbnf +F_ARM_ANY(scalbnl) ; Can't use long double functions from the CRT on x86 +set_terminate +set_unexpected +setbuf +F_X64(setjmp) +setlocale +setvbuf +signal +sin +F_NON_I386(sinf) +; if we implement sinh, we can set it DATA only. +sinh +F_NON_I386(sinhf) +sqrt +F_NON_I386(sqrtf) +srand +strcat +strcat_s +strchr +strcmp +strcoll +strcpy +strcpy_s +strcspn +strerror +strerror_s +strftime +strlen +strncat +strncat_s +strncmp +strncpy +strncpy_s +strnlen +strpbrk +strrchr +strspn +strstr +strtod +strtof +strtoimax +strtok +strtok_s +strtol +F_ARM_ANY(strtold) ; Can't use long double functions from the CRT on x86 +strtoll +strtoul +strtoull +strtoumax +strxfrm +system +tan +F_NON_I386(tanf) +; if we implement tanh, we can set it to DATA only. +tanh +F_NON_I386(tanhf) +terminate +tgamma +tgammaf +F_ARM_ANY(tgammal) ; Can't use long double functions from the CRT on x86 +tmpfile +tmpfile_s +tmpnam +tmpnam_s +tolower +toupper +towctrans +towlower +towupper +trunc +truncf +F_ARM_ANY(truncl) ; Can't use long double functions from the CRT on x86 +unexpected +ungetc +ungetwc +wcrtomb +wcrtomb_s +wcscat +wcscat_s +wcschr +wcscmp +wcscoll +wcscpy +wcscpy_s +wcscspn +wcsftime +wcslen +wcsncat +wcsncat_s +wcsncmp +wcsncpy +wcsncpy_s +wcsnlen +wcspbrk +wcsrchr +wcsrtombs +wcsrtombs_s +wcsspn +wcsstr +wcstod +wcstof +wcstoimax +wcstok +wcstok_s +wcstol +F_ARM_ANY(wcstold) ; Can't use long double functions from the CRT on x86 +wcstoll +wcstombs +wcstombs_s +wcstoul +wcstoull +wcstoumax +wcsxfrm +wctob +wctomb +wctomb_s +wctrans +wctype +wmemcpy_s +wmemmove_s + +; These symbols were added in some later version of ucrtbase.dll and ucrtbased.dll +; They were added into ucrtbase.dll version 10.0.10563.0 which is part of the Microsoft Visual C++ 2015 Redistributable version 14.0.23506.0 +_o____lc_codepage_func +_o____lc_collate_cp_func +_o____lc_locale_name_func +_o____mb_cur_max_func +_o___std_exception_copy +_o___std_exception_destroy +_o___std_type_info_destroy_list +_o___std_type_info_name +_o__cexit +_o__configthreadlocale +_o__configure_narrow_argv +_o__controlfp_s +_o__crt_atexit +_o__exit +_o__get_initial_narrow_environment +_o__get_initial_wide_environment +_o__initialize_narrow_environment +_o__initialize_wide_environment +_o__purecall +_o__seh_filter_dll +_o__seh_filter_exe +_o__set_app_type +_o__set_fmode +_o_exit +_o_memcpy_s +_o_rename +_o_setlocale + +; All symbols below this line are not available in Windows XP version of ucrtbase.dll +; Also those symbols are not available in any version of ucrtbased.dll + +; These symbols were added in ucrtbase.dll version 10.0.14393.0 +; This is part of the Windows 10 Anniversary Update (Redstone 1) +F_NON_DEBUG(__std_terminate) +F_NON_DEBUG(__uncaught_exceptions) + +; These symbols were added in ucrtbase.dll version 10.0.17134.1 +F_NON_DEBUG(F_NON_I386(__C_specific_handler_noexcept)) + +; These symbols were added in ucrtbase.dll version 10.0.19041.1 +F_NON_DEBUG(F_X64(__CxxFrameHandler4)) diff --git a/lib/libc/mingw/lib-common/ucrtbase.def.in b/lib/libc/mingw/lib-common/ucrtbase.def.in @@ -2,2661 +2,11 @@ LIBRARY "ucrtbase.dll" EXPORTS #include "func.def.in" -#define UCRTBASE -#include "msvcrt-common.def.in" -#ifdef DEF_I386 -_CIacos -_CIasin -_CIatan -_CIatan2 -_CIcos -_CIcosh -_CIexp -_CIfmod -_CIlog -_CIlog10 -_CIpow -_CIsin -_CIsinh -_CIsqrt -_CItan -_CItanh -#endif -_Cbuild -_Cmulcc -_Cmulcr -_CreateFrameInfo -F_I386(_CxxThrowException@8) -F_NON_I386(_CxxThrowException) -F_I386(_EH_prolog) -_Exit -_FCbuild -_FCmulcc -_FCmulcr -_FindAndUnlinkFrame -_GetImageBase -_GetThrowImageBase -_Getdays -_Getmonths -_Gettnames -_IsExceptionObjectToBeDestroyed -_LCbuild -_LCmulcc -_LCmulcr -_SetImageBase -_SetThrowImageBase -_NLG_Dispatch2 -_NLG_Return -_NLG_Return2 -_SetWinRTOutOfMemoryExceptionCallback -_Strftime -_W_Getdays -_W_Getmonths -_W_Gettnames -_Wcsftime -__AdjustPointer -__BuildCatchObject -__BuildCatchObjectHelper -F_NON_I386(__C_specific_handler) -__CxxDetectRethrow -__CxxExceptionFilter -__CxxFrameHandler -__CxxFrameHandler2 -__CxxFrameHandler3 -F_I386(__CxxLongjmpUnwind@4) -__CxxQueryExceptionSize -__CxxRegisterExceptionObject -__CxxUnregisterExceptionObject -__DestructExceptionObject -__FrameUnwindFilter -__GetPlatformExceptionInfo -__NLG_Dispatch2 -__NLG_Return2 -__RTCastToVoid -__RTDynamicCast -__RTtypeid -__TypeMatch -___lc_codepage_func -___lc_collate_cp_func -___lc_locale_name_func -___mb_cur_max_func -___mb_cur_max_l_func -__acrt_iob_func -__conio_common_vcprintf -__conio_common_vcprintf_p -__conio_common_vcprintf_s -__conio_common_vcscanf -__conio_common_vcwprintf -__conio_common_vcwprintf_p -__conio_common_vcwprintf_s -__conio_common_vcwscanf -F_I386(__control87_2) -__current_exception -__current_exception_context -__daylight -__dcrt_get_wide_environment_from_os -__dcrt_initial_narrow_environment -__doserrno -__dstbias -__fpe_flt_rounds -__fpecode -__initialize_lconv_for_unsigned_char -__lconv_init == __initialize_lconv_for_unsigned_char -__intrinsic_abnormal_termination -__intrinsic_setjmp -F64(__intrinsic_setjmpex) -__isascii -__iscsym -__iscsymf -__iswcsym -__iswcsymf -#ifdef DEF_I386 -__libm_sse2_acos -__libm_sse2_acosf -__libm_sse2_asin -__libm_sse2_asinf -__libm_sse2_atan -__libm_sse2_atan2 -__libm_sse2_atanf -__libm_sse2_cos -__libm_sse2_cosf -__libm_sse2_exp -__libm_sse2_expf -__libm_sse2_log -__libm_sse2_log10 -__libm_sse2_log10f -__libm_sse2_logf -__libm_sse2_pow -__libm_sse2_powf -__libm_sse2_sin -__libm_sse2_sinf -__libm_sse2_tan -__libm_sse2_tanf -#endif -__p___argc -__p___argv -__p___wargv -__p__acmdln -__p__commode -__p__environ -__p__fmode -__p__mbcasemap -__p__mbctype -__p__pgmptr -__p__wcmdln -__p__wenviron -__p__wpgmptr -__pctype_func -__processing_throw -__pwctype_func -__pxcptinfoptrs -__report_gsfailure -__setusermatherr -__std_exception_copy -__std_exception_destroy -__std_type_info_compare -__std_type_info_destroy_list -__std_type_info_hash -__std_type_info_name -__stdio_common_vfprintf -__stdio_common_vfprintf_p -__stdio_common_vfprintf_s -__stdio_common_vfscanf -__stdio_common_vfwprintf -__stdio_common_vfwprintf_p -__stdio_common_vfwprintf_s -__stdio_common_vfwscanf -__stdio_common_vsnprintf_s -__stdio_common_vsnwprintf_s -__stdio_common_vsprintf -__stdio_common_vsprintf_p -__stdio_common_vsprintf_s -__stdio_common_vsscanf -__stdio_common_vswprintf -__stdio_common_vswprintf_p -__stdio_common_vswprintf_s -__stdio_common_vswscanf -__strncnt -__sys_errlist -__sys_nerr -__threadhandle -__threadid -__timezone -__toascii -__tzname -__unDName -__unDNameEx -__uncaught_exception -__wcserror -__wcserror_s -__wcsncnt -_abs64 -_access -_access_s -_aligned_free -_aligned_malloc -_aligned_msize -_aligned_offset_malloc -_aligned_offset_realloc -_aligned_offset_recalloc -_aligned_realloc -_aligned_recalloc -; DATA set manually -_assert -_atodbl -_atodbl_l -_atof_l -_atoflt -_atoflt_l -_atoi64 -_atoi64_l -_atoi_l -_atol_l -_atoldbl -_atoldbl_l -_atoll_l -_beep -_beginthread -_beginthreadex -_byteswap_uint64 -_byteswap_ulong -_byteswap_ushort -_c_exit -; DATA set manually -_cabs DATA -_callnewh -_calloc_base -_cexit -_cgets -_cgets_s -_cgetws -_cgetws_s -_chdir -_chdrive -_chgsign -_chgsignf -F_I386(_chkesp) -_chmod -_chsize -_chsize_s -_clearfp -_close -_commit -_configthreadlocale -_configure_narrow_argv -_configure_wide_argv -_control87 -_controlfp -_controlfp_s -_copysign -_copysignf -_cputs -_cputws -_creat -_create_locale -_crt_at_quick_exit -_crt_atexit -_crt_debugger_hook -_ctime32 -_ctime32_s -_ctime64 -_ctime64_s -_cwait -_d_int -_dclass -_dexp -_difftime32 -_difftime64 -_dlog -_dnorm -_dpcomp -_dpoly -_dscale -_dsign -_dsin -_dtest -_dunscale -_dup -_dup2 -_dupenv_s -_ecvt -_ecvt_s -_endthread -_endthreadex -_eof -_errno -_except1 -F_I386(_except_handler2) -F_I386(_except_handler3) -F_I386(_except_handler4_common) -_execl -_execle -_execlp -_execlpe -_execute_onexit_table -_execv -_execve -_execvp -_execvpe -_exit -_expand -_fclose_nolock -_fcloseall -_fcvt -_fcvt_s -_fd_int -_fdclass -_fdexp -_fdlog -_fdnorm -_fdopen -_fdpcomp -_fdpoly -_fdscale -_fdsign -_fdsin -_fdtest -_fdunscale -_fflush_nolock -_fgetc_nolock -_fgetchar -_fgetwc_nolock -_fgetwchar -_filelength -_filelengthi64 -_fileno -_findclose -_findfirst == _findfirst64 -_findfirst32 -_findfirst32i64 -_findfirst64 -_findfirst64i32 -_findnext == _findnext64 -_findnext32 -_findnext32i64 -_findnext64 -_findnext64i32 -_finite -F_NON_I386(_finitef) -_flushall -_fpclass -_fpclassf -F_NON_I386(_fpieee_flt) -; DATA added manually -_fpreset DATA -_fputc_nolock -_fputchar -_fputwc_nolock -_fputwchar -_fread_nolock -_fread_nolock_s -_free_base -_free_locale -_fseek_nolock -_fseeki64 -_fseeki64_nolock -_fsopen -_fstat32 -_fstat32i64 -_fstat64 -_fstat64i32 -_ftell_nolock -_ftelli64 -_ftelli64_nolock -_ftime == _ftime64 -_ftime32 -_ftime32_s -_ftime64 -_ftime64_s -F_I386(_ftol) -_fullpath -_futime == _futime64 -_futime32 -_futime64 -_fwrite_nolock -_gcvt -_gcvt_s -_get_FMA3_enable -_get_current_locale -_get_daylight -_get_doserrno -_get_dstbias -_get_errno -_get_fmode -_get_heap_handle -_get_initial_narrow_environment -_get_initial_wide_environment -_get_invalid_parameter_handler -_get_narrow_winmain_command_line -_get_osfhandle -_get_pgmptr -_get_printf_count_output -_get_purecall_handler -_get_stream_buffer_pointers -_get_terminate -_get_thread_local_invalid_parameter_handler -_get_timezone -_get_tzname -_get_unexpected -_get_wide_winmain_command_line -_get_wpgmptr -_getc_nolock -_getch -_getch_nolock -_getche -_getche_nolock -_getcwd -_getdcwd -_getdiskfree -_getdllprocaddr -_getdrive -_getdrives -_getmaxstdio -_getmbcp -_getpid -_getsystime -_getw -_getwc_nolock -_getwch -_getwch_nolock -_getwche -_getwche_nolock -_getws -_getws_s -F_I386(_global_unwind2) -_gmtime32 -_gmtime32_s -_gmtime64 -_gmtime64_s -_heapchk -_heapmin -_heapwalk -_hypot -_hypotf -_i64toa -_i64toa_s -_i64tow -_i64tow_s -_initialize_narrow_environment -_initialize_onexit_table -_initialize_wide_environment -_initterm -_initterm_e -_invalid_parameter_noinfo -_invalid_parameter_noinfo_noreturn -_invoke_watson -_is_exception_typeof -_isalnum_l -_isalpha_l -_isatty -_isblank_l -_iscntrl_l -_isctype -_isctype_l -_isdigit_l -_isgraph_l -_isleadbyte_l -_islower_l -_ismbbalnum -_ismbbalnum_l -_ismbbalpha -_ismbbalpha_l -_ismbbblank -_ismbbblank_l -_ismbbgraph -_ismbbgraph_l -_ismbbkalnum -_ismbbkalnum_l -_ismbbkana -_ismbbkana_l -_ismbbkprint -_ismbbkprint_l -_ismbbkpunct -_ismbbkpunct_l -_ismbblead -_ismbblead_l -_ismbbprint -_ismbbprint_l -_ismbbpunct -_ismbbpunct_l -_ismbbtrail -_ismbbtrail_l -_ismbcalnum -_ismbcalnum_l -_ismbcalpha -_ismbcalpha_l -_ismbcblank -_ismbcblank_l -_ismbcdigit -_ismbcdigit_l -_ismbcgraph -_ismbcgraph_l -_ismbchira -_ismbchira_l -_ismbckata -_ismbckata_l -_ismbcl0 -_ismbcl0_l -_ismbcl1 -_ismbcl1_l -_ismbcl2 -_ismbcl2_l -_ismbclegal -_ismbclegal_l -_ismbclower -_ismbclower_l -_ismbcprint -_ismbcprint_l -_ismbcpunct -_ismbcpunct_l -_ismbcspace -_ismbcspace_l -_ismbcsymbol -_ismbcsymbol_l -_ismbcupper -_ismbcupper_l -_ismbslead -_ismbslead_l -_ismbstrail -_ismbstrail_l -_isnan -F_X64(_isnanf) -_isprint_l -_ispunct_l -_isspace_l -_isupper_l -_iswalnum_l -_iswalpha_l -_iswblank_l -_iswcntrl_l -_iswcsym_l -_iswcsymf_l -_iswctype_l -_iswdigit_l -_iswgraph_l -_iswlower_l -_iswprint_l -_iswpunct_l -_iswspace_l -_iswupper_l -_iswxdigit_l -_isxdigit_l -_itoa -_itoa_s -_itow -_itow_s -_j0 -_j1 -_jn -_kbhit -_ld_int -_ldclass -_ldexp -_ldlog -_ldpcomp -_ldpoly -_ldscale -_ldsign -_ldsin -_ldtest -_ldunscale -_lfind -_lfind_s -#ifdef DEF_I386 -_libm_sse2_acos_precise -_libm_sse2_asin_precise -_libm_sse2_atan_precise -_libm_sse2_cos_precise -_libm_sse2_exp_precise -_libm_sse2_log10_precise -_libm_sse2_log_precise -_libm_sse2_pow_precise -_libm_sse2_sin_precise -_libm_sse2_sqrt_precise -_libm_sse2_tan_precise -#endif -_loaddll -F_X64(_local_unwind) -F_I386(_local_unwind2) -F_I386(_local_unwind4) -_localtime32 -_localtime32_s -_localtime64 -_localtime64_s -_lock_file -_lock_locales -_locking -_logb -F_NON_I386(_logbf) -F_I386(_longjmpex) -_lrotl -_lrotr -_lsearch -_lsearch_s -_lseek -_lseeki64 -_ltoa -_ltoa_s -_ltow -_ltow_s -_makepath -_makepath_s -_malloc_base -_mbbtombc -_mbbtombc_l -_mbbtype -_mbbtype_l -; DATA added manually -_mbcasemap DATA -_mbccpy -_mbccpy_l -_mbccpy_s -_mbccpy_s_l -_mbcjistojms -_mbcjistojms_l -_mbcjmstojis -_mbcjmstojis_l -_mbclen -_mbclen_l -_mbctohira -_mbctohira_l -_mbctokata -_mbctokata_l -_mbctolower -_mbctolower_l -_mbctombb -_mbctombb_l -_mbctoupper -_mbctoupper_l -_mblen_l -_mbsbtype -_mbsbtype_l -_mbscat_s -_mbscat_s_l -_mbschr -_mbschr_l -_mbscmp -_mbscmp_l -_mbscoll -_mbscoll_l -_mbscpy_s -_mbscpy_s_l -_mbscspn -_mbscspn_l -_mbsdec -_mbsdec_l -_mbsdup -_mbsicmp -_mbsicmp_l -_mbsicoll -_mbsicoll_l -_mbsinc -_mbsinc_l -_mbslen -_mbslen_l -_mbslwr -_mbslwr_l -_mbslwr_s -_mbslwr_s_l -_mbsnbcat -_mbsnbcat_l -_mbsnbcat_s -_mbsnbcat_s_l -_mbsnbcmp -_mbsnbcmp_l -_mbsnbcnt -_mbsnbcnt_l -_mbsnbcoll -_mbsnbcoll_l -_mbsnbcpy -_mbsnbcpy_l -_mbsnbcpy_s -_mbsnbcpy_s_l -_mbsnbicmp -_mbsnbicmp_l -_mbsnbicoll -_mbsnbicoll_l -_mbsnbset -_mbsnbset_l -_mbsnbset_s -_mbsnbset_s_l -_mbsncat -_mbsncat_l -_mbsncat_s -_mbsncat_s_l -_mbsnccnt -_mbsnccnt_l -_mbsncmp -_mbsncmp_l -_mbsncoll -_mbsncoll_l -_mbsncpy -_mbsncpy_l -_mbsncpy_s -_mbsncpy_s_l -_mbsnextc -_mbsnextc_l -_mbsnicmp -_mbsnicmp_l -_mbsnicoll -_mbsnicoll_l -_mbsninc -_mbsninc_l -_mbsnlen -_mbsnlen_l -_mbsnset -_mbsnset_l -_mbsnset_s -_mbsnset_s_l -_mbspbrk -_mbspbrk_l -_mbsrchr -_mbsrchr_l -_mbsrev -_mbsrev_l -_mbsset -_mbsset_l -_mbsset_s -_mbsset_s_l -_mbsspn -_mbsspn_l -_mbsspnp -_mbsspnp_l -_mbsstr -_mbsstr_l -_mbstok -_mbstok_l -_mbstok_s -_mbstok_s_l -_mbstowcs_l -_mbstowcs_s_l -_mbstrlen -_mbstrlen_l -_mbstrnlen -_mbstrnlen_l -_mbsupr -_mbsupr_l -_mbsupr_s -_mbsupr_s_l -_mbtowc_l -_memccpy -_memicmp -_memicmp_l -_mkdir -_mkgmtime32 -_mkgmtime64 -_mktemp -_mktemp_s -_mktime32 -_mktime64 -_msize -_nextafter -F_X64(_nextafterf) -_o__CIacos -_o__CIasin -_o__CIatan -_o__CIatan2 -_o__CIcos -_o__CIcosh -_o__CIexp -_o__CIfmod -_o__CIlog -_o__CIlog10 -_o__CIpow -_o__CIsin -_o__CIsinh -_o__CIsqrt -_o__CItan -_o__CItanh -_o__Getdays -_o__Getmonths -_o__Gettnames -_o__Strftime -_o__W_Getdays -_o__W_Getmonths -_o__W_Gettnames -_o__Wcsftime -_o____lc_codepage_func -_o____lc_collate_cp_func -_o____lc_locale_name_func -_o____mb_cur_max_func -_o___acrt_iob_func -_o___conio_common_vcprintf -_o___conio_common_vcprintf_p -_o___conio_common_vcprintf_s -_o___conio_common_vcscanf -_o___conio_common_vcwprintf -_o___conio_common_vcwprintf_p -_o___conio_common_vcwprintf_s -_o___conio_common_vcwscanf -_o___daylight -_o___dstbias -_o___fpe_flt_rounds -_o___libm_sse2_acos -_o___libm_sse2_acosf -_o___libm_sse2_asin -_o___libm_sse2_asinf -_o___libm_sse2_atan -_o___libm_sse2_atan2 -_o___libm_sse2_atanf -_o___libm_sse2_cos -_o___libm_sse2_cosf -_o___libm_sse2_exp -_o___libm_sse2_expf -_o___libm_sse2_log -_o___libm_sse2_log10 -_o___libm_sse2_log10f -_o___libm_sse2_logf -_o___libm_sse2_pow -_o___libm_sse2_powf -_o___libm_sse2_sin -_o___libm_sse2_sinf -_o___libm_sse2_tan -_o___libm_sse2_tanf -_o___p___argc -_o___p___argv -_o___p___wargv -_o___p__acmdln -_o___p__commode -_o___p__environ -_o___p__fmode -_o___p__mbcasemap -_o___p__mbctype -_o___p__pgmptr -_o___p__wcmdln -_o___p__wenviron -_o___p__wpgmptr -_o___pctype_func -_o___pwctype_func -_o___std_exception_copy -_o___std_exception_destroy -_o___std_type_info_destroy_list -_o___std_type_info_name -_o___stdio_common_vfprintf -_o___stdio_common_vfprintf_p -_o___stdio_common_vfprintf_s -_o___stdio_common_vfscanf -_o___stdio_common_vfwprintf -_o___stdio_common_vfwprintf_p -_o___stdio_common_vfwprintf_s -_o___stdio_common_vfwscanf -_o___stdio_common_vsnprintf_s -_o___stdio_common_vsnwprintf_s -_o___stdio_common_vsprintf -_o___stdio_common_vsprintf_p -_o___stdio_common_vsprintf_s -_o___stdio_common_vsscanf -_o___stdio_common_vswprintf -_o___stdio_common_vswprintf_p -_o___stdio_common_vswprintf_s -_o___stdio_common_vswscanf -_o___timezone -_o___tzname -_o___wcserror -_o__access -_o__access_s -_o__aligned_free -_o__aligned_malloc -_o__aligned_msize -_o__aligned_offset_malloc -_o__aligned_offset_realloc -_o__aligned_offset_recalloc -_o__aligned_realloc -_o__aligned_recalloc -_o__atodbl -_o__atodbl_l -_o__atof_l -_o__atoflt -_o__atoflt_l -_o__atoi64 -_o__atoi64_l -_o__atoi_l -_o__atol_l -_o__atoldbl -_o__atoldbl_l -_o__atoll_l -_o__beep -_o__beginthread -_o__beginthreadex -_o__cabs -_o__callnewh -_o__calloc_base -_o__cexit -_o__cgets -_o__cgets_s -_o__cgetws -_o__cgetws_s -_o__chdir -_o__chdrive -_o__chmod -_o__chsize -_o__chsize_s -_o__close -_o__commit -_o__configthreadlocale -_o__configure_narrow_argv -_o__configure_wide_argv -_o__controlfp_s -_o__cputs -_o__cputws -_o__creat -_o__create_locale -_o__crt_atexit -_o__ctime32_s -_o__ctime64_s -_o__cwait -_o__d_int -_o__dclass -_o__difftime32 -_o__difftime64 -_o__dlog -_o__dnorm -_o__dpcomp -_o__dpoly -_o__dscale -_o__dsign -_o__dsin -_o__dtest -_o__dunscale -_o__dup -_o__dup2 -_o__dupenv_s -_o__ecvt -_o__ecvt_s -_o__endthread -_o__endthreadex -_o__eof -_o__errno -_o__except1 -_o__execute_onexit_table -_o__execv -_o__execve -_o__execvp -_o__execvpe -_o__exit -_o__expand -_o__fclose_nolock -_o__fcloseall -_o__fcvt -_o__fcvt_s -_o__fd_int -_o__fdclass -_o__fdexp -_o__fdlog -_o__fdopen -_o__fdpcomp -_o__fdpoly -_o__fdscale -_o__fdsign -_o__fdsin -_o__fflush_nolock -_o__fgetc_nolock -_o__fgetchar -_o__fgetwc_nolock -_o__fgetwchar -_o__filelength -_o__filelengthi64 -_o__fileno -_o__findclose -_o__findfirst32 -_o__findfirst32i64 -_o__findfirst64 -_o__findfirst64i32 -_o__findnext32 -_o__findnext32i64 -_o__findnext64 -_o__findnext64i32 -_o__flushall -_o__fpclass -_o__fpclassf -_o__fputc_nolock -_o__fputchar -_o__fputwc_nolock -_o__fputwchar -_o__fread_nolock -_o__fread_nolock_s -_o__free_base -_o__free_locale -_o__fseek_nolock -_o__fseeki64 -_o__fseeki64_nolock -_o__fsopen -_o__fstat32 -_o__fstat32i64 -_o__fstat64 -_o__fstat64i32 -_o__ftell_nolock -_o__ftelli64 -_o__ftelli64_nolock -_o__ftime32 -_o__ftime32_s -_o__ftime64 -_o__ftime64_s -_o__fullpath -_o__futime32 -_o__futime64 -_o__fwrite_nolock -_o__gcvt -_o__gcvt_s -_o__get_daylight -_o__get_doserrno -_o__get_dstbias -_o__get_errno -_o__get_fmode -_o__get_heap_handle -_o__get_initial_narrow_environment -_o__get_initial_wide_environment -_o__get_invalid_parameter_handler -_o__get_narrow_winmain_command_line -_o__get_osfhandle -_o__get_pgmptr -_o__get_stream_buffer_pointers -_o__get_terminate -_o__get_thread_local_invalid_parameter_handler -_o__get_timezone -_o__get_tzname -_o__get_wide_winmain_command_line -_o__get_wpgmptr -_o__getc_nolock -_o__getch -_o__getch_nolock -_o__getche -_o__getche_nolock -_o__getcwd -_o__getdcwd -_o__getdiskfree -_o__getdllprocaddr -_o__getdrive -_o__getdrives -_o__getmbcp -_o__getsystime -_o__getw -_o__getwc_nolock -_o__getwch -_o__getwch_nolock -_o__getwche -_o__getwche_nolock -_o__getws -_o__getws_s -_o__gmtime32 -_o__gmtime32_s -_o__gmtime64 -_o__gmtime64_s -_o__heapchk -_o__heapmin -_o__hypot -_o__hypotf -_o__i64toa -_o__i64toa_s -_o__i64tow -_o__i64tow_s -_o__initialize_narrow_environment -_o__initialize_onexit_table -_o__initialize_wide_environment -_o__invalid_parameter_noinfo -_o__invalid_parameter_noinfo_noreturn -_o__isatty -_o__isctype -_o__isctype_l -_o__isleadbyte_l -_o__ismbbalnum -_o__ismbbalnum_l -_o__ismbbalpha -_o__ismbbalpha_l -_o__ismbbblank -_o__ismbbblank_l -_o__ismbbgraph -_o__ismbbgraph_l -_o__ismbbkalnum -_o__ismbbkalnum_l -_o__ismbbkana -_o__ismbbkana_l -_o__ismbbkprint -_o__ismbbkprint_l -_o__ismbbkpunct -_o__ismbbkpunct_l -_o__ismbblead -_o__ismbblead_l -_o__ismbbprint -_o__ismbbprint_l -_o__ismbbpunct -_o__ismbbpunct_l -_o__ismbbtrail -_o__ismbbtrail_l -_o__ismbcalnum -_o__ismbcalnum_l -_o__ismbcalpha -_o__ismbcalpha_l -_o__ismbcblank -_o__ismbcblank_l -_o__ismbcdigit -_o__ismbcdigit_l -_o__ismbcgraph -_o__ismbcgraph_l -_o__ismbchira -_o__ismbchira_l -_o__ismbckata -_o__ismbckata_l -_o__ismbcl0 -_o__ismbcl0_l -_o__ismbcl1 -_o__ismbcl1_l -_o__ismbcl2 -_o__ismbcl2_l -_o__ismbclegal -_o__ismbclegal_l -_o__ismbclower -_o__ismbclower_l -_o__ismbcprint -_o__ismbcprint_l -_o__ismbcpunct -_o__ismbcpunct_l -_o__ismbcspace -_o__ismbcspace_l -_o__ismbcsymbol -_o__ismbcsymbol_l -_o__ismbcupper -_o__ismbcupper_l -_o__ismbslead -_o__ismbslead_l -_o__ismbstrail -_o__ismbstrail_l -_o__iswctype_l -_o__itoa -_o__itoa_s -_o__itow -_o__itow_s -_o__j0 -_o__j1 -_o__jn -_o__kbhit -_o__ld_int -_o__ldclass -_o__ldexp -_o__ldlog -_o__ldpcomp -_o__ldpoly -_o__ldscale -_o__ldsign -_o__ldsin -_o__ldtest -_o__ldunscale -_o__lfind -_o__lfind_s -_o__libm_sse2_acos_precise -_o__libm_sse2_asin_precise -_o__libm_sse2_atan_precise -_o__libm_sse2_cos_precise -_o__libm_sse2_exp_precise -_o__libm_sse2_log10_precise -_o__libm_sse2_log_precise -_o__libm_sse2_pow_precise -_o__libm_sse2_sin_precise -_o__libm_sse2_sqrt_precise -_o__libm_sse2_tan_precise -_o__loaddll -_o__localtime32 -_o__localtime32_s -_o__localtime64 -_o__localtime64_s -_o__lock_file -_o__locking -_o__logb -_o__logbf -_o__lsearch -_o__lsearch_s -_o__lseek -_o__lseeki64 -_o__ltoa -_o__ltoa_s -_o__ltow -_o__ltow_s -_o__makepath -_o__makepath_s -_o__malloc_base -_o__mbbtombc -_o__mbbtombc_l -_o__mbbtype -_o__mbbtype_l -_o__mbccpy -_o__mbccpy_l -_o__mbccpy_s -_o__mbccpy_s_l -_o__mbcjistojms -_o__mbcjistojms_l -_o__mbcjmstojis -_o__mbcjmstojis_l -_o__mbclen -_o__mbclen_l -_o__mbctohira -_o__mbctohira_l -_o__mbctokata -_o__mbctokata_l -_o__mbctolower -_o__mbctolower_l -_o__mbctombb -_o__mbctombb_l -_o__mbctoupper -_o__mbctoupper_l -_o__mblen_l -_o__mbsbtype -_o__mbsbtype_l -_o__mbscat_s -_o__mbscat_s_l -_o__mbschr -_o__mbschr_l -_o__mbscmp -_o__mbscmp_l -_o__mbscoll -_o__mbscoll_l -_o__mbscpy_s -_o__mbscpy_s_l -_o__mbscspn -_o__mbscspn_l -_o__mbsdec -_o__mbsdec_l -_o__mbsicmp -_o__mbsicmp_l -_o__mbsicoll -_o__mbsicoll_l -_o__mbsinc -_o__mbsinc_l -_o__mbslen -_o__mbslen_l -_o__mbslwr -_o__mbslwr_l -_o__mbslwr_s -_o__mbslwr_s_l -_o__mbsnbcat -_o__mbsnbcat_l -_o__mbsnbcat_s -_o__mbsnbcat_s_l -_o__mbsnbcmp -_o__mbsnbcmp_l -_o__mbsnbcnt -_o__mbsnbcnt_l -_o__mbsnbcoll -_o__mbsnbcoll_l -_o__mbsnbcpy -_o__mbsnbcpy_l -_o__mbsnbcpy_s -_o__mbsnbcpy_s_l -_o__mbsnbicmp -_o__mbsnbicmp_l -_o__mbsnbicoll -_o__mbsnbicoll_l -_o__mbsnbset -_o__mbsnbset_l -_o__mbsnbset_s -_o__mbsnbset_s_l -_o__mbsncat -_o__mbsncat_l -_o__mbsncat_s -_o__mbsncat_s_l -_o__mbsnccnt -_o__mbsnccnt_l -_o__mbsncmp -_o__mbsncmp_l -_o__mbsncoll -_o__mbsncoll_l -_o__mbsncpy -_o__mbsncpy_l -_o__mbsncpy_s -_o__mbsncpy_s_l -_o__mbsnextc -_o__mbsnextc_l -_o__mbsnicmp -_o__mbsnicmp_l -_o__mbsnicoll -_o__mbsnicoll_l -_o__mbsninc -_o__mbsninc_l -_o__mbsnlen -_o__mbsnlen_l -_o__mbsnset -_o__mbsnset_l -_o__mbsnset_s -_o__mbsnset_s_l -_o__mbspbrk -_o__mbspbrk_l -_o__mbsrchr -_o__mbsrchr_l -_o__mbsrev -_o__mbsrev_l -_o__mbsset -_o__mbsset_l -_o__mbsset_s -_o__mbsset_s_l -_o__mbsspn -_o__mbsspn_l -_o__mbsspnp -_o__mbsspnp_l -_o__mbsstr -_o__mbsstr_l -_o__mbstok -_o__mbstok_l -_o__mbstok_s -_o__mbstok_s_l -_o__mbstowcs_l -_o__mbstowcs_s_l -_o__mbstrlen -_o__mbstrlen_l -_o__mbstrnlen -_o__mbstrnlen_l -_o__mbsupr -_o__mbsupr_l -_o__mbsupr_s -_o__mbsupr_s_l -_o__mbtowc_l -_o__memicmp -_o__memicmp_l -_o__mkdir -_o__mkgmtime32 -_o__mkgmtime64 -_o__mktemp -_o__mktemp_s -_o__mktime32 -_o__mktime64 -_o__msize -_o__nextafter -_o__nextafterf -_o__open_osfhandle -_o__pclose -_o__pipe -_o__popen -_o__purecall -_o__putc_nolock -_o__putch -_o__putch_nolock -_o__putenv -_o__putenv_s -_o__putw -_o__putwc_nolock -_o__putwch -_o__putwch_nolock -_o__putws -_o__read -_o__realloc_base -_o__recalloc -_o__register_onexit_function -_o__resetstkoflw -_o__rmdir -_o__rmtmp -_o__scalb -_o__scalbf -_o__searchenv -_o__searchenv_s -_o__seh_filter_dll -_o__seh_filter_exe -_o__set_abort_behavior -_o__set_app_type -_o__set_doserrno -_o__set_errno -_o__set_fmode -_o__set_invalid_parameter_handler -_o__set_new_handler -_o__set_new_mode -_o__set_thread_local_invalid_parameter_handler -_o__seterrormode -_o__setmbcp -_o__setmode -_o__setsystime -_o__sleep -_o__sopen -_o__sopen_dispatch -_o__sopen_s -_o__spawnv -_o__spawnve -_o__spawnvp -_o__spawnvpe -_o__splitpath -_o__splitpath_s -_o__stat32 -_o__stat32i64 -_o__stat64 -_o__stat64i32 -_o__strcoll_l -_o__strdate -_o__strdate_s -_o__strdup -_o__strerror -_o__strerror_s -_o__strftime_l -_o__stricmp -_o__stricmp_l -_o__stricoll -_o__stricoll_l -_o__strlwr -_o__strlwr_l -_o__strlwr_s -_o__strlwr_s_l -_o__strncoll -_o__strncoll_l -_o__strnicmp -_o__strnicmp_l -_o__strnicoll -_o__strnicoll_l -_o__strnset_s -_o__strset_s -_o__strtime -_o__strtime_s -_o__strtod_l -_o__strtof_l -_o__strtoi64 -_o__strtoi64_l -_o__strtol_l -_o__strtold_l -_o__strtoll_l -_o__strtoui64 -_o__strtoui64_l -_o__strtoul_l -_o__strtoull_l -_o__strupr -_o__strupr_l -_o__strupr_s -_o__strupr_s_l -_o__strxfrm_l -_o__swab -_o__tell -_o__telli64 -_o__timespec32_get -_o__timespec64_get -_o__tolower -_o__tolower_l -_o__toupper -_o__toupper_l -_o__towlower_l -_o__towupper_l -_o__tzset -_o__ui64toa -_o__ui64toa_s -_o__ui64tow -_o__ui64tow_s -_o__ultoa -_o__ultoa_s -_o__ultow -_o__ultow_s -_o__umask -_o__umask_s -_o__ungetc_nolock -_o__ungetch -_o__ungetch_nolock -_o__ungetwc_nolock -_o__ungetwch -_o__ungetwch_nolock -_o__unlink -_o__unloaddll -_o__unlock_file -_o__utime32 -_o__utime64 -_o__waccess -_o__waccess_s -_o__wasctime -_o__wasctime_s -_o__wchdir -_o__wchmod -_o__wcreat -_o__wcreate_locale -_o__wcscoll_l -_o__wcsdup -_o__wcserror -_o__wcserror_s -_o__wcsftime_l -_o__wcsicmp -_o__wcsicmp_l -_o__wcsicoll -_o__wcsicoll_l -_o__wcslwr -_o__wcslwr_l -_o__wcslwr_s -_o__wcslwr_s_l -_o__wcsncoll -_o__wcsncoll_l -_o__wcsnicmp -_o__wcsnicmp_l -_o__wcsnicoll -_o__wcsnicoll_l -_o__wcsnset -_o__wcsnset_s -_o__wcsset -_o__wcsset_s -_o__wcstod_l -_o__wcstof_l -_o__wcstoi64 -_o__wcstoi64_l -_o__wcstol_l -_o__wcstold_l -_o__wcstoll_l -_o__wcstombs_l -_o__wcstombs_s_l -_o__wcstoui64 -_o__wcstoui64_l -_o__wcstoul_l -_o__wcstoull_l -_o__wcsupr -_o__wcsupr_l -_o__wcsupr_s -_o__wcsupr_s_l -_o__wcsxfrm_l -_o__wctime32 -_o__wctime32_s -_o__wctime64 -_o__wctime64_s -_o__wctomb_l -_o__wctomb_s_l -_o__wdupenv_s -_o__wexecv -_o__wexecve -_o__wexecvp -_o__wexecvpe -_o__wfdopen -_o__wfindfirst32 -_o__wfindfirst32i64 -_o__wfindfirst64 -_o__wfindfirst64i32 -_o__wfindnext32 -_o__wfindnext32i64 -_o__wfindnext64 -_o__wfindnext64i32 -_o__wfopen -_o__wfopen_s -_o__wfreopen -_o__wfreopen_s -_o__wfsopen -_o__wfullpath -_o__wgetcwd -_o__wgetdcwd -_o__wgetenv -_o__wgetenv_s -_o__wmakepath -_o__wmakepath_s -_o__wmkdir -_o__wmktemp -_o__wmktemp_s -_o__wperror -_o__wpopen -_o__wputenv -_o__wputenv_s -_o__wremove -_o__wrename -_o__write -_o__wrmdir -_o__wsearchenv -_o__wsearchenv_s -_o__wsetlocale -_o__wsopen_dispatch -_o__wsopen_s -_o__wspawnv -_o__wspawnve -_o__wspawnvp -_o__wspawnvpe -_o__wsplitpath -_o__wsplitpath_s -_o__wstat32 -_o__wstat32i64 -_o__wstat64 -_o__wstat64i32 -_o__wstrdate -_o__wstrdate_s -_o__wstrtime -_o__wstrtime_s -_o__wsystem -_o__wtmpnam_s -_o__wtof -_o__wtof_l -_o__wtoi -_o__wtoi64 -_o__wtoi64_l -_o__wtoi_l -_o__wtol -_o__wtol_l -_o__wtoll -_o__wtoll_l -_o__wunlink -_o__wutime32 -_o__wutime64 -_o__y0 -_o__y1 -_o__yn -_o_abort -_o_acos -_o_acosf -_o_acosh -_o_acoshf -_o_acoshl -_o_asctime -_o_asctime_s -_o_asin -_o_asinf -_o_asinh -_o_asinhf -_o_asinhl -_o_atan -_o_atan2 -_o_atan2f -_o_atanf -_o_atanh -_o_atanhf -_o_atanhl -_o_atof -_o_atoi -_o_atol -_o_atoll -_o_bsearch -_o_bsearch_s -_o_btowc -_o_calloc -_o_cbrt -_o_cbrtf -_o_ceil -_o_ceilf -_o_clearerr -_o_clearerr_s -_o_cos -_o_cosf -_o_cosh -_o_coshf -_o_erf -_o_erfc -_o_erfcf -_o_erfcl -_o_erff -_o_erfl -_o_exit -_o_exp -_o_exp2 -_o_exp2f -_o_exp2l -_o_expf -_o_fabs -_o_fclose -_o_feof -_o_ferror -_o_fflush -_o_fgetc -_o_fgetpos -_o_fgets -_o_fgetwc -_o_fgetws -_o_floor -_o_floorf -_o_fma -_o_fmaf -_o_fmal -_o_fmod -_o_fmodf -_o_fopen -_o_fopen_s -_o_fputc -_o_fputs -_o_fputwc -_o_fputws -_o_fread -_o_fread_s -_o_free -_o_freopen -_o_freopen_s -_o_frexp -_o_fseek -_o_fsetpos -_o_ftell -_o_fwrite -_o_getc -_o_getchar -_o_getenv -_o_getenv_s -_o_gets -_o_gets_s -_o_getwc -_o_getwchar -_o_hypot -_o_is_wctype -_o_isalnum -_o_isalpha -_o_isblank -_o_iscntrl -_o_isdigit -_o_isgraph -_o_isleadbyte -_o_islower -_o_isprint -_o_ispunct -_o_isspace -_o_isupper -_o_iswalnum -_o_iswalpha -_o_iswascii -_o_iswblank -_o_iswcntrl -_o_iswctype -_o_iswdigit -_o_iswgraph -_o_iswlower -_o_iswprint -_o_iswpunct -_o_iswspace -_o_iswupper -_o_iswxdigit -_o_isxdigit -_o_ldexp -_o_lgamma -_o_lgammaf -_o_lgammal -_o_llrint -_o_llrintf -_o_llrintl -_o_llround -_o_llroundf -_o_llroundl -_o_localeconv -_o_log -_o_log10 -_o_log10f -_o_log1p -_o_log1pf -_o_log1pl -_o_log2 -_o_log2f -_o_log2l -_o_logb -_o_logbf -_o_logbl -_o_logf -_o_lrint -_o_lrintf -_o_lrintl -_o_lround -_o_lroundf -_o_lroundl -_o_malloc -_o_mblen -_o_mbrlen -_o_mbrtoc16 -_o_mbrtoc32 -_o_mbrtowc -_o_mbsrtowcs -_o_mbsrtowcs_s -_o_mbstowcs -_o_mbstowcs_s -_o_mbtowc -_o_memcpy_s -_o_memset -_o_modf -_o_modff -_o_nan -_o_nanf -_o_nanl -_o_nearbyint -_o_nearbyintf -_o_nearbyintl -_o_nextafter -_o_nextafterf -_o_nextafterl -_o_nexttoward -_o_nexttowardf -_o_nexttowardl -_o_pow -_o_powf -_o_putc -_o_putchar -_o_puts -_o_putwc -_o_putwchar -_o_qsort -_o_qsort_s -_o_raise -_o_rand -_o_rand_s -_o_realloc -_o_remainder -_o_remainderf -_o_remainderl -_o_remove -_o_remquo -_o_remquof -_o_remquol -_o_rename -_o_rewind -_o_rint -_o_rintf -_o_rintl -_o_round -_o_roundf -_o_roundl -_o_scalbln -_o_scalblnf -_o_scalblnl -_o_scalbn -_o_scalbnf -_o_scalbnl -_o_set_terminate -_o_setbuf -_o_setlocale -_o_setvbuf -_o_sin -_o_sinf -_o_sinh -_o_sinhf -_o_sqrt -_o_sqrtf -_o_srand -_o_strcat_s -_o_strcoll -_o_strcpy_s -_o_strerror -_o_strerror_s -_o_strftime -_o_strncat_s -_o_strncpy_s -_o_strtod -_o_strtof -_o_strtok -_o_strtok_s -_o_strtol -_o_strtold -_o_strtoll -_o_strtoul -_o_strtoull -_o_system -_o_tan -_o_tanf -_o_tanh -_o_tanhf -_o_terminate -_o_tgamma -_o_tgammaf -_o_tgammal -_o_tmpfile_s -_o_tmpnam_s -_o_tolower -_o_toupper -_o_towlower -_o_towupper -_o_ungetc -_o_ungetwc -_o_wcrtomb -_o_wcrtomb_s -_o_wcscat_s -_o_wcscoll -_o_wcscpy -_o_wcscpy_s -_o_wcsftime -_o_wcsncat_s -_o_wcsncpy_s -_o_wcsrtombs -_o_wcsrtombs_s -_o_wcstod -_o_wcstof -_o_wcstok -_o_wcstok_s -_o_wcstol -_o_wcstold -_o_wcstoll -_o_wcstombs -_o_wcstombs_s -_o_wcstoul -_o_wcstoull -_o_wctob -_o_wctomb -_o_wctomb_s -_o_wmemcpy_s -_o_wmemmove_s -_open -_open_osfhandle -_pclose -_pipe -_popen -_purecall -_putc_nolock -_putch -_putch_nolock -_putenv -_putenv_s -_putw -_putwc_nolock -_putwch -_putwch_nolock -_putws -_query_app_type -_query_new_handler -_query_new_mode -_read -_realloc_base -_recalloc -_register_onexit_function -_register_thread_local_exe_atexit_callback -_resetstkoflw -_rmdir -_rmtmp -_rotl -_rotl64 -_rotr -_rotr64 -_scalb -F_X64(_scalbf) -_searchenv -_searchenv_s -_seh_filter_dll -_seh_filter_exe -F64(_set_FMA3_enable) -F_I386(_seh_longjmp_unwind4@4) -F_I386(_seh_longjmp_unwind@4) -F_I386(_set_SSE2_enable) -_set_abort_behavior -_set_app_type -__set_app_type == _set_app_type -_set_controlfp -_set_doserrno -_set_errno -_set_error_mode -_set_fmode -_set_invalid_parameter_handler -_set_new_handler -_set_new_mode -_set_printf_count_output -_set_purecall_handler -_set_se_translator -_set_thread_local_invalid_parameter_handler -_seterrormode -F_I386(_setjmp3) -_setmaxstdio -_setmbcp -_setmode -_setsystime -_sleep -_sopen -_sopen_dispatch -_sopen_s -_spawnl -_spawnle -_spawnlp -_spawnlpe -_spawnv -_spawnve -_spawnvp -_spawnvpe -_splitpath -_splitpath_s -_stat32 -_stat32i64 -_stat64 -_stat64i32 -_statusfp -F_I386(_statusfp2) -_strcmpi == _stricmp -_strcoll_l -_strdate -_strdate_s -_strdup -_strerror -_strerror_s -_strftime_l -_stricmp -_stricmp_l -_stricoll -_stricoll_l -_strlwr -_strlwr_l -_strlwr_s -_strlwr_s_l -_strncoll -_strncoll_l -_strnicmp -_strnicmp_l -_strnicoll -_strnicoll_l -_strnset -_strnset_s -_strrev -_strset -_strset_s -_strtime -_strtime_s -_strtod_l -_strtof_l -_strtoi64 -_strtoi64_l -_strtoimax_l -_strtol_l -_strtold_l -_strtoll_l -_strtoui64 -_strtoui64_l -_strtoul_l -_strtoull_l -_strtoumax_l -_strupr -_strupr_l -_strupr_s -_strupr_s_l -_strxfrm_l -_swab -_tell -_telli64 -_tempnam -_time32 -_time64 -_timespec32_get -_timespec64_get -_tolower -_tolower_l -_toupper -_toupper_l -_towlower_l -_towupper_l -; This is wrapped in the compat code. -_tzset DATA -_ui64toa -_ui64toa_s -_ui64tow -_ui64tow_s -_ultoa -_ultoa_s -_ultow -_ultow_s -_umask -_umask_s -_ungetc_nolock -_ungetch -_ungetch_nolock -_ungetwc_nolock -_ungetwch -_ungetwch_nolock -_unlink -_unloaddll -_unlock_file -_unlock_locales -_utime == _utime64 -_utime32 -_utime64 -_waccess -_waccess_s -_wasctime -_wasctime_s -_wassert -_wchdir -_wchmod -_wcreat -_wcreate_locale -_wcscoll_l -_wcsdup -_wcserror -_wcserror_s -_wcsftime_l -_wcsicmp -_wcsicmp_l -_wcsicoll -_wcsicoll_l -_wcslwr -_wcslwr_l -_wcslwr_s -_wcslwr_s_l -_wcsncoll -_wcsncoll_l -_wcsnicmp -_wcsnicmp_l -_wcsnicoll -_wcsnicoll_l -_wcsnset -_wcsnset_s -_wcsrev -_wcsset -_wcsset_s -_wcstod_l -_wcstof_l -_wcstoi64 -_wcstoi64_l -_wcstoimax_l -_wcstol_l -_wcstold_l -_wcstoll_l -_wcstombs_l -_wcstombs_s_l -_wcstoui64 -_wcstoui64_l -_wcstoul_l -_wcstoull_l -_wcstoumax_l -_wcsupr -_wcsupr_l -_wcsupr_s -_wcsupr_s_l -_wcsxfrm_l -_wctime32 -_wctime32_s -_wctime64 -_wctime64_s -_wctomb_l -_wctomb_s_l -_wctype -_wdupenv_s -_wexecl -_wexecle -_wexeclp -_wexeclpe -_wexecv -_wexecve -_wexecvp -_wexecvpe -_wfdopen -_wfindfirst32 -_wfindfirst32i64 -_wfindfirst64 -_wfindfirst64i32 -_wfindnext32 -_wfindnext32i64 -_wfindnext64 -_wfindnext64i32 -_wfopen -_wfopen_s -_wfreopen -_wfreopen_s -_wfsopen -_wfullpath -_wgetcwd -_wgetdcwd -_wgetenv -_wgetenv_s -_wmakepath -_wmakepath_s -_wmkdir -_wmktemp -_wmktemp_s -_wopen -_wperror -_wpopen -_wputenv -_wputenv_s -_wremove -_wrename -_write -_wrmdir -_wsearchenv -_wsearchenv_s -_wsetlocale -_wsopen -_wsopen_dispatch -_wsopen_s -_wspawnl -_wspawnle -_wspawnlp -_wspawnlpe -_wspawnv -_wspawnve -_wspawnvp -_wspawnvpe -_wsplitpath -_wsplitpath_s -_wstat32 -_wstat32i64 -_wstat64 -_wstat64i32 -_wstrdate -_wstrdate_s -_wstrtime -_wstrtime_s -_wsystem -_wtempnam -_wtmpnam -_wtmpnam_s -_wtof -_wtof_l -_wtoi -_wtoi64 -_wtoi64_l -_wtoi_l -_wtol -_wtol_l -_wtoll -_wtoll_l -_wunlink -_wutime == _wutime64 -_wutime32 -_wutime64 -_y0 -_y1 -_yn -abort -abs -acos -F_NON_I386(acosf) -F_ARM_ANY(acosl == acos) -acosh -acoshf -acoshl F_X86_ANY(DATA) -asctime -asctime_s -asin -F_NON_I386(asinf) -F_ARM_ANY(asinl == asin) -asinh -asinhf -asinhl F_X86_ANY(DATA) -atan -atan2 -F_NON_I386(atan2f) -F_ARM_ANY(atan2l == atan2) -F_NON_I386(atanf) -F_ARM_ANY(atanl == atan) -atanh -atanhf -atanhl F_X86_ANY(DATA) -atof -atoi -atol -atoll -bsearch -bsearch_s -btowc -c16rtomb -c32rtomb -cabs -cabsf -cabsl -cacos -cacosf -cacosh -cacoshf -cacoshl -cacosl -calloc -carg -cargf -cargl -casin -casinf -casinh -casinhf -casinhl -casinl -catan -catanf -catanh -catanhf -catanhl -catanl -cbrt -cbrtf -cbrtl F_X86_ANY(DATA) -ccos -ccosf -ccosh -ccoshf -ccoshl -ccosl -ceil -F_NON_I386(ceilf) -F_ARM_ANY(ceill == ceil) -cexp -cexpf -cexpl -cimag -cimagf -cimagl -clearerr -clearerr_s -clock -clog -clog10 -clog10f -clog10l -clogf -clogl -conj -conjf -conjl -copysign -copysignf -copysignl F_X86_ANY(DATA) -cos -F_NON_I386(cosf) -F_ARM_ANY(cosl == cos) -cosh -F_NON_I386(coshf) -cpow -cpowf -cpowl -cproj -cprojf -cprojl -creal -crealf -creall -csin -csinf -csinh -csinhf -csinhl -csinl -csqrt -csqrtf -csqrtl -ctan -ctanf -ctanh -ctanhf -ctanhl -ctanl -div -erf -erfc -erfcf -erfcl F_X86_ANY(DATA) -erff -erfl F_X86_ANY(DATA) -exit -exp -exp2 -exp2f -exp2l F_X86_ANY(DATA) -F_NON_I386(expf) -F_ARM_ANY(expl == exp) -expm1 -expm1f -expm1l F_X86_ANY(DATA) -fabs -F_ARM_ANY(fabsf) -fclose -fdim -fdimf -fdiml F_X86_ANY(DATA) -; Don't use the float env functions from UCRT; fesetround doesn't seem to have -; any effect on the FPU control word as required by other libmingwex math -; routines. -feclearexcept DATA -fegetenv DATA -fegetexceptflag DATA -fegetround DATA -feholdexcept DATA -feof -ferror -fesetenv DATA -fesetexceptflag DATA -fesetround DATA -fetestexcept DATA -fflush -fgetc -fgetpos -fgets -fgetwc -fgetws -floor -F_NON_I386(floorf) -F_ARM_ANY(floorl == floor) -fma -fmaf -fmal F_X86_ANY(DATA) -fmax -fmaxf -fmaxl F_X86_ANY(DATA) -fmin -fminf -fminl F_X86_ANY(DATA) -fmod -F_NON_I386(fmodf) -F_ARM_ANY(fmodl == fmod) -fopen -fopen_s -fputc -fputs -fputwc -fputws -fread -fread_s -free -freopen -freopen_s -frexp -fseek -fsetpos -ftell -fwrite -getc -getchar -getenv -getenv_s -gets -gets_s -getwc -getwchar -hypot -ilogb -ilogbf -ilogbl F_X86_ANY(DATA) -imaxabs -imaxdiv -is_wctype -isalnum -isalpha -isblank -iscntrl -isdigit -isgraph -isleadbyte -islower -isprint -ispunct -isspace -isupper -iswalnum -iswalpha -iswascii -iswblank -iswcntrl -iswctype -iswdigit -iswgraph -iswlower -iswprint -iswpunct -iswspace -iswupper -iswxdigit -isxdigit -labs -ldexp -ldiv -; The UCRT lgamma functions don't set/provide the signgam variable like -; the mingw ones do. Therefore prefer the libmingwex version instead. -lgamma DATA -lgammaf DATA -lgammal DATA -llabs -lldiv -llrint -llrintf -llrintl F_X86_ANY(DATA) -llround -llroundf -llroundl F_X86_ANY(DATA) -localeconv -log -log10 -F_NON_I386(log10f) -F_ARM_ANY(log10l == log10) -log1p -log1pf -log1pl F_X86_ANY(DATA) -log2 -log2f -log2l F_X86_ANY(DATA) -logb -logbf -logbl F_X86_ANY(DATA) -F_NON_I386(logf) -F_ARM_ANY(logl == log) -longjmp -lrint -lrintf -lrintl F_X86_ANY(DATA) -lround -lroundf -lroundl F_X86_ANY(DATA) -malloc -mblen -mbrlen -mbrtoc16 -mbrtoc32 -mbrtowc -mbsrtowcs -mbsrtowcs_s -mbstowcs -mbstowcs_s -mbtowc -memchr -memcmp -memcpy -memcpy_s -memmove -memmove_s -memset -modf -F_NON_I386(modff) -nan -nanf -nanl F_X86_ANY(DATA) -nearbyint -nearbyintf -nearbyintl F_X86_ANY(DATA) -nextafter -nextafterf -nextafterl F_X86_ANY(DATA) -; All of the nexttoward functions take the second parameter as long doubke, -; making them unusable for x86. -nexttoward F_X86_ANY(DATA) -nexttowardf F_X86_ANY(DATA) -nexttowardl F_X86_ANY(DATA) -norm -normf -norml -perror -pow -F_NON_I386(powf) -F_ARM_ANY(powl == pow) -putc -putchar -puts -putwc -putwchar -qsort -qsort_s -quick_exit -raise -rand -rand_s -realloc -remainder -remainderf -remainderl F_X86_ANY(DATA) -remove -remquo -remquof -remquol F_X86_ANY(DATA) -rename -rewind -rint -rintf -rintl F_X86_ANY(DATA) -round -roundf -roundl F_X86_ANY(DATA) -scalbln -scalblnf -scalblnl F_X86_ANY(DATA) -scalbn -scalbnf -scalbnl F_X86_ANY(DATA) -set_terminate -set_unexpected -setbuf -F_X64(setjmp) -setlocale -setvbuf -signal -sin -F_NON_I386(sinf) -F_ARM_ANY(sinl == sin) -; if we implement sinh, we can set it DATA only. -sinh -F_NON_I386(sinhf) -sqrt -F_NON_I386(sqrtf) -srand -strcat -strcat_s -strchr -strcmp -strcmpi == _stricmp -strcoll -strcpy -strcpy_s -strcspn -strerror -strerror_s -strftime -strlen -strncat -strncat_s -strncmp -strncpy -strncpy_s -; strnlen replaced by emu -strpbrk -strrchr -strspn -strstr -strtod -strtof -strtoimax -strtok -strtok_s -strtol -; Can't use long double functions from the CRT on x86 -F_ARM_ANY(strtold) -strtoll -strtoul -strtoull -strtoumax -strxfrm -system -tan -F_NON_I386(tanf) -F_ARM_ANY(tanl == tan) -; if we implement tanh, we can set it to DATA only. -tanh -F_NON_I386(tanhf) -terminate -tgamma -tgammaf -tgammal F_X86_ANY(DATA) -tmpfile -tmpfile_s -tmpnam -tmpnam_s -tolower -toupper -towctrans -towlower -towupper -trunc -truncf -truncl F_X86_ANY(DATA) -unexpected -ungetc -ungetwc -utime == _utime64 -wcrtomb -wcrtomb_s -wcscat -wcscat_s -wcschr -wcscmp -wcscoll -wcscpy -wcscpy_s -wcscspn -wcsftime -wcslen -wcsncat -wcsncat_s -wcsncmp -wcsncpy -wcsncpy_s -; We provide replacement implementation in libmingwex -wcsnlen DATA -wcspbrk -wcsrchr -wcsrtombs -wcsrtombs_s -wcsspn -wcsstr -wcstod -wcstof -wcstoimax -wcstok -wcstok_s -wcstol -; Can't use long double functions from the CRT on x86 -F_ARM_ANY(wcstold) -wcstoll -wcstombs -wcstombs_s -wcstoul -wcstoull -wcstoumax -wcsxfrm -wctob -wctomb -wctomb_s -wctrans -wctype -wmemcpy_s -wmemmove_s -; These functions may satisfy configure scripts. -ctime == _ctime64 -gmtime == _gmtime64 -localtime == _localtime64 -mktime == _mktime64 -time == _time64 -timespec_get == _timespec64_get +; Include common ucrtbase symbols for non-debug build ucrtbase.dll +#undef DEF_DEBUG +#include "ucrtbase-common.def.in" + +; Include symbol aliases for compatibility with msvcrt.dll +#define UCRTBASE +#include "crt-aliases.def.in" diff --git a/lib/libc/mingw/lib-common/ucrtbased.def.in b/lib/libc/mingw/lib-common/ucrtbased.def.in @@ -0,0 +1,12 @@ +LIBRARY "ucrtbased.dll" +EXPORTS + +#include "func.def.in" + +; Include common ucrtbase symbols for debug build ucrtbased.dll +#define DEF_DEBUG +#include "ucrtbase-common.def.in" + +; Include symbol aliases for compatibility with msvcrt.dll +#define UCRTBASE +#include "crt-aliases.def.in" diff --git a/lib/libc/mingw/lib-common/user32.def.in b/lib/libc/mingw/lib-common/user32.def.in @@ -115,6 +115,7 @@ CreateMDIWindowA CreateMDIWindowW CreateMenu CreatePopupMenu +CreateSyntheticPointerDevice CreateSystemThreads CreateWindowExA CreateWindowExW @@ -178,6 +179,7 @@ DestroyDCompositionHwndTarget DestroyIcon DestroyMenu DestroyReasons +DestroySyntheticPointerDevice DestroyWindow DeviceEventWorker DialogBoxIndirectParamA @@ -325,6 +327,8 @@ GetDCEx GetDesktopID GetDesktopWindow GetDialogBaseUnits +GetDialogControlDpiChangeBehavior +GetDialogDpiChangeBehavior GetDisplayAutoRotationPreferences GetDisplayConfigBufferSizes GetDlgCtrlID @@ -333,9 +337,12 @@ GetDlgItemInt GetDlgItemTextA GetDlgItemTextW GetDoubleClickTime +GetDpiAwarenessContextForProcess GetDpiForMonitorInternal GetDpiForSystem GetDpiForWindow +GetDpiFromDpiAwarenessContext +GetExtendedPointerDeviceProperty GetFocus GetForegroundWindow GetGestureConfig @@ -440,6 +447,7 @@ GetShellWindow GetSubMenu GetSysColor GetSysColorBrush +GetSystemDpiForProcess GetSystemMenu GetSystemMetrics GetSystemMetricsForDpi @@ -448,6 +456,7 @@ GetTabbedTextExtentW GetTaskmanWindow GetThreadDesktop GetThreadDpiAwarenessContext +GetThreadDpiHostingBehavior GetTitleBarInfo GetTopLevelWindow GetTopWindow @@ -468,6 +477,7 @@ GetWindowContextHelpId GetWindowDC GetWindowDisplayAffinity GetWindowDpiAwarenessContext +GetWindowDpiHostingBehavior GetWindowFeedbackSetting GetWindowInfo GetWindowLongA @@ -515,6 +525,7 @@ InjectDeviceInput InjectKeyboardInput InjectMouseInput InjectPointerInput +InjectSyntheticPointerInput InjectTouchInput InsertMenuA InsertMenuItemA @@ -672,6 +683,7 @@ QuerySendMessage RIMAddInputObserver RIMAreSiblingDevices RIMDeviceIoControl +RIMEnableMonitorMappingForDevice RIMFreeInputBuffer RIMGetDevicePreparsedData RIMGetDevicePreparsedDataLockfree @@ -706,6 +718,7 @@ RegisterDManipHook RegisterDeviceNotificationA RegisterDeviceNotificationW RegisterErrorReportingDialog +RegisterForTooltipDismissNotification RegisterFrostWindow RegisterGhostWindow RegisterHotKey @@ -758,6 +771,7 @@ SendMessageW SendNotifyMessageA SendNotifyMessageW SetActiveWindow +SetAdditionalForegroundBoostProcesses SetCapture SetCaretBlinkTime SetCaretPos @@ -775,6 +789,8 @@ SetCursorContents SetCursorPos SetDebugErrorLevel SetDeskWallpaper +SetDialogControlDpiChangeBehavior +SetDialogDpiChangeBehavior SetDisplayAutoRotationPreferences SetDisplayConfig SetDlgItemInt @@ -811,6 +827,7 @@ SetProcessDPIAware SetProcessDefaultLayout SetProcessDpiAwarenessContext SetProcessDpiAwarenessInternal +SetProcessLaunchForegroundPolicy SetProcessRestrictionExemption SetProcessWindowStation SetProgmanWindow @@ -831,6 +848,7 @@ SetSystemTimer SetTaskmanWindow SetThreadDesktop SetThreadDpiAwarenessContext +SetThreadDpiHostingBehavior SetThreadInputBlocked SetTimer SetUserObjectInformationA @@ -859,6 +877,8 @@ SetWindowsHookA SetWindowsHookExA SetWindowsHookExW SetWindowsHookW +ShellMigrateWindow +ShellSetWindowPos ShowCaret ShowCursor ShowOwnedPopups diff --git a/lib/libc/mingw/lib-common/vcruntime140.def.in b/lib/libc/mingw/lib-common/vcruntime140.def.in @@ -0,0 +1,94 @@ +LIBRARY "VCRUNTIME140.dll" +EXPORTS + +#include "func.def.in" + +_CreateFrameInfo +F_I386(_CxxThrowException@8) +F_NON_I386(_CxxThrowException) +F_I386(_EH_prolog) +_FindAndUnlinkFrame +_IsExceptionObjectToBeDestroyed +F_I386(_NLG_Dispatch2@4) +F_I386(_NLG_Return@12) +F_I386(_NLG_Return2) +_SetWinRTOutOfMemoryExceptionCallback +__AdjustPointer +__BuildCatchObject +__BuildCatchObjectHelper +F_NON_I386(__C_specific_handler) +F_NON_I386(__C_specific_handler_noexcept) +__CxxDetectRethrow +__CxxExceptionFilter +__CxxFrameHandler +__CxxFrameHandler2 +__CxxFrameHandler3 +F_I386(__CxxLongjmpUnwind@4) +__CxxQueryExceptionSize +__CxxRegisterExceptionObject +__CxxUnregisterExceptionObject +__DestructExceptionObject +__FrameUnwindFilter +__GetPlatformExceptionInfo +F_NON_I386(__NLG_Dispatch2) +F_NON_I386(__NLG_Return2) +__RTCastToVoid +__RTDynamicCast +__RTtypeid +__TypeMatch +__current_exception +__current_exception_context +F_NON_ARM64(__intrinsic_setjmp) +F_NON_I386(__intrinsic_setjmpex) +F_ARM32(__jump_unwind) +__processing_throw +__report_gsfailure +__std_exception_copy +__std_exception_destroy +__std_terminate +__std_type_info_compare +__std_type_info_destroy_list +__std_type_info_hash +__std_type_info_name +__telemetry_main_invoke_trigger +__telemetry_main_return_trigger +__unDName +__unDNameEx +__uncaught_exception +__uncaught_exceptions +__vcrt_GetModuleFileNameW +__vcrt_GetModuleHandleW +__vcrt_InitializeCriticalSectionEx +__vcrt_LoadLibraryExW +F_I386(_chkesp) +F_I386(_except_handler2) +F_I386(_except_handler3) +F_I386(_except_handler4_common) +_get_purecall_handler +_get_unexpected +F_I386(_global_unwind2) +_is_exception_typeof +F64(_local_unwind) +F_I386(_local_unwind2) +F_I386(_local_unwind4) +F_I386(_longjmpex) +_purecall +F_I386(_seh_longjmp_unwind4@4) +F_I386(_seh_longjmp_unwind@4) +_set_purecall_handler +_set_se_translator +F_I386(_setjmp3) +longjmp +memchr +memcmp +memcpy +memmove +memset +set_unexpected +strchr +strrchr +strstr +unexpected +wcschr +wcsrchr +wcsstr diff --git a/lib/libc/mingw/lib-common/vcruntime140_app.def.in b/lib/libc/mingw/lib-common/vcruntime140_app.def.in @@ -39,8 +39,7 @@ __RTtypeid __TypeMatch __current_exception __current_exception_context -F_X86_ANY(__intrinsic_setjmp) -F_ARM32(__intrinsic_setjmp) +F_NON_ARM64(__intrinsic_setjmp) F_NON_I386(__intrinsic_setjmpex) F_ARM32(__jump_unwind) __processing_throw diff --git a/lib/libc/mingw/lib-common/vcruntime140d.def.in b/lib/libc/mingw/lib-common/vcruntime140d.def.in @@ -0,0 +1,94 @@ +LIBRARY "VCRUNTIME140D.dll" +EXPORTS + +#include "func.def.in" + +_CreateFrameInfo +F_I386(_CxxThrowException@8) +F_NON_I386(_CxxThrowException) +F_I386(_EH_prolog) +_FindAndUnlinkFrame +_IsExceptionObjectToBeDestroyed +F_I386(_NLG_Dispatch2@4) +F_I386(_NLG_Return@12) +F_I386(_NLG_Return2) +_SetWinRTOutOfMemoryExceptionCallback +__AdjustPointer +__BuildCatchObject +__BuildCatchObjectHelper +F_NON_I386(__C_specific_handler) +F_NON_I386(__C_specific_handler_noexcept) +__CxxDetectRethrow +__CxxExceptionFilter +__CxxFrameHandler +__CxxFrameHandler2 +__CxxFrameHandler3 +F_I386(__CxxLongjmpUnwind@4) +__CxxQueryExceptionSize +__CxxRegisterExceptionObject +__CxxUnregisterExceptionObject +__DestructExceptionObject +__FrameUnwindFilter +__GetPlatformExceptionInfo +F_NON_I386(__NLG_Dispatch2) +F_NON_I386(__NLG_Return2) +__RTCastToVoid +__RTDynamicCast +__RTtypeid +__TypeMatch +__current_exception +__current_exception_context +F_NON_ARM64(__intrinsic_setjmp) +F_NON_I386(__intrinsic_setjmpex) +F_ARM32(__jump_unwind) +__processing_throw +__report_gsfailure +__std_exception_copy +__std_exception_destroy +__std_terminate +__std_type_info_compare +__std_type_info_destroy_list +__std_type_info_hash +__std_type_info_name +__telemetry_main_invoke_trigger +__telemetry_main_return_trigger +__unDName +__unDNameEx +__uncaught_exception +__uncaught_exceptions +__vcrt_GetModuleFileNameW +__vcrt_GetModuleHandleW +__vcrt_InitializeCriticalSectionEx +__vcrt_LoadLibraryExW +F_I386(_chkesp) +F_I386(_except_handler2) +F_I386(_except_handler3) +F_I386(_except_handler4_common) +_get_purecall_handler +_get_unexpected +F_I386(_global_unwind2) +_is_exception_typeof +F64(_local_unwind) +F_I386(_local_unwind2) +F_I386(_local_unwind4) +F_I386(_longjmpex) +_purecall +F_I386(_seh_longjmp_unwind4@4) +F_I386(_seh_longjmp_unwind@4) +_set_purecall_handler +_set_se_translator +F_I386(_setjmp3) +longjmp +memchr +memcmp +memcpy +memmove +memset +set_unexpected +strchr +strrchr +strstr +unexpected +wcschr +wcsrchr +wcsstr diff --git a/lib/libc/mingw/lib-common/winbrand.def b/lib/libc/mingw/lib-common/winbrand.def @@ -0,0 +1,23 @@ +; +; Definition file of WINBRAND.dll +; Automatic generated by gendef +; written by Kai Tietz 2008-2014 +; +LIBRARY "WINBRAND.dll" +EXPORTS +BrandingFormatString +BrandingFormatStringForEdition +BrandingLoadBitmap +BrandingLoadCursor +BrandingLoadIcon +BrandingLoadImage +BrandingLoadNeutralStringForEdition +BrandingLoadString +BrandingLoadStringForEdition +EulaFreeBuffer +GetEULAFile +GetEULAFileEx +GetEULAInCurrentUILanguage +GetHinstanceByNameSpace +GetInstalledEULAPath +InstallEULA diff --git a/lib/libc/mingw/lib-common/winhvplatform.def.in b/lib/libc/mingw/lib-common/winhvplatform.def.in @@ -0,0 +1,70 @@ +#include "func.def.in" + +LIBRARY "winhvplatform.dll" +EXPORTS +WHvAcceptPartitionMigration +WHvAdviseGpaRange +WHvAllocateVpciResource +WHvCancelPartitionMigration +WHvCancelRunVirtualProcessor +WHvCompletePartitionMigration +WHvCreateNotificationPort +WHvCreatePartition +WHvCreateTrigger +WHvCreateVirtualProcessor +WHvCreateVirtualProcessor2 +WHvCreateVpciDevice +WHvDeleteNotificationPort +WHvDeletePartition +WHvDeleteTrigger +WHvDeleteVirtualProcessor +WHvDeleteVpciDevice +WHvGetCapability +F_X64(WHvGetInterruptTargetVpSet) +WHvGetPartitionCounters +WHvGetPartitionProperty +WHvGetVirtualProcessorCounters +F_X64(WHvGetVirtualProcessorCpuidOutput) +F_X64(WHvGetVirtualProcessorInterruptControllerState) +F_X64(WHvGetVirtualProcessorInterruptControllerState2) +WHvGetVirtualProcessorRegisters +WHvGetVirtualProcessorState +F_X64(WHvGetVirtualProcessorXsaveState) +WHvGetVpciDeviceInterruptTarget +WHvGetVpciDeviceNotification +WHvGetVpciDeviceProperty +WHvMapGpaRange +WHvMapGpaRange2 +WHvMapVpciDeviceInterrupt +WHvMapVpciDeviceMmioRanges +WHvPostVirtualProcessorSynicMessage +WHvQueryGpaRangeDirtyBitmap +WHvReadGpaRange +WHvReadVpciDeviceRegister +WHvRegisterPartitionDoorbellEvent +WHvRequestInterrupt +WHvRequestVpciDeviceInterrupt +WHvResetPartition +WHvResumePartitionTime +WHvRetargetVpciDeviceInterrupt +WHvRunVirtualProcessor +WHvSetNotificationPortProperty +WHvSetPartitionProperty +F_X64(WHvSetVirtualProcessorInterruptControllerState) +F_X64(WHvSetVirtualProcessorInterruptControllerState2) +WHvSetVirtualProcessorRegisters +WHvSetVirtualProcessorState +F_X64(WHvSetVirtualProcessorXsaveState) +WHvSetVpciDevicePowerState +WHvSetupPartition +WHvSignalVirtualProcessorSynicEvent +WHvStartPartitionMigration +WHvSuspendPartitionTime +WHvTranslateGva +WHvUnmapGpaRange +WHvUnmapVpciDeviceInterrupt +WHvUnmapVpciDeviceMmioRanges +WHvUnregisterPartitionDoorbellEvent +WHvUpdateTriggerParameters +WHvWriteGpaRange +WHvWriteVpciDeviceRegister diff --git a/lib/libc/mingw/lib-common/wintrust.def b/lib/libc/mingw/lib-common/wintrust.def @@ -0,0 +1,167 @@ +; +; Definition file of WINTRUST.dll +; Automatic generated by gendef +; written by Kai Tietz 2008-2014 +; +LIBRARY "WINTRUST.dll" +EXPORTS +ComputeFirstPageHash +CryptCATVerifyMember +CryptSIPGetInfo +CryptSIPGetRegWorkingFlags +GenericChainCertificateTrust +GenericChainFinalProv +HTTPSCertificateTrust +SetMessageDigestInfo +SoftpubDefCertInit +SoftpubFreeDefUsageCallData +SoftpubLoadDefUsageCallData +WTHelperCertFindIssuerCertificate +AddPersonalTrustDBPages +CatalogCompactHashDatabase +ConfigCiFinalPolicy +ConfigCiPackageFamilyNameCheck +CryptCATAdminAcquireContext +CryptCATAdminAcquireContext2 +CryptCATAdminAddCatalog +CryptCATAdminCalcHashFromFileHandle +CryptCATAdminCalcHashFromFileHandle2 +CryptCATAdminCalcHashFromFileHandle3 +CryptCATAdminEnumCatalogFromHash +CryptCATAdminPauseServiceForBackup +CryptCATAdminReleaseCatalogContext +CryptCATAdminReleaseContext +CryptCATAdminRemoveCatalog +CryptCATAdminResolveCatalogPath +CryptCATAllocSortedMemberInfo +CryptCATCDFClose +CryptCATCDFEnumAttributes +CryptCATCDFEnumAttributesWithCDFTag +CryptCATCDFEnumCatAttributes +CryptCATCDFEnumMembers +CryptCATCDFEnumMembersByCDFTag +CryptCATCDFEnumMembersByCDFTagEx +CryptCATCDFOpen +CryptCATCatalogInfoFromContext +CryptCATClose +CryptCATEnumerateAttr +CryptCATEnumerateCatAttr +CryptCATEnumerateMember +CryptCATFreeSortedMemberInfo +CryptCATGetAttrInfo +CryptCATGetCatAttrInfo +CryptCATGetMemberInfo +CryptCATHandleFromStore +CryptCATOpen +CryptCATPersistStore +CryptCATPutAttrInfo +CryptCATPutCatAttrInfo +CryptCATPutMemberInfo +CryptCATStoreFromHandle +CryptSIPCreateIndirectData +CryptSIPGetCaps +CryptSIPGetSealedDigest +CryptSIPGetSignedDataMsg +CryptSIPPutSignedDataMsg +CryptSIPRemoveSignedDataMsg +CryptSIPVerifyIndirectData +; DllRegisterServer +; DllUnregisterServer +DriverCleanupPolicy +DriverFinalPolicy +DriverInitializePolicy +FindCertsByIssuer +GetAuthenticodeSha256Hash +HTTPSFinalProv +IsCatalogFile +MsCatConstructHashTag +MsCatFreeHashTag +OfficeCleanupPolicy +OfficeInitializePolicy +OpenPersonalTrustDBDialog +OpenPersonalTrustDBDialogEx +SoftpubAuthenticode +SoftpubCheckCert +SoftpubCleanup +SoftpubDllRegisterServer +SoftpubDllUnregisterServer +SoftpubDumpStructure +SoftpubInitialize +SoftpubLoadMessage +SoftpubLoadSignature +SrpCheckSmartlockerEAandProcessToken +TrustDecode +TrustFindIssuerCertificate +TrustFreeDecode +TrustIsCertificateSelfSigned +TrustOpenStores +WTConvertCertCtxToChainInfo +WTGetBioSignatureInfo +WTGetPluginSignatureInfo +WTGetSignatureInfo +WTHelperCertCheckValidSignature +WTHelperCertIsSelfSigned +WTHelperCheckCertUsage +WTHelperGetAgencyInfo +WTHelperGetFileHandle +WTHelperGetFileHash +WTHelperGetFileName +WTHelperGetKnownUsages +WTHelperGetProvCertFromChain +WTHelperGetProvPrivateDataFromChain +WTHelperGetProvSignerFromChain +WTHelperIsChainedToMicrosoft +WTHelperIsChainedToMicrosoftFromStateData +WTHelperIsInRootStore +WTHelperOpenKnownStores +WTHelperProvDataFromStateData +WTIsFirstConfigCiResultPreferred +WTLogConfigCiScriptEvent +WTLogConfigCiSignerEvent +WTValidateBioSignaturePolicy +WVTAsn1CatMemberInfo2Decode +WVTAsn1CatMemberInfo2Encode +WVTAsn1CatMemberInfoDecode +WVTAsn1CatMemberInfoEncode +WVTAsn1CatNameValueDecode +WVTAsn1CatNameValueEncode +WVTAsn1IntentToSealAttributeDecode +WVTAsn1IntentToSealAttributeEncode +WVTAsn1SealingSignatureAttributeDecode +WVTAsn1SealingSignatureAttributeEncode +WVTAsn1SealingTimestampAttributeDecode +WVTAsn1SealingTimestampAttributeEncode +WVTAsn1SpcFinancialCriteriaInfoDecode +WVTAsn1SpcFinancialCriteriaInfoEncode +WVTAsn1SpcIndirectDataContentDecode +WVTAsn1SpcIndirectDataContentEncode +WVTAsn1SpcLinkDecode +WVTAsn1SpcLinkEncode +WVTAsn1SpcMinimalCriteriaInfoDecode +WVTAsn1SpcMinimalCriteriaInfoEncode +WVTAsn1SpcPeImageDataDecode +WVTAsn1SpcPeImageDataEncode +WVTAsn1SpcSigInfoDecode +WVTAsn1SpcSigInfoEncode +WVTAsn1SpcSpAgencyInfoDecode +WVTAsn1SpcSpAgencyInfoEncode +WVTAsn1SpcSpOpusInfoDecode +WVTAsn1SpcSpOpusInfoEncode +WVTAsn1SpcStatementTypeDecode +WVTAsn1SpcStatementTypeEncode +WinVerifyTrust +WinVerifyTrustEx +WintrustAddActionID +WintrustAddDefaultForUsage +WintrustCertificateTrust +WintrustGetDefaultForUsage +WintrustGetRegPolicyFlags +WintrustLoadFunctionPointers +WintrustRemoveActionID +WintrustSetDefaultIncludePEPageHashes +WintrustSetRegPolicyFlags +WintrustUserWriteabilityCheck +mscat32DllRegisterServer +mscat32DllUnregisterServer +mssip32DllRegisterServer +mssip32DllUnregisterServer diff --git a/lib/libc/mingw/lib-common/wscapi.def b/lib/libc/mingw/lib-common/wscapi.def @@ -5,11 +5,16 @@ ; LIBRARY "WSCAPI.dll" EXPORTS +wscLaunchAdminMakeDefaultUI wscShowAMSCN -CLSID_WSCProductList -IID_IWSCProductList -IID_IWscProduct -LIBID_wscAPILib +CLSID_WSCDefaultProduct DATA +CLSID_WSCProductList DATA +; DllCanUnloadNow +; DllGetClassObject +IID_IWSCDefaultProduct DATA +IID_IWSCProductList DATA +IID_IWscProduct DATA +LIBID_wscAPILib DATA WscGetAntiMalwareUri WscGetSecurityProviderHealth WscQueryAntiMalwareUri @@ -26,13 +31,18 @@ wscGeneralSecurityGetStatus wscGetAlertStatus wscIcfEnable wscIeSettingsFix +wscInitiateOfflineCleaning wscIsDefenderAntivirusSupported wscLuaSettingsFix +wscMakeDefaultProductRequest +wscNotifyUserForNearExpiration wscOverrideComponentStatus wscPing wscProductInfoFree wscRegisterChangeNotification wscRegisterSecurityProduct +wscSetDefaultProduct wscUnRegisterChangeNotification wscUnregisterSecurityProduct wscUpdateProductStatus +wscUpdateProductSubStatus diff --git a/lib/libc/mingw/lib32/bcryptprimitives.def b/lib/libc/mingw/lib32/bcryptprimitives.def @@ -0,0 +1,18 @@ +; +; Definition file of bcryptPrimitives.dll +; Automatic generated by gendef 1.1 +; written by Kai Tietz 2008 +; The def file has to be processed by --kill-at (-k) option of dlltool or ld +; +LIBRARY "bcryptPrimitives.dll" +EXPORTS +GetAsymmetricEncryptionInterface@16 +GetCipherInterface@16 +GetHashInterface@16 +GetKeyDerivationInterface@16 +GetRngInterface@12 +GetSecretAgreementInterface@16 +GetSignatureInterface@16 +MSCryptConvertRsaPrivateBlobToFullRsaBlob@20 +ProcessPrng@8 +ProcessPrngGuid@4 diff --git a/lib/libc/mingw/lib32/cfgmgr32.def b/lib/libc/mingw/lib32/cfgmgr32.def @@ -7,10 +7,12 @@ LIBRARY "CFGMGR32.dll" EXPORTS CMP_GetBlockedDriverInfo@16 CMP_GetServerSideDeviceInstallFlags@12 +CMP_Get_Device_ID_List@16 +CMP_Get_Device_ID_List_Size@12 CMP_Init_Detection@4 -CMP_RegisterNotification@24 +CMP_RegisterServiceNotification@16 +CMP_Register_Notification@20 CMP_Report_LogOn@8 -CMP_UnregisterNotification@4 CMP_WaitNoPendingInstallEvents@4 CMP_WaitServicesAvailable@4 CM_Add_Driver_PackageW@40 @@ -165,6 +167,7 @@ CM_Get_Version_Ex@4 CM_Import_PowerScheme@12 CM_Install_DevNodeW@32 CM_Install_DevNode_ExW@36 +CM_Install_DriverW@28 CM_Intersect_Range_List@16 CM_Invert_Range_List@20 CM_Is_Dock_Station_Present@4 @@ -212,6 +215,7 @@ CM_Register_Device_InterfaceA@24 CM_Register_Device_InterfaceW@24 CM_Register_Device_Interface_ExA@28 CM_Register_Device_Interface_ExW@28 +CM_Register_Notification@16 CM_Remove_SubTree@8 CM_Remove_SubTree_Ex@12 CM_Request_Device_EjectA@20 @@ -250,8 +254,34 @@ CM_Setup_DevNode_Ex@12 CM_Test_Range_Available@24 CM_Uninstall_DevNode@8 CM_Uninstall_DevNode_Ex@12 +CM_Uninstall_DriverW@28 CM_Unregister_Device_InterfaceA@8 CM_Unregister_Device_InterfaceW@8 CM_Unregister_Device_Interface_ExA@12 CM_Unregister_Device_Interface_ExW@12 +CM_Unregister_Notification@4 CM_Write_UserPowerKey@32 +DevCloseObjectQuery@4 +DevCreateObjectQuery@36 +DevCreateObjectQueryEx@44 +DevCreateObjectQueryFromId@40 +DevCreateObjectQueryFromIdEx@48 +DevCreateObjectQueryFromIds@40 +DevCreateObjectQueryFromIdsEx@48 +DevFindProperty@20 +DevFreeObjectProperties@8 +DevFreeObjects@8 +DevGetObjectProperties@28 +DevGetObjectPropertiesEx@36 +DevGetObjects@32 +DevGetObjectsEx@40 +DevSetObjectProperties@16 +SwDeviceClose@4 +SwDeviceCreate@32 +SwDeviceGetLifetime@8 +SwDeviceInterfacePropertySet@16 +SwDeviceInterfaceRegister@28 +SwDeviceInterfaceSetState@12 +SwDevicePropertySet@12 +SwDeviceSetLifetime@8 +SwMemFree@4 diff --git a/lib/libc/mingw/lib32/kernel32.def b/lib/libc/mingw/lib32/kernel32.def @@ -121,9 +121,11 @@ BuildCommDCBW@8 BuildIoRingCancelRequest@20 BuildIoRingFlushFile@24 BuildIoRingReadFile@44 +BuildIoRingReadFileScatter@40 BuildIoRingRegisterBuffers@16 BuildIoRingRegisterFileHandles@16 BuildIoRingWriteFile@48 +BuildIoRingWriteFileGather@44 CallNamedPipeA@28 CallNamedPipeW@28 CallbackMayRunLong@4 diff --git a/lib/libc/mingw/lib32/mstask.def b/lib/libc/mingw/lib32/mstask.def @@ -18,16 +18,3 @@ SAGetNSAccountInformation@12 SASetAccountInformation@20 SASetNSAccountInformation@12 SetNetScheduleAccountInformation@12 -_ConvertAtJobsToTasks@0@0 -_DllCanUnloadNow@0@0 -_DllGetClassObject@12@12 -_GetNetScheduleAccountInformation@12@12 -_NetrJobAdd@12@12 -_NetrJobDel@12@12 -_NetrJobEnum@20@20 -_NetrJobGetInfo@12@12 -_SAGetAccountInformation@16@16 -_SAGetNSAccountInformation@12@12 -_SASetAccountInformation@20@20 -_SASetNSAccountInformation@12@12 -_SetNetScheduleAccountInformation@12@12 diff --git a/lib/libc/mingw/lib32/ninput.def b/lib/libc/mingw/lib32/ninput.def @@ -0,0 +1,37 @@ +; +; Definition file of ninput.dll +; Automatic generated by gendef +; written by Kai Tietz 2008-2014 +; +LIBRARY "ninput.dll" +EXPORTS +AddPointerInteractionContext@8 +BufferPointerPacketsInteractionContext@12 +CreateInteractionContext@4 +DestroyInteractionContext@4 +GetCrossSlideParameterInteractionContext@12 +GetHoldParameterInteractionContext@12 +GetInertiaParameterInteractionContext@12 +GetInteractionConfigurationInteractionContext@12 +GetMouseWheelParameterInteractionContext@12 +GetPropertyInteractionContext@12 +GetStateInteractionContext@12 +GetTapParameterInteractionContext@12 +GetTranslationParameterInteractionContext@12 +ProcessBufferedPacketsInteractionContext@4 +ProcessInertiaInteractionContext@4 +ProcessPointerFramesInteractionContext@16 +RegisterOutputCallbackInteractionContext2@12 +RegisterOutputCallbackInteractionContext@12 +RemovePointerInteractionContext@8 +ResetInteractionContext@4 +SetCrossSlideParametersInteractionContext@12 +SetHoldParameterInteractionContext@12 +SetInertiaParameterInteractionContext@12 +SetInteractionConfigurationInteractionContext@12 +SetMouseWheelParameterInteractionContext@12 +SetPivotInteractionContext@16 +SetPropertyInteractionContext@12 +SetTapParameterInteractionContext@12 +SetTranslationParameterInteractionContext@12 +StopInteractionContext@4 diff --git a/lib/libc/mingw/lib32/t2embed.def b/lib/libc/mingw/lib32/t2embed.def @@ -11,17 +11,6 @@ TTIsEmbeddingEnabled@8 TTIsEmbeddingEnabledForFacename@8 TTLoadEmbeddedFont@40 TTRunValidationTests@8 -_TTCharToUnicode@24@24 -_TTDeleteEmbeddedFont@12@12 -_TTEmbedFont@44@44 -_TTEmbedFontFromFileA@52@52 -_TTEnableEmbeddingForFacename@8@8 -_TTGetEmbeddedFontInfo@28@28 -_TTGetEmbeddingType@8@8 -_TTIsEmbeddingEnabled@8@8 -_TTIsEmbeddingEnabledForFacename@8@8 -_TTLoadEmbeddedFont@40@40 -_TTRunValidationTests@8@8 TTEmbedFontEx@44 TTRunValidationTestsEx@8 TTGetNewFontName@20 diff --git a/lib/libc/mingw/lib32/tbs.def b/lib/libc/mingw/lib32/tbs.def @@ -17,6 +17,7 @@ Tbsi_GetDeviceInfo@8 Tbsi_Get_OwnerAuth@16 Tbsi_Get_TCG_Log@12 Tbsi_Get_TCG_Log_Ex@12 +Tbsi_Is_Tpm_Present@0 Tbsi_Physical_Presence_Command@20 Tbsi_Revoke_Attestation@0 Tbsi_ShaHash@32 diff --git a/lib/libc/mingw/lib32/usbd.def b/lib/libc/mingw/lib32/usbd.def @@ -5,16 +5,15 @@ ; LIBRARY "USBD.SYS" EXPORTS -; USBD_CreateConfigurationRequestEx@8 -; USBD_ParseConfigurationDescriptorEx@28 -; USBD_ParseDescriptors@16 +USBD_CreateConfigurationRequestEx@8 +USBD_ParseConfigurationDescriptorEx@28 +USBD_ParseDescriptors@16 DllInitialize@4 DllUnload@0 USBD_AllocateDeviceName@4 USBD_CalculateUsbBandwidth@12 USBD_CompleteRequest@8 USBD_CreateConfigurationRequest@8 -; _USBD_CreateConfigurationRequestEx@8@8 USBD_CreateDevice@20 USBD_Debug_GetHeap@16 USBD_Debug_LogEntry@16 @@ -30,8 +29,6 @@ USBD_GetUSBDIVersion@4 USBD_InitializeDevice@24 USBD_MakePdoName@8 USBD_ParseConfigurationDescriptor@12 -; _USBD_ParseConfigurationDescriptorEx@28@28 -; _USBD_ParseDescriptors@16@16 USBD_QueryBusTime@8 USBD_RegisterHcDeviceCapabilities@12 USBD_RegisterHcFilter@8 @@ -40,6 +37,3 @@ USBD_RemoveDevice@12 USBD_RestoreDevice@12 USBD_SetSuspendPowerState@8 USBD_WaitDeviceMutex@4 -USBD_CreateConfigurationRequestEx@8==_USBD_CreateConfigurationRequestEx@8 -USBD_ParseConfigurationDescriptorEx@28==_USBD_ParseConfigurationDescriptorEx@28 -USBD_ParseDescriptors@16==_USBD_ParseDescriptors@16 diff --git a/lib/libc/mingw/lib32/user32.def b/lib/libc/mingw/lib32/user32.def @@ -747,6 +747,7 @@ RegisterDeviceNotificationA@12 RegisterDeviceNotificationW@12 RegisterErrorReportingDialog@8 RegisterFrostWindow@8 +RegisterForTooltipDismissNotification@8 RegisterGhostWindow@8 RegisterHotKey@16 RegisterLogonProcess@8 @@ -799,6 +800,7 @@ SendMessageW@16 SendNotifyMessageA@16 SendNotifyMessageW@16 SetActiveWindow@4 +SetAdditionalForegroundBoostProcesses@12 SetCapture@4 SetCaretBlinkTime@4 SetCaretPos@8 @@ -856,6 +858,7 @@ SetProcessDPIAware@0 SetProcessDefaultLayout@4 SetProcessDpiAwarenessContext@4 SetProcessDpiAwarenessInternal@4 +SetProcessLaunchForegroundPolicy@8 SetProcessRestrictionExemption@4 SetProcessWindowStation@4 SetProgmanWindow@4 @@ -913,6 +916,8 @@ SfmDxReleaseSwapChain@8 SfmDxReportPendingBindingsToDwm@0 SfmDxSetSwapChainBindingStatus@8 SfmDxSetSwapChainStats@8 +ShellMigrateWindow@12 +ShellSetWindowPos@24 ShowCaret@4 ShowCursor@4 ShowOwnedPopups@8 diff --git a/lib/libc/mingw/lib32/winbrand.def b/lib/libc/mingw/lib32/winbrand.def @@ -0,0 +1,23 @@ +; +; Definition file of WINBRAND.dll +; Automatic generated by gendef +; written by Kai Tietz 2008-2014 +; +LIBRARY "WINBRAND.dll" +EXPORTS +BrandingFormatString@4 +BrandingFormatStringForEdition@12 +BrandingLoadBitmap@8 +BrandingLoadCursor@8 +BrandingLoadIcon@8 +BrandingLoadImage@24 +BrandingLoadNeutralStringForEdition@20 +BrandingLoadString@16 +BrandingLoadStringForEdition@24 +EulaFreeBuffer@4 +GetEULAFile@20 +GetEULAFileEx@24 +GetEULAInCurrentUILanguage@4 +GetHinstanceByNameSpace@4 +GetInstalledEULAPath@4 +InstallEULA@16 diff --git a/lib/libc/mingw/lib32/wintrust.def b/lib/libc/mingw/lib32/wintrust.def @@ -5,6 +5,7 @@ ; LIBRARY "WINTRUST.dll" EXPORTS +ComputeFirstPageHash@16 CryptCATVerifyMember@12 CryptSIPGetInfo@4 CryptSIPGetRegWorkingFlags@4 @@ -17,8 +18,13 @@ SoftpubLoadDefUsageCallData@8 WTHelperCertFindIssuerCertificate@28 AddPersonalTrustDBPages@12 CatalogCompactHashDatabase@16 +ConfigCiFinalPolicy@4 +ConfigCiPackageFamilyNameCheck@12 +CryptCATAdminAcquireContext2@20 CryptCATAdminAcquireContext@12 CryptCATAdminAddCatalog@16 +CryptCATAdminCalcHashFromFileHandle2@20 +CryptCATAdminCalcHashFromFileHandle3@20 CryptCATAdminCalcHashFromFileHandle@16 CryptCATAdminEnumCatalogFromHash@20 CryptCATAdminPauseServiceForBackup@8 @@ -52,16 +58,19 @@ CryptCATPutCatAttrInfo@20 CryptCATPutMemberInfo@28 CryptCATStoreFromHandle@4 CryptSIPCreateIndirectData@12 +CryptSIPGetCaps@8 +CryptSIPGetSealedDigest@20 CryptSIPGetSignedDataMsg@20 CryptSIPPutSignedDataMsg@20 CryptSIPRemoveSignedDataMsg@8 CryptSIPVerifyIndirectData@8 -DllRegisterServer -DllUnregisterServer +; DllRegisterServer +; DllUnregisterServer DriverCleanupPolicy@4 DriverFinalPolicy@4 DriverInitializePolicy@4 FindCertsByIssuer@28 +GetAuthenticodeSha256Hash@12 HTTPSFinalProv@4 IsCatalogFile@8 MsCatConstructHashTag@12 @@ -73,17 +82,22 @@ OpenPersonalTrustDBDialogEx@12 SoftpubAuthenticode@4 SoftpubCheckCert@16 SoftpubCleanup@4 -SoftpubDllRegisterServer -SoftpubDllUnregisterServer +SoftpubDllRegisterServer@0 +SoftpubDllUnregisterServer@0 SoftpubDumpStructure@4 SoftpubInitialize@4 SoftpubLoadMessage@4 SoftpubLoadSignature@4 +SrpCheckSmartlockerEAandProcessToken@12 TrustDecode@36 TrustFindIssuerCertificate@32 TrustFreeDecode@8 TrustIsCertificateSelfSigned@12 TrustOpenStores@16 +WTConvertCertCtxToChainInfo@12 +WTGetBioSignatureInfo@24 +WTGetPluginSignatureInfo@24 +WTGetSignatureInfo@24 WTHelperCertCheckValidSignature@4 WTHelperCertIsSelfSigned@8 WTHelperCheckCertUsage@8 @@ -95,13 +109,27 @@ WTHelperGetKnownUsages@8 WTHelperGetProvCertFromChain@8 WTHelperGetProvPrivateDataFromChain@8 WTHelperGetProvSignerFromChain@16 +WTHelperIsChainedToMicrosoft@12 +WTHelperIsChainedToMicrosoftFromStateData@8 WTHelperIsInRootStore@8 WTHelperOpenKnownStores@4 WTHelperProvDataFromStateData@4 +WTIsFirstConfigCiResultPreferred@12 +WTLogConfigCiScriptEvent@20 +WTLogConfigCiSignerEvent@16 +WTValidateBioSignaturePolicy@8 +WVTAsn1CatMemberInfo2Decode@28 +WVTAsn1CatMemberInfo2Encode@20 WVTAsn1CatMemberInfoDecode@28 WVTAsn1CatMemberInfoEncode@20 WVTAsn1CatNameValueDecode@28 WVTAsn1CatNameValueEncode@20 +WVTAsn1IntentToSealAttributeDecode@28 +WVTAsn1IntentToSealAttributeEncode@20 +WVTAsn1SealingSignatureAttributeDecode@28 +WVTAsn1SealingSignatureAttributeEncode@20 +WVTAsn1SealingTimestampAttributeDecode@28 +WVTAsn1SealingTimestampAttributeEncode@20 WVTAsn1SpcFinancialCriteriaInfoDecode@28 WVTAsn1SpcFinancialCriteriaInfoEncode@20 WVTAsn1SpcIndirectDataContentDecode@28 @@ -131,7 +159,8 @@ WintrustLoadFunctionPointers@8 WintrustRemoveActionID@4 WintrustSetDefaultIncludePEPageHashes@4 WintrustSetRegPolicyFlags@4 -mscat32DllRegisterServer -mscat32DllUnregisterServer -mssip32DllRegisterServer -mssip32DllUnregisterServer +WintrustUserWriteabilityCheck@4 +mscat32DllRegisterServer@0 +mscat32DllUnregisterServer@0 +mssip32DllRegisterServer@0 +mssip32DllUnregisterServer@0 diff --git a/lib/libc/mingw/lib32/wscapi.def b/lib/libc/mingw/lib32/wscapi.def @@ -0,0 +1,48 @@ +; +; Definition file of WSCAPI.dll +; Automatic generated by gendef +; written by Kai Tietz 2008-2014 +; +LIBRARY "WSCAPI.dll" +EXPORTS +wscLaunchAdminMakeDefaultUI@4 +wscShowAMSCN@8 +CLSID_WSCDefaultProduct DATA +CLSID_WSCProductList DATA +; DllCanUnloadNow@0 +; DllGetClassObject@12 +IID_IWSCDefaultProduct DATA +IID_IWSCProductList DATA +IID_IWscProduct DATA +LIBID_wscAPILib DATA +WscGetAntiMalwareUri@4 +WscGetSecurityProviderHealth@8 +WscQueryAntiMalwareUri@0 +WscRegisterForChanges@16 +WscRegisterForUserNotifications@0 +WscUnRegisterChanges@4 +wscAntiSpywareGetStatus@8 +wscAntiVirusExpiredBeyondThreshold@12 +wscAntiVirusGetStatus@8 +wscAutoUpdatesEnableScheduledMode@0 +wscAutoUpdatesGetStatus@4 +wscFirewallGetStatus@8 +wscGeneralSecurityGetStatus@8 +wscGetAlertStatus@8 +wscIcfEnable@0 +wscIeSettingsFix@0 +wscInitiateOfflineCleaning@8 +wscIsDefenderAntivirusSupported@4 +wscLuaSettingsFix@4 +wscMakeDefaultProductRequest@4 +wscNotifyUserForNearExpiration@4 +wscOverrideComponentStatus@8 +wscPing@0 +wscProductInfoFree@8 +wscRegisterChangeNotification@8 +wscRegisterSecurityProduct@20 +wscSetDefaultProduct@8 +wscUnRegisterChangeNotification@4 +wscUnregisterSecurityProduct@4 +wscUpdateProductStatus@12 +wscUpdateProductSubStatus@8 diff --git a/lib/libc/mingw/lib32/x3daudio1_2.def b/lib/libc/mingw/lib32/x3daudio1_2.def @@ -5,7 +5,5 @@ ; LIBRARY "X3DAudio1_2.dll" EXPORTS -;_X3DAudioCalculate@20@20 -;_X3DAudioInitialize@12@12 -_X3DAudioCalculate@20 == _X3DAudioCalculate@20 -_X3DAudioInitialize@12 == _X3DAudioInitialize@12 +X3DAudioCalculate@20 == _X3DAudioCalculate@20 +X3DAudioInitialize@12 == _X3DAudioInitialize@12 diff --git a/lib/libc/mingw/lib32/xaudio2_9.def b/lib/libc/mingw/lib32/xaudio2_9.def @@ -9,8 +9,8 @@ XAudio2Create@12 CreateAudioReverb@4 CreateAudioVolumeMeter@4 CreateFX@0 -X3DAudioCalculate@0 -X3DAudioInitialize@0 +X3DAudioCalculate +X3DAudioInitialize CreateAudioReverbV2_8@4 XAudio2CreateV2_9@12 XAudio2CreateWithVersionInfo@16 diff --git a/lib/libc/mingw/lib64/kernel32.def b/lib/libc/mingw/lib64/kernel32.def @@ -0,0 +1,1740 @@ + +LIBRARY "KERNEL32.dll" +EXPORTS +AcquireSRWLockExclusive +AcquireSRWLockShared +ActivateActCtx +ActivateActCtxWorker +ActivatePackageVirtualizationContext +AddAtomA +AddAtomW +AddConsoleAliasA +AddConsoleAliasW +AddDllDirectory +AddIntegrityLabelToBoundaryDescriptor +AddLocalAlternateComputerNameA +AddLocalAlternateComputerNameW +AddRefActCtx +AddRefActCtxWorker +AddResourceAttributeAce +AddSIDToBoundaryDescriptor +AddScopedPolicyIDAce +AddSecureMemoryCacheCallback +AddVectoredContinueHandler +AddVectoredExceptionHandler +AdjustCalendarDate +AllocConsole +AllocateUserPhysicalPages +AllocateUserPhysicalPagesNuma +AppPolicyGetClrCompat +AppPolicyGetCreateFileAccess +AppPolicyGetLifecycleManagement +AppPolicyGetMediaFoundationCodecLoading +AppPolicyGetProcessTerminationMethod +AppPolicyGetShowDeveloperDiagnostic +AppPolicyGetThreadInitializationType +AppPolicyGetWindowingModel +AppXGetOSMaxVersionTested +ApplicationRecoveryFinished +ApplicationRecoveryInProgress +AreFileApisANSI +AreShortNamesEnabled +AssignProcessToJobObject +AttachConsole +BackupRead +BackupSeek +BackupWrite +BaseCheckAppcompatCache +BaseCheckAppcompatCacheEx +BaseCheckAppcompatCacheExWorker +BaseCheckAppcompatCacheWorker +BaseCheckElevation +BaseCheckRunApp +BaseCleanupAppcompatCacheSupport +BaseCleanupAppcompatCacheSupportWorker +BaseDestroyVDMEnvironment +BaseDllReadWriteIniFile +BaseDumpAppcompatCache +BaseDumpAppcompatCacheWorker +BaseElevationPostProcessing +BaseFlushAppcompatCache +BaseFlushAppcompatCacheWorker +BaseFormatObjectAttributes +BaseFormatTimeOut +BaseFreeAppCompatDataForProcessWorker +BaseGenerateAppCompatData +BaseGetNamedObjectDirectory +BaseInitAppcompatCacheSupport +BaseInitAppcompatCacheSupportWorker +BaseIsAppcompatInfrastructureDisabled +BaseIsAppcompatInfrastructureDisabledWorker +BaseIsDosApplication +BaseProcessInitPostImport +BaseProcessStart +BaseQueryModuleData +BaseReadAppCompatDataForProcessWorker +BaseThreadStart +BaseSetLastNTError +BaseThreadInitThunk +BaseUpdateAppcompatCache +BaseUpdateAppcompatCacheWorker +BaseUpdateVDMEntry +BaseVerifyUnicodeString +BaseWriteErrorElevationRequiredEvent +Basep8BitStringToDynamicUnicodeString +BasepAllocateActivationContextActivationBlock +BasepAnsiStringToDynamicUnicodeString +BasepAppContainerEnvironmentExtension +BasepAppXExtension +BasepCheckAppCompat +BasepCheckBadapp +BasepCheckWebBladeHashes +BasepCheckWinSaferRestrictions +BasepConstructSxsCreateProcessMessage +BasepCopyEncryption +BasepFreeActivationContextActivationBlock +BasepFreeAppCompatData +BasepGetAppCompatData +BasepGetComputerNameFromNtPath +BasepGetExeArchType +BasepInitAppCompatData +BasepIsProcessAllowed +BasepMapModuleHandle +BasepNotifyLoadStringResource +BasepPostSuccessAppXExtension +BasepProcessInvalidImage +BasepQueryAppCompat +BasepQueryModuleChpeSettings +BasepReleaseAppXContext +BasepReleaseSxsCreateProcessUtilityStruct +BasepReportFault +BasepSetFileEncryptionCompression +Beep +BeginUpdateResourceA +BeginUpdateResourceW +BindIoCompletionCallback +BuildCommDCBA +BuildCommDCBAndTimeoutsA +BuildCommDCBAndTimeoutsW +BuildCommDCBW +BuildIoRingCancelRequest +BuildIoRingFlushFile +BuildIoRingReadFile +BuildIoRingReadFileScatter +BuildIoRingRegisterBuffers +BuildIoRingRegisterFileHandles +BuildIoRingWriteFile +BuildIoRingWriteFileGather +CallNamedPipeA +CallNamedPipeW +CallbackMayRunLong +CalloutOnFiberStack +CancelDeviceWakeupRequest +CancelIo +CancelIoEx +CancelSynchronousIo +CancelThreadpoolIo +CancelTimerQueueTimer +CancelWaitableTimer +CeipIsOptedIn +ChangeTimerQueueTimer +CheckAllowDecryptedRemoteDestinationPolicy +CheckElevation +CheckElevationEnabled +CheckForReadOnlyResource +CheckForReadOnlyResourceFilter +CheckNameLegalDOS8Dot3A +CheckNameLegalDOS8Dot3W +CheckRemoteDebuggerPresent +CheckTokenCapability +CheckTokenMembershipEx +ClearCommBreak +ClearCommError +CloseConsoleHandle +CloseHandle +CloseIoRing +ClosePackageInfo +ClosePrivateNamespace +CloseProfileUserMapping +ClosePseudoConsole +CloseState +CloseThreadpool +CloseThreadpoolCleanupGroup +CloseThreadpoolCleanupGroupMembers +CloseThreadpoolIo +CloseThreadpoolTimer +CloseThreadpoolWait +CloseThreadpoolWork +CmdBatNotification +CommConfigDialogA +CommConfigDialogW +CompareCalendarDates +CompareFileTime +CompareStringA +CompareStringEx +CompareStringOrdinal +CompareStringW +ConnectNamedPipe +ConsoleIMERoutine +ConsoleMenuControl +ContinueDebugEvent +ConvertCalDateTimeToSystemTime +ConvertDefaultLocale +ConvertFiberToThread +ConvertNLSDayOfWeekToWin32DayOfWeek +ConvertSystemTimeToCalDateTime +ConvertThreadToFiber +ConvertThreadToFiberEx +CopyContext +CopyExtendedContext +CopyFile2 +CopyFileA +CopyFileExA +CopyFileExW +CopyFileTransactedA +CopyFileTransactedW +CopyFileW +CopyLZFile +CreateActCtxA +CreateActCtxW +CreateActCtxWWorker +CreateBoundaryDescriptorA +CreateBoundaryDescriptorW +CreateConsoleScreenBuffer +CreateDirectoryA +CreateDirectoryExA +CreateDirectoryExW +CreateDirectoryTransactedA +CreateDirectoryTransactedW +CreateDirectoryW +CreateEnclave +CreateEventA +CreateEventExA +CreateEventExW +CreateEventW +CreateFiber +CreateFiberEx +CreateFile2 +CreateFileA +CreateFileMappingA +CreateFileMappingFromApp +CreateFileMappingNumaA +CreateFileMappingNumaW +CreateFileMappingW +CreateFileTransactedA +CreateFileTransactedW +CreateFileW +CreateHardLinkA +CreateHardLinkTransactedA +CreateHardLinkTransactedW +CreateHardLinkW +CreateIoCompletionPort +CreateIoRing +CreateJobObjectA +CreateJobObjectW +CreateJobSet +CreateMailslotA +CreateMailslotW +CreateMemoryResourceNotification +CreateMutexA +CreateMutexExA +CreateMutexExW +CreateMutexW +CreateNamedPipeA +CreateNamedPipeW +CreateNlsSecurityDescriptor +CreatePackageVirtualizationContext +CreatePipe +CreatePrivateNamespaceA +CreatePrivateNamespaceW +CreateProcessA +; MSDN says these are exported from ADVAPI32.DLL. +; CreateProcessAsUserA +; CreateProcessAsUserW +CreateProcessInternalA +CreateProcessInternalW +CreateProcessW +CreatePseudoConsole +CreateRemoteThread +CreateRemoteThreadEx +CreateSemaphoreA +CreateSemaphoreExA +CreateSemaphoreExW +CreateSemaphoreW +CreateSymbolicLinkA +CreateSymbolicLinkTransactedA +CreateSymbolicLinkTransactedW +CreateSymbolicLinkW +CreateTapePartition +CreateThread +CreateThreadpool +CreateThreadpoolCleanupGroup +CreateThreadpoolIo +CreateThreadpoolTimer +CreateThreadpoolWait +CreateThreadpoolWork +CreateTimerQueue +CreateTimerQueueTimer +CreateToolhelp32Snapshot +CreateUmsCompletionList +CreateUmsThreadContext +CreateWaitableTimerA +CreateWaitableTimerExA +CreateWaitableTimerExW +CreateWaitableTimerW +CtrlRoutine +DeactivateActCtx +DeactivateActCtxWorker +DeactivatePackageVirtualizationContext +DebugActiveProcess +DebugActiveProcessStop +DebugBreak +DebugBreakProcess +DebugSetProcessKillOnExit +DecodePointer +DecodeSystemPointer +DefineDosDeviceA +DefineDosDeviceW +DelayLoadFailureHook +DeleteAtom +DeleteBoundaryDescriptor +DeleteCriticalSection +DeleteFiber +DeleteFileA +DeleteFileTransactedA +DeleteFileTransactedW +DeleteFileW +DeleteProcThreadAttributeList +DeleteSynchronizationBarrier +DeleteTimerQueue +DeleteTimerQueueEx +DeleteTimerQueueTimer +DeleteUmsCompletionList +DeleteUmsThreadContext +DeleteVolumeMountPointA +DeleteVolumeMountPointW +DequeueUmsCompletionListItems +DeviceIoControl +DisableThreadLibraryCalls +DisableThreadProfiling +DisassociateCurrentThreadFromCallback +DiscardVirtualMemory +DisconnectNamedPipe +DnsHostnameToComputerNameA +DnsHostnameToComputerNameExW +DnsHostnameToComputerNameW +DosDateTimeToFileTime +DosPathToSessionPathA +DosPathToSessionPathW +DuplicateConsoleHandle +DuplicateEncryptionInfoFileExt +DuplicateHandle +DuplicatePackageVirtualizationContext +EnableProcessOptionalXStateFeatures +EnableThreadProfiling +EncodePointer +EncodeSystemPointer +EndUpdateResourceA +EndUpdateResourceW +EnterCriticalSection +EnterUmsSchedulingMode +EnterSynchronizationBarrier +EnumCalendarInfoA +EnumCalendarInfoExA +EnumCalendarInfoExEx +EnumCalendarInfoExW +EnumCalendarInfoW +EnumDateFormatsA +EnumDateFormatsExA +EnumDateFormatsExEx +EnumDateFormatsExW +EnumDateFormatsW +EnumLanguageGroupLocalesA +EnumLanguageGroupLocalesW +EnumResourceLanguagesA +EnumResourceLanguagesExA +EnumResourceLanguagesExW +EnumResourceLanguagesW +EnumResourceNamesA +EnumResourceNamesExA +EnumResourceNamesExW +EnumResourceNamesW +EnumResourceTypesA +EnumResourceTypesExA +EnumResourceTypesExW +EnumResourceTypesW +EnumSystemCodePagesA +EnumSystemCodePagesW +EnumSystemFirmwareTables +EnumSystemGeoID +EnumSystemGeoNames +EnumSystemLanguageGroupsA +EnumSystemLanguageGroupsW +EnumSystemLocalesA +EnumSystemLocalesEx +EnumSystemLocalesW +EnumTimeFormatsA +EnumTimeFormatsEx +EnumTimeFormatsW +EnumUILanguagesA +EnumUILanguagesW +EnumerateLocalComputerNamesA +EnumerateLocalComputerNamesW +EraseTape +EscapeCommFunction +ExecuteUmsThread +ExitProcess +ExitThread +ExitVDM +ExpandEnvironmentStringsA +ExpandEnvironmentStringsW +ExpungeConsoleCommandHistoryA +ExpungeConsoleCommandHistoryW +FatalAppExitA +FatalAppExitW +FatalExit +FileTimeToDosDateTime +FileTimeToLocalFileTime +FileTimeToSystemTime +FillConsoleOutputAttribute +FillConsoleOutputCharacterA +FillConsoleOutputCharacterW +FindActCtxSectionGuid +FindActCtxSectionGuidWorker +FindActCtxSectionStringA +FindActCtxSectionStringW +FindActCtxSectionStringWWorker +FindAtomA +FindAtomW +FindClose +FindCloseChangeNotification +FindFirstChangeNotificationA +FindFirstChangeNotificationW +FindFirstFileA +FindFirstFileExA +FindFirstFileExW +FindFirstFileNameTransactedW +FindFirstFileNameW +FindFirstFileTransactedA +FindFirstFileTransactedW +FindFirstFileW +FindFirstStreamTransactedW +FindFirstStreamW +FindFirstVolumeA +FindFirstVolumeMountPointA +FindFirstVolumeMountPointW +FindFirstVolumeW +FindNLSString +FindNLSStringEx +FindNextChangeNotification +FindNextFileA +FindNextFileNameW +FindNextFileW +FindNextStreamW +FindNextVolumeA +FindNextVolumeMountPointA +FindNextVolumeMountPointW +FindNextVolumeW +FindPackagesByPackageFamily +FindResourceA +FindResourceExA +FindResourceExW +FindResourceW +FindStringOrdinal +FindVolumeClose +FindVolumeMountPointClose +FlsAlloc +FlsFree +FlsGetValue +FlsSetValue +FlushConsoleInputBuffer +FlushFileBuffers +FlushInstructionCache +FlushProcessWriteBuffers +FlushViewOfFile +FoldStringA +FoldStringW +FormatApplicationUserModelId +FormatMessageA +FormatMessageW +FreeConsole +FreeEnvironmentStringsA +FreeEnvironmentStringsW +FreeLibrary +FreeLibraryAndExitThread +FreeLibraryWhenCallbackReturns +FreeMemoryJobObject +FreeResource +FreeUserPhysicalPages +GenerateConsoleCtrlEvent +GetACP +GetActiveProcessorCount +GetActiveProcessorGroupCount +GetAppContainerAce +GetAppContainerNamedObjectPath +GetApplicationRecoveryCallback +GetApplicationRecoveryCallbackWorker +GetApplicationRestartSettings +GetApplicationRestartSettingsWorker +GetApplicationUserModelId +GetAtomNameA +GetAtomNameW +GetBinaryType +GetBinaryTypeA +GetBinaryTypeW +GetCPFileNameFromRegistry +GetCPInfo +GetCPInfoExA +GetCPInfoExW +GetCachedSigningLevel +GetCalendarDateFormat +GetCalendarDateFormatEx +GetCalendarDaysInMonth +GetCalendarDifferenceInDays +GetCalendarInfoA +GetCalendarInfoEx +GetCalendarInfoW +GetCalendarMonthsInYear +GetCalendarSupportedDateRange +GetCalendarWeekNumber +GetComPlusPackageInstallStatus +GetCommConfig +GetCommMask +GetCommModemStatus +GetCommProperties +GetCommState +GetCommTimeouts +GetCommandLineA +GetCommandLineW +GetCompressedFileSizeA +GetCompressedFileSizeTransactedA +GetCompressedFileSizeTransactedW +GetCompressedFileSizeW +GetComputerNameA +GetComputerNameExA +GetComputerNameExW +GetComputerNameW +GetConsoleAliasA +GetConsoleAliasExesA +GetConsoleAliasExesLengthA +GetConsoleAliasExesLengthW +GetConsoleAliasExesW +GetConsoleAliasW +GetConsoleAliasesA +GetConsoleAliasesLengthA +GetConsoleAliasesLengthW +GetConsoleAliasesW +GetConsoleCP +GetConsoleCharType +GetConsoleCommandHistoryA +GetConsoleCommandHistoryLengthA +GetConsoleCommandHistoryLengthW +GetConsoleCommandHistoryW +GetConsoleCursorInfo +GetConsoleCursorMode +GetConsoleDisplayMode +GetConsoleFontInfo +GetConsoleFontSize +GetConsoleHardwareState +GetConsoleHistoryInfo +GetConsoleInputExeNameA +GetConsoleInputExeNameW +GetConsoleInputWaitHandle +GetConsoleKeyboardLayoutNameA +GetConsoleKeyboardLayoutNameW +GetConsoleMode +GetConsoleNlsMode +GetConsoleOriginalTitleA +GetConsoleOriginalTitleW +GetConsoleOutputCP +GetConsoleProcessList +GetConsoleScreenBufferInfo +GetConsoleScreenBufferInfoEx +GetConsoleSelectionInfo +GetConsoleTitleA +GetConsoleTitleW +GetConsoleWindow +GetCurrencyFormatA +GetCurrencyFormatEx +GetCurrencyFormatW +GetCurrentActCtx +GetCurrentActCtxWorker +GetCurrentApplicationUserModelId +GetCurrentConsoleFont +GetCurrentConsoleFontEx +GetCurrentDirectoryA +GetCurrentDirectoryW +GetCurrentPackageFamilyName +GetCurrentPackageFullName +GetCurrentPackageId +GetCurrentPackageInfo +GetCurrentPackagePath +GetCurrentPackageVirtualizationContext +GetCurrentProcess +GetCurrentProcessId +GetCurrentProcessorNumber +GetCurrentProcessorNumberEx +GetCurrentThread +GetCurrentThreadId +GetCurrentThreadStackLimits +GetCurrentUmsThread +GetDateFormatA +GetDateFormatAWorker +GetDateFormatEx +GetDateFormatW +GetDateFormatWWorker +GetDefaultCommConfigA +GetDefaultCommConfigW +GetDefaultSortkeySize +GetDevicePowerState +GetDiskFreeSpaceA +GetDiskFreeSpaceExA +GetDiskFreeSpaceExW +GetDiskFreeSpaceW +GetDiskSpaceInformationA +GetDiskSpaceInformationW +GetDllDirectoryA +GetDllDirectoryW +GetDriveTypeA +GetDriveTypeW +GetDurationFormat +GetDurationFormatEx +GetDynamicTimeZoneInformation +GetEnabledExtendedFeatures +GetEnabledXStateFeatures +GetEncryptedFileVersionExt +GetEnvironmentStrings +GetEnvironmentStringsA +GetEnvironmentStringsW +GetEnvironmentVariableA +GetEnvironmentVariableW +GetEraNameCountedString +GetErrorMode +GetExitCodeProcess +GetExitCodeThread +GetExpandedNameA +GetExpandedNameW +GetExtendedContextLength +GetExtendedFeaturesMask +GetFileAttributesA +GetFileAttributesExA +GetFileAttributesExW +GetFileAttributesTransactedA +GetFileAttributesTransactedW +GetFileAttributesW +GetFileBandwidthReservation +GetFileInformationByHandle +GetFileInformationByHandleEx +GetFileMUIInfo +GetFileMUIPath +GetFileSize +GetFileSizeEx +GetFileTime +GetFileType +GetFinalPathNameByHandleA +GetFinalPathNameByHandleW +GetFirmwareEnvironmentVariableA +GetFirmwareEnvironmentVariableExA +GetFirmwareEnvironmentVariableExW +GetFirmwareEnvironmentVariableW +GetFirmwareType +GetFullPathNameA +GetFullPathNameTransactedA +GetFullPathNameTransactedW +GetFullPathNameW +GetGeoInfoA +GetGeoInfoW +GetGeoInfoEx +GetHandleInformation +GetIoRingInfo +GetLargePageMinimum +GetLargestConsoleWindowSize +GetLastError +GetLinguistLangSize +GetLocalTime +GetLocaleInfoA +GetLocaleInfoEx +GetLocaleInfoW +GetLogicalDriveStringsA +GetLogicalDriveStringsW +GetLogicalDrives +GetLogicalProcessorInformation +GetLogicalProcessorInformationEx +GetLongPathNameA +GetLongPathNameTransactedA +GetLongPathNameTransactedW +GetLongPathNameW +GetMachineTypeAttributes +GetMailslotInfo +GetMaximumProcessorCount +GetMaximumProcessorGroupCount +GetMemoryErrorHandlingCapabilities +GetModuleFileNameA +GetModuleFileNameW +GetModuleHandleA +GetModuleHandleExA +GetModuleHandleExW +GetModuleHandleW +GetNLSVersion +GetNLSVersionEx +GetNamedPipeAttribute +GetNamedPipeClientComputerNameA +GetNamedPipeClientComputerNameW +GetNamedPipeClientProcessId +GetNamedPipeClientSessionId +GetNamedPipeHandleStateA +GetNamedPipeHandleStateW +GetNamedPipeInfo +GetNamedPipeServerProcessId +GetNamedPipeServerSessionId +GetNativeSystemInfo +GetNextUmsListItem +GetNextVDMCommand +GetNlsSectionName +GetNumaAvailableMemoryNode +GetNumaAvailableMemoryNodeEx +GetNumaHighestNodeNumber +GetNumaNodeNumberFromHandle +GetNumaNodeProcessorMask +GetNumaNodeProcessorMask2 +GetNumaNodeProcessorMaskEx +GetNumaProcessorNode +GetNumaProcessorNodeEx +GetNumaProximityNode +GetNumaProximityNodeEx +GetNumberFormatA +GetNumberFormatEx +GetNumberFormatW +GetNumberOfConsoleFonts +GetNumberOfConsoleInputEvents +GetNumberOfConsoleMouseButtons +GetOEMCP +GetOverlappedResult +GetOverlappedResultEx +GetPackageApplicationIds +GetPackageFamilyName +GetPackageFullName +GetPackageId +GetPackageInfo +GetPackagePath +GetPackagePathByFullName +GetPackagesByPackageFamily +GetPhysicallyInstalledSystemMemory +GetPriorityClass +GetPrivateProfileIntA +GetPrivateProfileIntW +GetPrivateProfileSectionA +GetPrivateProfileSectionNamesA +GetPrivateProfileSectionNamesW +GetPrivateProfileSectionW +GetPrivateProfileStringA +GetPrivateProfileStringW +GetPrivateProfileStructA +GetPrivateProfileStructW +GetProcAddress +GetProcessAffinityMask +GetProcessDefaultCpuSetMasks +GetProcessDefaultCpuSets +GetProcessDEPPolicy +GetProcessGroupAffinity +GetProcessHandleCount +GetProcessHeap +GetProcessHeaps +GetProcessId +GetProcessIdOfThread +GetProcessInformation +GetProcessIoCounters +GetProcessMitigationPolicy +GetProcessPreferredUILanguages +GetProcessPriorityBoost +GetProcessShutdownParameters +GetProcessTimes +GetProcessVersion +GetProcessWorkingSetSize +GetProcessWorkingSetSizeEx +GetProcessesInVirtualizationContext +GetProcessorSystemCycleTime +GetProductInfo +GetProfileIntA +GetProfileIntW +GetProfileSectionA +GetProfileSectionW +GetProfileStringA +GetProfileStringW +GetQueuedCompletionStatus +GetQueuedCompletionStatusEx +GetShortPathNameA +GetShortPathNameW +GetStagedPackagePathByFullName +GetStartupInfoA +GetStartupInfoW +GetStateFolder +GetStdHandle +GetStringScripts +GetStringTypeA +GetStringTypeExA +GetStringTypeExW +GetStringTypeW +GetSystemAppDataKey +GetSystemCpuSetInformation +GetSystemDEPPolicy +GetSystemDefaultLCID +GetSystemDefaultLangID +GetSystemDefaultLocaleName +GetSystemDefaultUILanguage +GetSystemDirectoryA +GetSystemDirectoryW +GetSystemFileCacheSize +GetSystemFirmwareTable +GetSystemInfo +GetSystemPowerStatus +GetSystemPreferredUILanguages +GetSystemRegistryQuota +GetSystemTime +GetSystemTimeAdjustment +GetSystemTimeAsFileTime +GetSystemTimePreciseAsFileTime +GetSystemTimes +GetSystemWindowsDirectoryA +GetSystemWindowsDirectoryW +GetSystemWow64DirectoryA +GetSystemWow64DirectoryW +GetTapeParameters +GetTapePosition +GetTapeStatus +GetTempFileNameA +GetTempFileNameW +GetTempPathA +GetTempPathW +GetTempPath2A +GetTempPath2W +GetThreadContext +GetThreadDescription +GetThreadEnabledXStateFeatures +GetThreadErrorMode +GetThreadGroupAffinity +GetThreadIOPendingFlag +GetThreadId +GetThreadIdealProcessorEx +GetThreadInformation +GetThreadLocale +GetThreadPreferredUILanguages +GetThreadPriority +GetThreadPriorityBoost +GetThreadSelectedCpuSetMasks +GetThreadSelectedCpuSets +GetThreadSelectorEntry +GetThreadTimes +GetThreadUILanguage +GetTickCount +GetTickCount64 +GetTimeFormatA +GetTimeFormatAWorker +GetTimeFormatEx +GetTimeFormatW +GetTimeFormatWWorker +GetTimeZoneInformation +GetTimeZoneInformationForYear +GetUILanguageInfo +GetUmsCompletionListEvent +GetUmsSystemThreadInformation +GetUserDefaultGeoName +GetUserDefaultLCID +GetUserDefaultLangID +GetUserDefaultLocaleName +GetUserDefaultUILanguage +GetUserGeoID +GetUserPreferredUILanguages +GetVDMCurrentDirectories +GetVersion +GetVersionExA +GetVersionExW +GetVolumeInformationA +GetVolumeInformationByHandleW +GetVolumeInformationW +GetVolumeNameForVolumeMountPointA +GetVolumeNameForVolumeMountPointW +GetVolumePathNameA +GetVolumePathNameW +GetVolumePathNamesForVolumeNameA +GetVolumePathNamesForVolumeNameW +GetWindowsDirectoryA +GetWindowsDirectoryW +GetWriteWatch +GetXStateFeaturesMask +GlobalAddAtomA +GlobalAddAtomExA +GlobalAddAtomExW +GlobalAddAtomW +GlobalAlloc +GlobalCompact +GlobalDeleteAtom +GlobalFindAtomA +GlobalFindAtomW +GlobalFix +GlobalFlags +GlobalFree +GlobalGetAtomNameA +GlobalGetAtomNameW +GlobalHandle +GlobalLock +GlobalMemoryStatus +GlobalMemoryStatusEx +GlobalReAlloc +GlobalSize +GlobalUnWire +GlobalUnfix +GlobalUnlock +GlobalWire +Heap32First +Heap32ListFirst +Heap32ListNext +Heap32Next +HeapAlloc +HeapCompact +HeapCreate +HeapCreateTagsW +HeapDestroy +HeapExtend +HeapFree +HeapLock +HeapQueryInformation +HeapQueryTagW +HeapReAlloc +HeapSetInformation +HeapSize +HeapSummary +HeapUnlock +HeapUsage +HeapValidate +HeapWalk +IdnToAscii +IdnToNameprepUnicode +IdnToUnicode +InitAtomTable +InitOnceBeginInitialize +InitOnceComplete +InitOnceExecuteOnce +InitOnceInitialize +InitializeConditionVariable +InitializeContext +InitializeContext2 +InitializeCriticalSection +InitializeCriticalSectionAndSpinCount +InitializeCriticalSectionEx +InitializeEnclave +InitializeExtendedContext +InitializeProcThreadAttributeList +InitializeSListHead +InitializeSRWLock +InitializeSynchronizationBarrier +InstallELAMCertificateInfo +InterlockedFlushSList +InterlockedPopEntrySList +InterlockedPushEntrySList +InterlockedPushListSList +InterlockedPushListSListEx +InvalidateConsoleDIBits +IsBadCodePtr +IsBadHugeReadPtr +IsBadHugeWritePtr +IsBadReadPtr +IsBadStringPtrA +IsBadStringPtrW +IsBadWritePtr +IsCalendarLeapDay +IsCalendarLeapMonth +IsCalendarLeapYear +IsDBCSLeadByte +IsDBCSLeadByteEx +IsDebuggerPresent +IsEnclaveTypeSupported +IsIoRingOpSupported +IsNLSDefinedString +IsNativeVhdBoot +IsNormalizedString +IsProcessCritical +IsProcessInJob +IsProcessorFeaturePresent +IsSystemResumeAutomatic +IsThreadAFiber +IsThreadpoolTimerSet +IsTimeZoneRedirectionEnabled +IsUserCetAvailableInEnvironment +IsValidCalDateTime +IsValidCodePage +IsValidLanguageGroup +IsValidLocale +IsValidUILanguage +IsValidLocaleName +IsValidNLSVersion +IsWow64GuestMachineSupported +IsWow64Process +IsWow64Process2 +K32EmptyWorkingSet +K32EnumDeviceDrivers +K32EnumPageFilesA +K32EnumPageFilesW +K32EnumProcessModules +K32EnumProcessModulesEx +K32EnumProcesses +K32GetDeviceDriverBaseNameA +K32GetDeviceDriverBaseNameW +K32GetDeviceDriverFileNameA +K32GetDeviceDriverFileNameW +K32GetMappedFileNameA +K32GetMappedFileNameW +K32GetModuleBaseNameA +K32GetModuleBaseNameW +K32GetModuleFileNameExA +K32GetModuleFileNameExW +K32GetModuleInformation +K32GetPerformanceInfo +K32GetProcessImageFileNameA +K32GetProcessImageFileNameW +K32GetProcessMemoryInfo +K32GetWsChanges +K32GetWsChangesEx +K32InitializeProcessForWsWatch +K32QueryWorkingSet +K32QueryWorkingSetEx +LCIDToLocaleName +LCMapStringA +LCMapStringEx +LCMapStringW +LZClose +LZCloseFile +LZCopy +LZCreateFileW +LZDone +LZInit +LZOpenFileA +LZOpenFileW +LZRead +LZSeek +LZStart +LeaveCriticalSection +LeaveCriticalSectionWhenCallbackReturns +LoadAppInitDlls +LoadEnclaveData +LoadLibraryA +LoadLibraryExA +LoadLibraryExW +LoadLibraryW +LoadModule +LoadPackagedLibrary +LoadResource +LoadStringBaseExW +LoadStringBaseW +LocalAlloc +LocalCompact +LocalFileTimeToFileTime +LocalFileTimeToLocalSystemTime +LocalFlags +LocalFree +LocalHandle +LocalLock +LocalReAlloc +LocalShrink +LocalSize +LocalSystemTimeToLocalFileTime +LocalUnlock +LocaleNameToLCID +LocateExtendedFeature +LocateLegacyContext +LocateXStateFeature +LockFile +LockFileEx +LockResource +MapUserPhysicalPages +MapUserPhysicalPagesScatter +MapViewOfFile +MapViewOfFileEx +MapViewOfFileExNuma +MapViewOfFileFromApp +Module32First +Module32FirstW +Module32Next +Module32NextW +MoveFileA +MoveFileExA +MoveFileExW +MoveFileTransactedA +MoveFileTransactedW +MoveFileW +MoveFileWithProgressA +MoveFileWithProgressW +MulDiv +MultiByteToWideChar +NeedCurrentDirectoryForExePathA +NeedCurrentDirectoryForExePathW +NlsConvertIntegerToString +NlsCheckPolicy +NlsEventDataDescCreate +NlsGetCacheUpdateCount +NlsUpdateLocale +NlsUpdateSystemLocale +NlsResetProcessLocale +NlsWriteEtwEvent +NormalizeString +NotifyMountMgr +NotifyUILanguageChange +NtVdm64CreateProcessInternalW +OOBEComplete +OfferVirtualMemory +OpenConsoleW +OpenConsoleWStub +OpenDataFile +OpenEventA +OpenEventW +OpenFile +OpenFileById +OpenFileMappingA +OpenFileMappingW +OpenJobObjectA +OpenJobObjectW +OpenMutexA +OpenMutexW +OpenPackageInfoByFullName +OpenPrivateNamespaceA +OpenPrivateNamespaceW +OpenProcess +; MSDN says OpenProcessToken is from Advapi32.dll, not Kernel32.dll +; OpenProcessToken +OpenProfileUserMapping +OpenSemaphoreA +OpenSemaphoreW +OpenState +OpenStateExplicit +OpenThread +; MSDN says this is exported from ADVAPI32.DLL. +; OpenThreadToken +OpenWaitableTimerA +OpenWaitableTimerW +OutputDebugStringA +OutputDebugStringW +PackageFamilyNameFromFullName +PackageFamilyNameFromId +PackageFullNameFromId +PackageIdFromFullName +PackageNameAndPublisherIdFromFamilyName +ParseApplicationUserModelId +PeekConsoleInputA +PeekConsoleInputW +PeekNamedPipe +PopIoRingCompletion +PostQueuedCompletionStatus +PowerClearRequest +PowerCreateRequest +PowerSetRequest +PrefetchVirtualMemory +PrepareTape +PrivCopyFileExW +PrivMoveFileIdentityW +Process32First +Process32FirstW +Process32Next +Process32NextW +ProcessIdToSessionId +PssCaptureSnapshot +PssDuplicateSnapshot +PssFreeSnapshot +PssQuerySnapshot +PssWalkMarkerCreate +PssWalkMarkerFree +PssWalkMarkerGetPosition +PssWalkMarkerRewind +PssWalkMarkerSeek +PssWalkMarkerSeekToBeginning +PssWalkMarkerSetPosition +PssWalkMarkerTell +PssWalkSnapshot +PulseEvent +PurgeComm +QueryActCtxSettingsW +QueryActCtxSettingsWWorker +QueryActCtxW +QueryActCtxWWorker +QueryDepthSList +QueryDosDeviceA +QueryDosDeviceW +QueryFullProcessImageNameA +QueryFullProcessImageNameW +QueryIdleProcessorCycleTime +QueryIdleProcessorCycleTimeEx +QueryInformationJobObject +QueryIoRateControlInformationJobObject +QueryIoRingCapabilities +QueryMemoryResourceNotification +QueryPerformanceCounter +QueryPerformanceFrequency +QueryProcessAffinityUpdateMode +QueryProcessCycleTime +QueryProtectedPolicy +QueryThreadCycleTime +QueryThreadProfiling +QueryThreadpoolStackInformation +QueryUmsThreadInformation +QueryUnbiasedInterruptTime +QueueUserAPC +QueueUserAPC2 +QueueUserWorkItem +QuirkGetData2Worker +QuirkGetDataWorker +QuirkIsEnabled2Worker +QuirkIsEnabled3Worker +QuirkIsEnabledForPackage2Worker +QuirkIsEnabledForPackage3Worker +QuirkIsEnabledForPackage4Worker +QuirkIsEnabledForPackageWorker +QuirkIsEnabledForProcessWorker +QuirkIsEnabledWorker +RaiseException +RaiseFailFastException +RaiseInvalid16BitExeError +ReOpenFile +ReclaimVirtualMemory +ReadConsoleA +ReadConsoleInputA +ReadConsoleInputExA +ReadConsoleInputExW +ReadConsoleInputW +ReadConsoleOutputA +ReadConsoleOutputAttribute +ReadConsoleOutputCharacterA +ReadConsoleOutputCharacterW +ReadConsoleOutputW +ReadConsoleW +ReadDirectoryChangesExW +ReadDirectoryChangesW +ReadFile +ReadFileEx +ReadFileScatter +ReadProcessMemory +ReadThreadProfilingData +; +; MSDN says these functions are exported +; from advapi32.dll. Commented out for +; compatibility with older versions of +; Windows. +; +; RegKrnGetGlobalState and RegKrnInitialize +; are known exceptions. +; +;RegCloseKey +;RegCopyTreeW +;RegCreateKeyExA +;RegCreateKeyExW +;RegDeleteKeyExA +;RegDeleteKeyExW +;RegDeleteTreeA +;RegDeleteTreeW +;RegDeleteValueA +;RegDeleteValueW +;RegDisablePredefinedCacheEx +;RegEnumKeyExA +;RegEnumKeyExW +;RegEnumValueA +;RegEnumValueW +;RegFlushKey +;RegGetKeySecurity +;RegGetValueA +;RegGetValueW +RegKrnGetGlobalState +RegKrnInitialize +;RegLoadKeyA +;RegLoadKeyW +;RegLoadMUIStringA +;RegLoadMUIStringW +;RegNotifyChangeKeyValue +;RegOpenCurrentUser +;RegOpenKeyExA +;RegOpenKeyExW +;RegOpenUserClassesRoot +;RegQueryInfoKeyA +;RegQueryInfoKeyW +;RegQueryValueExA +;RegQueryValueExW +;RegRestoreKeyA +;RegRestoreKeyW +;RegSaveKeyExA +;RegSaveKeyExW +;RegSetKeySecurity +;RegSetValueExA +;RegSetValueExW +;RegUnLoadKeyA +;RegUnLoadKeyW +RegisterApplicationRecoveryCallback +RegisterApplicationRestart +RegisterBadMemoryNotification +RegisterConsoleIME +RegisterConsoleOS2 +RegisterConsoleVDM +RegisterWaitForInputIdle +RegisterWaitForSingleObject +RegisterWaitForSingleObjectEx +RegisterWaitUntilOOBECompleted +RegisterWowBaseHandlers +RegisterWowExec +ReleaseActCtx +ReleaseActCtxWorker +ReleaseMutex +ReleaseMutexWhenCallbackReturns +ReleasePackageVirtualizationContext +ReleaseSRWLockExclusive +ReleaseSRWLockShared +ReleaseSemaphore +ReleaseSemaphoreWhenCallbackReturns +RemoveDirectoryA +RemoveDirectoryTransactedA +RemoveDirectoryTransactedW +RemoveDirectoryW +RemoveDllDirectory +RemoveLocalAlternateComputerNameA +RemoveLocalAlternateComputerNameW +RemoveSecureMemoryCacheCallback +RemoveVectoredContinueHandler +RemoveVectoredExceptionHandler +ReplaceFile +ReplaceFileA +ReplaceFileW +ReplacePartitionUnit +RequestDeviceWakeup +RequestWakeupLatency +ResetEvent +ResetWriteWatch +ResizePseudoConsole +ResolveDelayLoadedAPI +ResolveDelayLoadsFromDll +ResolveLocaleName +RestoreLastError +ResumeThread +RtlAddFunctionTable +RtlCaptureContext +RtlCaptureStackBackTrace +RtlCompareMemory +RtlCopyMemory +RtlDeleteFunctionTable +RtlFillMemory +RtlInstallFunctionTableCallback +RtlIsEcCode +RtlLookupFunctionEntry +RtlMoveMemory +RtlPcToFileHeader +RtlRaiseException +RtlRestoreContext +RtlUnwind +RtlUnwindEx +RtlVirtualUnwind +RtlVirtualUnwind2 +RtlZeroMemory +ScrollConsoleScreenBufferA +ScrollConsoleScreenBufferW +SearchPathA +SearchPathW +SetCachedSigningLevel +SetCPGlobal +SetCalendarInfoA +SetCalendarInfoW +SetComPlusPackageInstallStatus +SetCommBreak +SetCommConfig +SetCommMask +SetCommState +SetCommTimeouts +SetComputerNameA +SetComputerNameEx2W +SetComputerNameExA +SetComputerNameExW +SetComputerNameW +SetConsoleActiveScreenBuffer +SetConsoleCP +SetConsoleCommandHistoryMode +SetConsoleCtrlHandler +SetConsoleCursor +SetConsoleCursorInfo +SetConsoleCursorMode +SetConsoleCursorPosition +SetConsoleDisplayMode +SetConsoleFont +SetConsoleHardwareState +SetConsoleHistoryInfo +SetConsoleIcon +SetConsoleInputExeNameA +SetConsoleInputExeNameW +SetConsoleKeyShortcuts +SetConsoleLocalEUDC +SetConsoleMaximumWindowSize +SetConsoleMenuClose +SetConsoleMode +SetConsoleNlsMode +SetConsoleNumberOfCommandsA +SetConsoleNumberOfCommandsW +SetConsoleOS2OemFormat +SetConsoleOutputCP +SetConsolePalette +SetConsoleScreenBufferInfoEx +SetConsoleScreenBufferSize +SetConsoleTextAttribute +SetConsoleTitleA +SetConsoleTitleW +SetConsoleWindowInfo +SetCriticalSectionSpinCount +SetCurrentConsoleFontEx +SetCurrentDirectoryA +SetCurrentDirectoryW +SetDefaultCommConfigA +SetDefaultCommConfigW +SetDefaultDllDirectories +SetDllDirectoryA +SetDllDirectoryW +SetDynamicTimeZoneInformation +SetEndOfFile +SetEnvironmentStringsA +SetEnvironmentStringsW +SetEnvironmentVariableA +SetEnvironmentVariableW +SetErrorMode +SetEvent +SetEventWhenCallbackReturns +SetExtendedFeaturesMask +SetFileApisToANSI +SetFileApisToOEM +SetFileAttributesA +SetFileAttributesTransactedA +SetFileAttributesTransactedW +SetFileAttributesW +SetFileBandwidthReservation +SetFileCompletionNotificationModes +SetFileInformationByHandle +SetFileIoOverlappedRange +SetFilePointer +SetFilePointerEx +SetFileShortNameA +SetFileShortNameW +SetFileTime +SetFileValidData +SetFirmwareEnvironmentVariableA +SetFirmwareEnvironmentVariableExA +SetFirmwareEnvironmentVariableExW +SetFirmwareEnvironmentVariableW +SetHandleCount +SetHandleInformation +SetInformationJobObject +SetIoRateControlInformationJobObject +SetIoRingCompletionEvent +SetLastConsoleEventActive +SetLastError +SetLocalPrimaryComputerNameA +SetLocalPrimaryComputerNameW +SetLocalTime +SetLocaleInfoA +SetLocaleInfoW +SetMailslotInfo +SetMessageWaitingIndicator +SetNamedPipeAttribute +SetNamedPipeHandleState +SetPriorityClass +SetProcessAffinityMask +SetProcessAffinityUpdateMode +SetProcessDEPPolicy +SetProcessDefaultCpuSetMasks +SetProcessDefaultCpuSets +SetProcessDynamicEHContinuationTargets +SetProcessDynamicEnforcedCetCompatibleRanges +SetProcessInformation +SetProcessMitigationPolicy +SetProcessPreferredUILanguages +SetProcessPriorityBoost +SetProcessShutdownParameters +SetProcessWorkingSetSize +SetProcessWorkingSetSizeEx +SetProtectedPolicy +SetSearchPathMode +SetStdHandle +SetStdHandleEx +SetSystemFileCacheSize +SetSystemPowerState +SetSystemTime +SetSystemTimeAdjustment +SetTapeParameters +SetTapePosition +SetTermsrvAppInstallMode +SetThreadAffinityMask +SetThreadContext +SetThreadDescription +SetThreadErrorMode +SetThreadExecutionState +SetThreadGroupAffinity +SetThreadIdealProcessor +SetThreadIdealProcessorEx +SetThreadInformation +SetThreadLocale +SetThreadPreferredUILanguages +SetThreadPriority +SetThreadPriorityBoost +SetThreadSelectedCpuSetMasks +SetThreadSelectedCpuSets +SetThreadStackGuarantee +; MSDN says this is exported from ADVAPI32.DLL. +; SetThreadToken +SetThreadUILanguage +SetThreadpoolStackInformation +SetThreadpoolThreadMaximum +SetThreadpoolThreadMinimum +SetThreadpoolTimer +SetThreadpoolTimerEx +SetThreadpoolWait +SetThreadpoolWaitEx +SetTimeZoneInformation +SetTimerQueueTimer +SetUmsThreadInformation +SetUnhandledExceptionFilter +SetUserGeoID +SetUserGeoName +SetVDMCurrentDirectories +SetVolumeLabelA +SetVolumeLabelW +SetVolumeMountPointA +SetVolumeMountPointW +SetVolumeMountPointWStub +SetWaitableTimer +SetWaitableTimerEx +SetXStateFeaturesMask +SetupComm +ShowConsoleCursor +SignalObjectAndWait +SizeofResource +Sleep +SleepConditionVariableCS +SleepConditionVariableSRW +SleepEx +SortCloseHandle +SortGetHandle +StartThreadpoolIo +SubmitIoRing +SubmitThreadpoolWork +SuspendThread +SwitchToFiber +SwitchToThread +SystemTimeToFileTime +SystemTimeToTzSpecificLocalTime +SystemTimeToTzSpecificLocalTimeEx +TerminateJobObject +TerminateProcess +TerminateThread +TermsrvAppInstallMode +TermsrvConvertSysRootToUserDir +TermsrvCreateRegEntry +TermsrvDeleteKey +TermsrvDeleteValue +TermsrvGetPreSetValue +TermsrvGetWindowsDirectoryA +TermsrvGetWindowsDirectoryW +TermsrvOpenRegEntry +TermsrvOpenUserClasses +TermsrvRestoreKey +TermsrvSetKeySecurity +TermsrvSetValueKey +TermsrvSyncUserIniFileExt +Thread32First +Thread32Next +TlsAlloc +TlsFree +TlsGetValue +TlsSetValue +Toolhelp32ReadProcessMemory +TransactNamedPipe +TransmitCommChar +TryAcquireSRWLockExclusive +TryAcquireSRWLockShared +TryEnterCriticalSection +TrySubmitThreadpoolCallback +TzSpecificLocalTimeToSystemTime +TzSpecificLocalTimeToSystemTimeEx +UTRegister +UTUnRegister +UmsThreadYield +UnhandledExceptionFilter +UnlockFile +UnlockFileEx +UnmapViewOfFile +UnmapViewOfFileEx +UnregisterApplicationRecoveryCallback +UnregisterApplicationRestart +UnregisterBadMemoryNotification +UnregisterConsoleIME +UnregisterWait +UnregisterWaitEx +UnregisterWaitUntilOOBECompleted +UpdateCalendarDayOfWeek +UpdateProcThreadAttribute +UpdateResourceA +UpdateResourceW +VDMConsoleOperation +VDMOperationStarted +ValidateLCType +ValidateLocale +VerLanguageNameA +VerLanguageNameW +VerSetConditionMask +VerifyConsoleIoHandle +VerifyScripts +VerifyVersionInfoA +VerifyVersionInfoW +VirtualAlloc +VirtualAllocEx +VirtualAllocExNuma +VirtualFree +VirtualFreeEx +VirtualLock +VirtualProtect +VirtualProtectEx +VirtualQuery +VirtualQueryEx +VirtualUnlock +WTSGetActiveConsoleSessionId +WaitCommEvent +WaitForDebugEvent +WaitForDebugEventEx +WaitForMultipleObjects +WaitForMultipleObjectsEx +WaitForSingleObject +WaitForSingleObjectEx +WaitForThreadpoolIoCallbacks +WaitForThreadpoolTimerCallbacks +WaitForThreadpoolWaitCallbacks +WaitForThreadpoolWorkCallbacks +WaitNamedPipeA +WaitNamedPipeW +WakeAllConditionVariable +; MSDN says it's in Kernel32.dll but it's not. +; Link with libsynchronization.a instead. +; Commented out for compatibility with older +; versions of Windows. +;WaitOnAddress +;WakeByAddressSingle +;WakeByAddressAll +WakeConditionVariable +WerGetFlags +WerGetFlagsWorker +WerRegisterAdditionalProcess +WerRegisterAppLocalDump +WerRegisterCustomMetadata +WerRegisterExcludedMemoryBlock +WerRegisterFile +WerRegisterFileWorker +WerRegisterMemoryBlock +WerRegisterMemoryBlockWorker +WerRegisterRuntimeExceptionModule +WerRegisterRuntimeExceptionModuleWorker +WerSetFlags +WerSetFlagsWorker +WerUnregisterAdditionalProcess +WerUnregisterAppLocalDump +WerUnregisterCustomMetadata +WerUnregisterExcludedMemoryBlock +WerUnregisterFile +WerUnregisterFileWorker +WerUnregisterMemoryBlock +WerUnregisterMemoryBlockWorker +WerUnregisterRuntimeExceptionModule +WerUnregisterRuntimeExceptionModuleWorker +WerpCleanupMessageMapping +WerpGetDebugger +WerpInitiateRemoteRecovery +WerpLaunchAeDebug +WerpNotifyLoadStringResource +WerpNotifyLoadStringResourceEx +WerpNotifyLoadStringResourceWorker +WerpNotifyUseStringResource +WerpNotifyUseStringResourceWorker +WerpStringLookup +WideCharToMultiByte +WinExec +Wow64DisableWow64FsRedirection +Wow64EnableWow64FsRedirection +Wow64GetThreadContext +Wow64GetThreadSelectorEntry +Wow64RevertWow64FsRedirection +Wow64SetThreadContext +Wow64SuspendThread +WriteConsoleA +WriteConsoleInputA +WriteConsoleInputVDMA +WriteConsoleInputVDMW +WriteConsoleInputW +WriteConsoleOutputA +WriteConsoleOutputAttribute +WriteConsoleOutputCharacterA +WriteConsoleOutputCharacterW +WriteConsoleOutputW +WriteConsoleW +WriteFile +WriteFileEx +WriteFileGather +WritePrivateProfileSectionA +WritePrivateProfileSectionW +WritePrivateProfileStringA +WritePrivateProfileStringW +WritePrivateProfileStructA +WritePrivateProfileStructW +WriteProcessMemory +WriteProfileSectionA +WriteProfileSectionW +WriteProfileStringA +WriteProfileStringW +WriteTapemark +ZombifyActCtx +ZombifyActCtxWorker +__C_specific_handler +; This isn't always available and shouldn't be linked from here, but should +; be statically linked from the compiler support library. +; +__misaligned_access +_hread +_hwrite +_lclose +_lcreat +_llseek +_local_unwind +_lopen +_lread +_lwrite +lstrcat +lstrcatA +lstrcatW +lstrcmp +lstrcmpA +lstrcmpW +lstrcmpi +lstrcmpiA +lstrcmpiW +lstrcpy +lstrcpyA +lstrcpyW +lstrcpyn +lstrcpynA +lstrcpynW +lstrlen +lstrlenA +lstrlenW +; +; MSDN says these functions are exported +; from winmm.dll. Commented out for +; compatibility with older versions of +; Windows. +; +;timeBeginPeriod +;timeEndPeriod +;timeGetDevCaps +;timeGetSystemTime +;timeGetTime +uaw_lstrcmpW +uaw_lstrcmpiW +uaw_lstrlenW +uaw_wcschr +uaw_wcscpy +uaw_wcsicmp +uaw_wcslen +uaw_wcsrchr diff --git a/lib/libc/mingw/lib64/winhvplatform.def b/lib/libc/mingw/lib64/winhvplatform.def @@ -1,68 +0,0 @@ -LIBRARY "winhvplatform.dll" -EXPORTS -WHvAcceptPartitionMigration -WHvAdviseGpaRange -WHvAllocateVpciResource -WHvCancelPartitionMigration -WHvCancelRunVirtualProcessor -WHvCompletePartitionMigration -WHvCreateNotificationPort -WHvCreatePartition -WHvCreateTrigger -WHvCreateVirtualProcessor -WHvCreateVirtualProcessor2 -WHvCreateVpciDevice -WHvDeleteNotificationPort -WHvDeletePartition -WHvDeleteTrigger -WHvDeleteVirtualProcessor -WHvDeleteVpciDevice -WHvGetCapability -WHvGetInterruptTargetVpSet -WHvGetPartitionCounters -WHvGetPartitionProperty -WHvGetVirtualProcessorCounters -WHvGetVirtualProcessorCpuidOutput -WHvGetVirtualProcessorInterruptControllerState -WHvGetVirtualProcessorInterruptControllerState2 -WHvGetVirtualProcessorRegisters -WHvGetVirtualProcessorState -WHvGetVirtualProcessorXsaveState -WHvGetVpciDeviceInterruptTarget -WHvGetVpciDeviceNotification -WHvGetVpciDeviceProperty -WHvMapGpaRange -WHvMapGpaRange2 -WHvMapVpciDeviceInterrupt -WHvMapVpciDeviceMmioRanges -WHvPostVirtualProcessorSynicMessage -WHvQueryGpaRangeDirtyBitmap -WHvReadGpaRange -WHvReadVpciDeviceRegister -WHvRegisterPartitionDoorbellEvent -WHvRequestInterrupt -WHvRequestVpciDeviceInterrupt -WHvResetPartition -WHvResumePartitionTime -WHvRetargetVpciDeviceInterrupt -WHvRunVirtualProcessor -WHvSetNotificationPortProperty -WHvSetPartitionProperty -WHvSetVirtualProcessorInterruptControllerState -WHvSetVirtualProcessorInterruptControllerState2 -WHvSetVirtualProcessorRegisters -WHvSetVirtualProcessorState -WHvSetVirtualProcessorXsaveState -WHvSetVpciDevicePowerState -WHvSetupPartition -WHvSignalVirtualProcessorSynicEvent -WHvStartPartitionMigration -WHvSuspendPartitionTime -WHvTranslateGva -WHvUnmapGpaRange -WHvUnmapVpciDeviceInterrupt -WHvUnmapVpciDeviceMmioRanges -WHvUnregisterPartitionDoorbellEvent -WHvUpdateTriggerParameters -WHvWriteGpaRange -WHvWriteVpciDeviceRegister diff --git a/lib/libc/mingw/lib64/wintrust.def b/lib/libc/mingw/lib64/wintrust.def @@ -1,136 +0,0 @@ -; -; Exports of file WINTRUST.dll -; -; Autogenerated by gen_exportdef -; Written by Kai Tietz, 2007 -; -LIBRARY WINTRUST.dll -EXPORTS -CryptCATVerifyMember -CryptSIPGetInfo -CryptSIPGetRegWorkingFlags -GenericChainCertificateTrust -GenericChainFinalProv -HTTPSCertificateTrust -SoftpubDefCertInit -SoftpubFreeDefUsageCallData -SoftpubLoadDefUsageCallData -WTHelperCertFindIssuerCertificate -AddPersonalTrustDBPages -CatalogCompactHashDatabase -CryptCATAdminAcquireContext -CryptCATAdminAddCatalog -CryptCATAdminCalcHashFromFileHandle -CryptCATAdminEnumCatalogFromHash -CryptCATAdminPauseServiceForBackup -CryptCATAdminReleaseCatalogContext -CryptCATAdminReleaseContext -CryptCATAdminRemoveCatalog -CryptCATAdminResolveCatalogPath -CryptCATCDFClose -CryptCATCDFEnumAttributes -CryptCATCDFEnumAttributesWithCDFTag -CryptCATCDFEnumCatAttributes -CryptCATCDFEnumMembers -CryptCATCDFEnumMembersByCDFTag -CryptCATCDFEnumMembersByCDFTagEx -CryptCATCDFOpen -CryptCATCatalogInfoFromContext -CryptCATClose -CryptCATEnumerateAttr -CryptCATEnumerateCatAttr -CryptCATEnumerateMember -CryptCATGetAttrInfo -CryptCATGetCatAttrInfo -CryptCATGetMemberInfo -CryptCATHandleFromStore -CryptCATOpen -CryptCATPersistStore -CryptCATPutAttrInfo -CryptCATPutCatAttrInfo -CryptCATPutMemberInfo -CryptCATStoreFromHandle -CryptSIPCreateIndirectData -CryptSIPGetSignedDataMsg -CryptSIPPutSignedDataMsg -CryptSIPRemoveSignedDataMsg -CryptSIPVerifyIndirectData -DllRegisterServer -DllUnregisterServer -DriverCleanupPolicy -DriverFinalPolicy -DriverInitializePolicy -FindCertsByIssuer -HTTPSFinalProv -I_CryptCatAdminMigrateToNewCatDB -IsCatalogFile -MsCatConstructHashTag -MsCatFreeHashTag -OfficeCleanupPolicy -OfficeInitializePolicy -OpenPersonalTrustDBDialog -OpenPersonalTrustDBDialogEx -SoftpubAuthenticode -SoftpubCheckCert -SoftpubCleanup -SoftpubDllRegisterServer -SoftpubDllUnregisterServer -SoftpubDumpStructure -SoftpubInitialize -SoftpubLoadMessage -SoftpubLoadSignature -TrustDecode -TrustFindIssuerCertificate -TrustFreeDecode -TrustIsCertificateSelfSigned -TrustOpenStores -WTHelperCertCheckValidSignature -WTHelperCertIsSelfSigned -WTHelperCheckCertUsage -WTHelperGetAgencyInfo -WTHelperGetFileHandle -WTHelperGetFileHash -WTHelperGetFileName -WTHelperGetKnownUsages -WTHelperGetProvCertFromChain -WTHelperGetProvPrivateDataFromChain -WTHelperGetProvSignerFromChain -WTHelperIsInRootStore -WTHelperOpenKnownStores -WTHelperProvDataFromStateData -WVTAsn1CatMemberInfoDecode -WVTAsn1CatMemberInfoEncode -WVTAsn1CatNameValueDecode -WVTAsn1CatNameValueEncode -WVTAsn1SpcFinancialCriteriaInfoDecode -WVTAsn1SpcFinancialCriteriaInfoEncode -WVTAsn1SpcIndirectDataContentDecode -WVTAsn1SpcIndirectDataContentEncode -WVTAsn1SpcLinkDecode -WVTAsn1SpcLinkEncode -WVTAsn1SpcMinimalCriteriaInfoDecode -WVTAsn1SpcMinimalCriteriaInfoEncode -WVTAsn1SpcPeImageDataDecode -WVTAsn1SpcPeImageDataEncode -WVTAsn1SpcSigInfoDecode -WVTAsn1SpcSigInfoEncode -WVTAsn1SpcSpAgencyInfoDecode -WVTAsn1SpcSpAgencyInfoEncode -WVTAsn1SpcSpOpusInfoDecode -WVTAsn1SpcSpOpusInfoEncode -WVTAsn1SpcStatementTypeDecode -WVTAsn1SpcStatementTypeEncode -WinVerifyTrust -WinVerifyTrustEx -WintrustAddActionID -WintrustAddDefaultForUsage -WintrustCertificateTrust -WintrustGetDefaultForUsage -WintrustGetRegPolicyFlags -WintrustLoadFunctionPointers -WintrustRemoveActionID -WintrustSetRegPolicyFlags -mscat32DllRegisterServer -mscat32DllUnregisterServer -mssip32DllRegisterServer -mssip32DllUnregisterServer diff --git a/lib/libc/mingw/lib64/ws2_32.def b/lib/libc/mingw/lib64/ws2_32.def @@ -0,0 +1,200 @@ + +LIBRARY "WS2_32.dll" +EXPORTS +accept +bind +closesocket +connect +getpeername +getsockname +getsockopt +htonl +htons +ioctlsocket +inet_addr +inet_ntoa +listen +ntohl +ntohs +recv +recvfrom +select +send +sendto +setsockopt +shutdown +socket +WSApSetPostRoutine +FreeAddrInfoEx +FreeAddrInfoExW +FreeAddrInfoW +GetAddrInfoExA +GetAddrInfoExCancel +GetAddrInfoExOverlappedResult +GetAddrInfoExW +GetAddrInfoW +GetHostNameW +GetNameInfoW +InetNtopW +InetPtonW +ProcessSocketNotifications +SetAddrInfoExA +SetAddrInfoExW +WPUCompleteOverlappedRequest +WPUGetProviderPathEx +WSAAccept +WSAAddressToStringA +WSAAddressToStringW +WSAAdvertiseProvider +WSACloseEvent +WSAConnect +WSAConnectByList +WSAConnectByNameA +WSAConnectByNameW +WSACreateEvent +gethostbyaddr +gethostbyname +getprotobyname +getprotobynumber +getservbyname +getservbyport +gethostname +WSADuplicateSocketA +WSADuplicateSocketW +WSAEnumNameSpaceProvidersA +WSAEnumNameSpaceProvidersExA +WSAEnumNameSpaceProvidersExW +WSAEnumNameSpaceProvidersW +WSAEnumNetworkEvents +WSAEnumProtocolsA +WSAEnumProtocolsW +WSAEventSelect +WSAGetOverlappedResult +WSAGetQOSByName +WSAGetServiceClassInfoA +WSAGetServiceClassInfoW +WSAGetServiceClassNameByClassIdA +WSAGetServiceClassNameByClassIdW +WSAHtonl +WSAHtons +WSAInstallServiceClassA +WSAInstallServiceClassW +WSAIoctl +WSAJoinLeaf +WSALookupServiceBeginA +WSALookupServiceBeginW +WSALookupServiceEnd +WSALookupServiceNextA +WSALookupServiceNextW +WSANSPIoctl +WSANtohl +WSANtohs +WSAPoll +WSAProviderCompleteAsyncCall +WSAProviderConfigChange +WSARecv +WSARecvDisconnect +WSARecvFrom +WSARemoveServiceClass +WSAResetEvent +WSASend +WSASendDisconnect +WSASendMsg +WSASendTo +WSASetEvent +WSAAsyncSelect +WSAAsyncGetHostByAddr +WSAAsyncGetHostByName +WSAAsyncGetProtoByNumber +WSAAsyncGetProtoByName +WSAAsyncGetServByPort +WSAAsyncGetServByName +WSACancelAsyncRequest +WSASetBlockingHook +WSAUnhookBlockingHook +WSAGetLastError +WSASetLastError +WSACancelBlockingCall +WSAIsBlocking +WSAStartup +WSACleanup +WSASetServiceA +WSASetServiceW +WSASocketA +WSASocketW +WSAStringToAddressA +WSAStringToAddressW +WSAUnadvertiseProvider +WSAWaitForMultipleEvents +WSCDeinstallProvider +WSCDeinstallProvider32 +WSCDeinstallProviderEx +WSCEnableNSProvider +WSCEnableNSProvider32 +WSCEnumNameSpaceProviders32 +WSCEnumNameSpaceProvidersEx32 +WSCEnumProtocols +WSCEnumProtocolsEx +WSCEnumProtocols32 +WSCGetApplicationCategory +WSCGetApplicationCategoryEx +WSCGetProviderInfo +WSCGetProviderInfo32 +WSCGetProviderPath +WSCGetProviderPath32 +WSCInstallNameSpace +WSCInstallNameSpace32 +WSCInstallNameSpaceEx +WSCInstallNameSpaceEx2 +WSCInstallNameSpaceEx32 +WSCInstallProvider +WSCInstallProvider64_32 +WSCInstallProviderAndChains +WSCInstallProviderAndChains64_32 +WSCInstallProviderEx +WSCSetApplicationCategory +WSCSetApplicationCategoryEx +WSCSetProviderInfo +WSCSetProviderInfo32 +WSCUnInstallNameSpace +WSCUnInstallNameSpace32 +WSCUnInstallNameSpaceEx2 +WSCUpdateProvider +WSCUpdateProvider32 +WSCUpdateProviderEx +WSCWriteNameSpaceOrder +WSCWriteNameSpaceOrder32 +WSCWriteProviderOrder +WSCWriteProviderOrder32 +WSCWriteProviderOrderEx +WahCloseApcHelper +__WSAFDIsSet +WahCloseHandleHelper +WahCloseNotificationHandleHelper +WahCloseSocketHandle +WahCloseThread +WahCompleteRequest +WahCreateHandleContextTable +WahCreateNotificationHandle +WahCreateSocketHandle +WahDestroyHandleContextTable +WahDisableNonIFSHandleSupport +WahEnableNonIFSHandleSupport +WahEnumerateHandleContexts +WahInsertHandleContext +WahNotifyAllProcesses +WahOpenApcHelper +WahOpenCurrentThread +WahOpenHandleHelper +WahOpenNotificationHandleHelper +WahQueueUserApc +WahReferenceContextByHandle +WahRemoveHandleContext +WahWaitForNotification +WahWriteLSPEvent +freeaddrinfo +getaddrinfo +getnameinfo +inet_ntop +inet_pton +WEP diff --git a/lib/libc/mingw/libarm32/bcryptprimitives.def b/lib/libc/mingw/libarm32/bcryptprimitives.def @@ -1,15 +0,0 @@ -; -; Definition file of bcryptPrimitives.dll -; Automatic generated by gendef -; written by Kai Tietz 2008-2014 -; -LIBRARY "bcryptPrimitives.dll" -EXPORTS -GetAsymmetricEncryptionInterface -GetCipherInterface -GetHashInterface -GetKeyDerivationInterface -GetRngInterface -GetSecretAgreementInterface -GetSignatureInterface -ProcessPrng diff --git a/lib/libc/mingw/libarm32/kernelbase.def b/lib/libc/mingw/libarm32/kernelbase.def @@ -1886,10 +1886,10 @@ _exit _initterm _initterm_e _invalid_parameter -_onexit +; _onexit ; disable _onexit for compatibility with DLL builds, real _onexit function provided by mingw-w64 _purecall _time64 -atexit +_crt_atexit == atexit ; rename atexit to _crt_atexit for compatibility with UCRT, real atexit function provided by mingw-w64 exit hgets hwprintf diff --git a/lib/libc/mingw/libarm32/ninput.def b/lib/libc/mingw/libarm32/ninput.def @@ -1,37 +0,0 @@ -; -; Definition file of NInput.dll -; Automatic generated by gendef -; written by Kai Tietz 2008-2014 -; -LIBRARY "NInput.dll" -EXPORTS -DefaultInputHandler -AddPointerInteractionContext -BufferPointerPacketsInteractionContext -CreateInteractionContext -DestroyInteractionContext -GetCrossSlideParameterInteractionContext -GetInertiaParameterInteractionContext -GetInteractionConfigurationInteractionContext -GetMouseWheelParameterInteractionContext -GetPropertyInteractionContext -GetStateInteractionContext -ProcessBufferedPacketsInteractionContext -ProcessInertiaInteractionContext -ProcessPointerFramesInteractionContext -RegisterOutputCallbackInteractionContext -RemovePointerInteractionContext -ResetInteractionContext -SetCrossSlideParametersInteractionContext -SetInertiaParameterInteractionContext -SetInteractionConfigurationInteractionContext -SetMouseWheelParameterInteractionContext -SetPivotInteractionContext -SetPropertyInteractionContext -StopInteractionContext -ord_2500 @2500 -ord_2501 @2501 -ord_2502 @2502 -ord_2503 @2503 -ord_2504 @2504 -ord_2505 @2505 diff --git a/lib/libc/mingw/libarm32/winbrand.def b/lib/libc/mingw/libarm32/winbrand.def @@ -1,19 +0,0 @@ -; -; Definition file of WINBRAND.dll -; Automatic generated by gendef -; written by Kai Tietz 2008-2014 -; -LIBRARY "WINBRAND.dll" -EXPORTS -BrandingFormatString -BrandingLoadBitmap -BrandingLoadCursor -BrandingLoadIcon -BrandingLoadImage -BrandingLoadString -EulaFreeBuffer -GetEULAFile -GetEULAInCurrentUILanguage -GetHinstanceByNameSpace -GetInstalledEULAPath -InstallEULA diff --git a/lib/libc/mingw/libarm32/wintrust.def b/lib/libc/mingw/libarm32/wintrust.def @@ -1,150 +0,0 @@ -; -; Definition file of WINTRUST.dll -; Automatic generated by gendef -; written by Kai Tietz 2008-2014 -; -LIBRARY "WINTRUST.dll" -EXPORTS -CryptCATVerifyMember -CryptSIPGetInfo -CryptSIPGetRegWorkingFlags -GenericChainCertificateTrust -GenericChainFinalProv -HTTPSCertificateTrust -SoftpubDefCertInit -SoftpubFreeDefUsageCallData -SoftpubLoadDefUsageCallData -WTHelperCertFindIssuerCertificate -AddPersonalTrustDBPages -CatalogCompactHashDatabase -CryptCATAdminAcquireContext -CryptCATAdminAcquireContext2 -CryptCATAdminAddCatalog -CryptCATAdminCalcHashFromFileHandle -CryptCATAdminCalcHashFromFileHandle2 -CryptCATAdminEnumCatalogFromHash -CryptCATAdminPauseServiceForBackup -CryptCATAdminReleaseCatalogContext -CryptCATAdminReleaseContext -CryptCATAdminRemoveCatalog -CryptCATAdminResolveCatalogPath -CryptCATAllocSortedMemberInfo -CryptCATCDFClose -CryptCATCDFEnumAttributes -CryptCATCDFEnumAttributesWithCDFTag -CryptCATCDFEnumCatAttributes -CryptCATCDFEnumMembers -CryptCATCDFEnumMembersByCDFTag -CryptCATCDFEnumMembersByCDFTagEx -CryptCATCDFOpen -CryptCATCatalogInfoFromContext -CryptCATClose -CryptCATEnumerateAttr -CryptCATEnumerateCatAttr -CryptCATEnumerateMember -CryptCATFreeSortedMemberInfo -CryptCATGetAttrInfo -CryptCATGetCatAttrInfo -CryptCATGetMemberInfo -CryptCATHandleFromStore -CryptCATOpen -CryptCATPersistStore -CryptCATPutAttrInfo -CryptCATPutCatAttrInfo -CryptCATPutMemberInfo -CryptCATStoreFromHandle -CryptSIPCreateIndirectData -CryptSIPGetCaps -CryptSIPGetSealedDigest -CryptSIPGetSignedDataMsg -CryptSIPPutSignedDataMsg -CryptSIPRemoveSignedDataMsg -CryptSIPVerifyIndirectData -DriverCleanupPolicy -DriverFinalPolicy -DriverInitializePolicy -FindCertsByIssuer -HTTPSFinalProv -IsCatalogFile -MsCatConstructHashTag -MsCatFreeHashTag -OfficeCleanupPolicy -OfficeInitializePolicy -OpenPersonalTrustDBDialog -OpenPersonalTrustDBDialogEx -SoftpubAuthenticode -SoftpubCheckCert -SoftpubCleanup -SoftpubDllRegisterServer -SoftpubDllUnregisterServer -SoftpubDumpStructure -SoftpubInitialize -SoftpubLoadMessage -SoftpubLoadSignature -TrustDecode -TrustFindIssuerCertificate -TrustFreeDecode -TrustIsCertificateSelfSigned -TrustOpenStores -WTGetSignatureInfo -WTHelperCertCheckValidSignature -WTHelperCertIsSelfSigned -WTHelperCheckCertUsage -WTHelperGetAgencyInfo -WTHelperGetFileHandle -WTHelperGetFileHash -WTHelperGetFileName -WTHelperGetKnownUsages -WTHelperGetProvCertFromChain -WTHelperGetProvPrivateDataFromChain -WTHelperGetProvSignerFromChain -WTHelperIsChainedToMicrosoft -WTHelperIsChainedToMicrosoftFromStateData -WTHelperIsInRootStore -WTHelperOpenKnownStores -WTHelperProvDataFromStateData -WVTAsn1CatMemberInfo2Decode -WVTAsn1CatMemberInfo2Encode -WVTAsn1CatMemberInfoDecode -WVTAsn1CatMemberInfoEncode -WVTAsn1CatNameValueDecode -WVTAsn1CatNameValueEncode -WVTAsn1IntentToSealAttributeDecode -WVTAsn1IntentToSealAttributeEncode -WVTAsn1SealingSignatureAttributeDecode -WVTAsn1SealingSignatureAttributeEncode -WVTAsn1SealingTimestampAttributeDecode -WVTAsn1SealingTimestampAttributeEncode -WVTAsn1SpcFinancialCriteriaInfoDecode -WVTAsn1SpcFinancialCriteriaInfoEncode -WVTAsn1SpcIndirectDataContentDecode -WVTAsn1SpcIndirectDataContentEncode -WVTAsn1SpcLinkDecode -WVTAsn1SpcLinkEncode -WVTAsn1SpcMinimalCriteriaInfoDecode -WVTAsn1SpcMinimalCriteriaInfoEncode -WVTAsn1SpcPeImageDataDecode -WVTAsn1SpcPeImageDataEncode -WVTAsn1SpcSigInfoDecode -WVTAsn1SpcSigInfoEncode -WVTAsn1SpcSpAgencyInfoDecode -WVTAsn1SpcSpAgencyInfoEncode -WVTAsn1SpcSpOpusInfoDecode -WVTAsn1SpcSpOpusInfoEncode -WVTAsn1SpcStatementTypeDecode -WVTAsn1SpcStatementTypeEncode -WinVerifyTrust -WinVerifyTrustEx -WintrustAddActionID -WintrustAddDefaultForUsage -WintrustCertificateTrust -WintrustGetDefaultForUsage -WintrustGetRegPolicyFlags -WintrustLoadFunctionPointers -WintrustRemoveActionID -WintrustSetDefaultIncludePEPageHashes -WintrustSetRegPolicyFlags -mscat32DllRegisterServer -mscat32DllUnregisterServer -mssip32DllRegisterServer -mssip32DllUnregisterServer diff --git a/lib/libc/mingw/libsrc/largeint.c b/lib/libc/mingw/libsrc/largeint.c @@ -0,0 +1,121 @@ +#if 0 +/* + largeint.c + + Large (64 bits) integer arithmetics library + + Written by Anders Norlander <anorland@hem2.passagen.se> + + This file is part of a free library for the Win32 API. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +*/ + +#define __COMPILING_LARGEINT + +#include <largeint.h> + +__int64 WINAPI +LargeIntegerAdd (__int64 i1, __int64 i2) +{ + return i1 + i2; +} + +__int64 WINAPI +LargeIntegerSubtract (__int64 i1, __int64 i2) +{ + return i1 - i2; +} + +__int64 WINAPI +LargeIntegerArithmeticShift (__int64 i, int n) +{ + return i >> n; +} + +__int64 WINAPI +LargeIntegerShiftLeft (__int64 i, int n) +{ + return i << n; +} + +__int64 WINAPI +LargeIntegerShiftRight (__int64 i, int n) +{ + return i >> n; +} + +__int64 WINAPI +LargeIntegerNegate (__int64 i) +{ + return -i; +} + +__int64 WINAPI +ConvertLongToLargeInteger (LONG l) +{ + return (__int64) l; +} + +__int64 WINAPI +ConvertUlongToLargeInteger (ULONG ul) +{ + return _toi(_toui(ul)); +} + +__int64 WINAPI +EnlargedIntegerMultiply (LONG l1, LONG l2) +{ + return _toi(l1) * _toi(l2); +} + +__int64 WINAPI +EnlargedUnsignedMultiply (ULONG ul1, ULONG ul2) +{ + return _toi(_toui(ul1) * _toui(ul2)); +} + +__int64 WINAPI +ExtendedIntegerMultiply (__int64 i, LONG l) +{ + return i * _toi(l); +} + +__int64 WINAPI +LargeIntegerMultiply (__int64 i1, __int64 i2) +{ + return i1 * i2; +} + +__int64 WINAPI LargeIntegerDivide (__int64 i1, __int64 i2, __int64 *remainder) +{ + if (remainder) + *remainder = i1 % i2; + return i1 / i2; +} + +ULONG WINAPI +EnlargedUnsignedDivide (unsigned __int64 i1, ULONG i2, PULONG remainder) +{ + if (remainder) + *remainder = i1 % _toi(i2); + return i1 / _toi(i2); +} +__int64 WINAPI +ExtendedLargeIntegerDivide (__int64 i1, ULONG i2, PULONG remainder) +{ + if (remainder) + *remainder = i1 % _toi(i2); + return i1 / _toi(i2); +} + +/* FIXME: what is this function supposed to do? */ +__int64 WINAPI ExtendedMagicDivide (__int64 i1, __int64 i2, int n) +{ + return 0; +} +#endif + diff --git a/lib/libc/mingw/libsrc/mfuuid.c b/lib/libc/mingw/libsrc/mfuuid.c @@ -1,4 +1,3 @@ - #include <windows.h> #include <propsys.h> #include <mediaobj.h> @@ -9,4 +8,5 @@ #include <mfd3d12.h> #include <mfidl.h> #include <mfmediacapture.h> +#include <mfmediaengine.h> #include <mfreadwrite.h> diff --git a/lib/libc/mingw/libsrc/mingwthrd_mt.c b/lib/libc/mingw/libsrc/mingwthrd_mt.c @@ -0,0 +1,5 @@ +/* As _CRT_MT is getting defined in libgcc when using shared version, or it is getting defined by startup code itself, + this library is a dummy version for supporting the link library for gcc's option -mthreads. As we support TLS-cleanup + even without specifying this library, this library is deprecated and just kept for compatibility. */ +int _CRT_MT_OLD = 1; + diff --git a/lib/libc/mingw/libsrc/scrnsave.c b/lib/libc/mingw/libsrc/scrnsave.c @@ -0,0 +1,415 @@ +/* + Screen saver library by Anders Norlander <anorland@hem2.passagen.se> + + This library is (hopefully) compatible with Microsoft's + screen saver library. + + This is public domain software. + + */ +#include <windows.h> +#include <scrnsave.h> +#include <regstr.h> + +/* screen saver window class */ +#define CLASS_SCRNSAVE TEXT("WindowsScreenSaverClass") + +/* globals */ +HWND hMainWindow = NULL; +BOOL fChildPreview = FALSE; +HINSTANCE hMainInstance; +TCHAR szName[TITLEBARNAMELEN]; +TCHAR szAppName[APPNAMEBUFFERLEN]; +TCHAR szIniFile[MAXFILELEN]; +TCHAR szScreenSaver[22]; +TCHAR szHelpFile[MAXFILELEN]; +TCHAR szNoHelpMemory[BUFFLEN]; +UINT MyHelpMessage; + +/* local house keeping */ +static HINSTANCE hPwdLib = NULL; +static POINT pt_orig; +static BOOL checking_pwd = FALSE; +static BOOL closing = FALSE; +static BOOL w95 = FALSE; + +typedef void (*PVFV)(void); +typedef BOOL (WINAPI *VERIFYPWDPROC)(HWND); +typedef DWORD (WINAPI *CHPWDPROC)(LPCTSTR, HWND, DWORD, PVOID); +static VERIFYPWDPROC VerifyScreenSavePwd = NULL; + +/* function names */ +#define szVerifyPassword "VerifyScreenSavePwd" + +#ifdef UNICODE +#define szPwdChangePassword "PwdChangePasswordW" +#else +#define szPwdChangePassword "PwdChangePasswordA" +#endif + +static void TerminateScreenSaver(HWND hWnd); +static BOOL RegisterClasses(void); +static LRESULT WINAPI SysScreenSaverProc(HWND,UINT,WPARAM,LPARAM); +static int LaunchScreenSaver(HWND hParent); +static void LaunchConfig(void); + +static int ISSPACE(char c) +{ + return (c == ' ' || c == '\t'); +} + +static ULONG_PTR parse_ulptr(const char *s) +{ + ULONG_PTR res, n; + const char *p; + for (p = s; *p; p++) + if (*p < '0' || *p > '9') + break; + p--; + res = 0; + for (n = 1; p >= s; p--, n *= 10) + res += (*p - '0') * n; + return res; +} + +/* screen saver entry point */ +int APIENTRY WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, + LPSTR CmdLine, int nCmdShow) +{ + LPSTR p; + OSVERSIONINFO vi; + + UNREFERENCED_PARAMETER(hPrevInst); + UNREFERENCED_PARAMETER(nCmdShow); + + /* initialize */ + hMainInstance = hInst; + + vi.dwOSVersionInfoSize = sizeof(vi); + GetVersionEx(&vi); + /* check if we are going to check for passwords */ + if (vi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) + { + HKEY hKey; + /* we are using windows 95 */ + w95 = TRUE; + if (RegOpenKey(HKEY_CURRENT_USER, REGSTR_PATH_SCREENSAVE ,&hKey) == + ERROR_SUCCESS) + { + DWORD check_pwd; + DWORD size = sizeof(DWORD); + DWORD type; + LONG res; + res = RegQueryValueEx(hKey, REGSTR_VALUE_USESCRPASSWORD, + NULL, &type, (PBYTE) &check_pwd, &size); + if (check_pwd && res == ERROR_SUCCESS) + { + hPwdLib = LoadLibrary(TEXT("PASSWORD.CPL")); + if (hPwdLib) + VerifyScreenSavePwd = (VERIFYPWDPROC)(PVFV) GetProcAddress(hPwdLib, szVerifyPassword); + } + RegCloseKey(hKey); + } + } + + /* parse arguments */ + for (p = CmdLine; *p; p++) + { + switch (*p) + { + case 'S': + case 's': + /* start screen saver */ + return LaunchScreenSaver(NULL); + + case 'P': + case 'p': + { + /* start screen saver in preview window */ + HWND hParent; + fChildPreview = TRUE; + while (ISSPACE(*++p)); + hParent = (HWND) parse_ulptr(p); + if (hParent && IsWindow(hParent)) + return LaunchScreenSaver(hParent); + } + return 0; + + case 'C': + case 'c': + /* display configure dialog */ + LaunchConfig(); + return 0; + + case 'A': + case 'a': + { + /* change screen saver password */ + HWND hParent; + while (ISSPACE(*++p)); + hParent = (HWND) parse_ulptr(p); + if (!hParent || !IsWindow(hParent)) + hParent = GetForegroundWindow(); + ScreenSaverChangePassword(hParent); + } + return 0; + + case '-': + case '/': + case ' ': + default: + break; + } + } + LaunchConfig(); + return 0; +} + +static void LaunchConfig(void) +{ + /* FIXME: should this be called */ + RegisterDialogClasses(hMainInstance); + /* display configure dialog */ + DialogBox(hMainInstance, MAKEINTRESOURCE(DLG_SCRNSAVECONFIGURE), + GetForegroundWindow(), (DLGPROC)(PVFV) ScreenSaverConfigureDialog); +} + + +static int LaunchScreenSaver(HWND hParent) +{ + BOOL foo; + UINT style; + RECT rc; + MSG msg; + + /* don't allow other tasks to get into the foreground */ + if (w95 && !fChildPreview) + SystemParametersInfo(SPI_SCREENSAVERRUNNING, TRUE, &foo, 0); + + msg.wParam = 0; + + /* register classes, both user defined and classes used by screen saver + library */ + if (!RegisterClasses()) + { + MessageBox(NULL, TEXT("RegisterClasses() failed"), NULL, MB_ICONHAND); + goto restore; + } + + /* a slightly different approach needs to be used when displaying + in a preview window */ + if (hParent) + { + style = WS_CHILD; + GetClientRect(hParent, &rc); + } + else + { + style = WS_POPUP; + rc.left = GetSystemMetrics(SM_XVIRTUALSCREEN); + rc.top = GetSystemMetrics(SM_YVIRTUALSCREEN); + rc.right = GetSystemMetrics(SM_CXVIRTUALSCREEN); + rc.bottom = GetSystemMetrics(SM_CYVIRTUALSCREEN); + style |= WS_VISIBLE; + } + + /* create main screen saver window */ + hMainWindow = CreateWindowEx(hParent ? 0 : WS_EX_TOPMOST, CLASS_SCRNSAVE, + TEXT("SCREENSAVER"), style, + rc.left, rc.top, rc.right, rc.bottom, hParent, NULL, + hMainInstance, NULL); + + /* display window and start pumping messages */ + if (hMainWindow) + { + UpdateWindow(hMainWindow); + ShowWindow(hMainWindow, SW_SHOW); + + while (GetMessage(&msg, NULL, 0, 0) == TRUE) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + } + +restore: + /* restore system */ + if (w95 && !fChildPreview) + SystemParametersInfo(SPI_SCREENSAVERRUNNING, FALSE, &foo, 0); + FreeLibrary(hPwdLib); + return msg.wParam; +} + +/* this function takes care of *must* do tasks, like terminating + screen saver */ +static LRESULT WINAPI SysScreenSaverProc(HWND hWnd, UINT msg, + WPARAM wParam, LPARAM lParam) +{ + switch (msg) + { + case WM_CREATE: + if (!fChildPreview) + SetCursor(NULL); + /* mouse is not supposed to move from this position */ + GetCursorPos(&pt_orig); + break; + case WM_DESTROY: + PostQuitMessage(0); + break; + case WM_TIMER: + if (closing) + return 0; + break; + case WM_PAINT: + if (closing) + return DefWindowProc(hWnd, msg, wParam, lParam); + break; + case WM_SYSCOMMAND: + if (!fChildPreview) + switch (wParam) + { + case SC_CLOSE: + case SC_SCREENSAVE: + case SC_NEXTWINDOW: + case SC_PREVWINDOW: + return FALSE; + } + break; + case WM_MOUSEMOVE: + case WM_LBUTTONDOWN: + case WM_RBUTTONDOWN: + case WM_MBUTTONDOWN: + case WM_KEYDOWN: + case WM_SYSKEYDOWN: + case WM_NCACTIVATE: + case WM_ACTIVATE: + case WM_ACTIVATEAPP: + if (closing) + return DefWindowProc(hWnd, msg, wParam, lParam); + break; + } + return ScreenSaverProc(hWnd, msg, wParam, lParam); +} + +LRESULT WINAPI DefScreenSaverProc(HWND hWnd, UINT msg, + WPARAM wParam, LPARAM lParam) +{ + /* don't do any special processing when in preview mode */ + if (fChildPreview || closing) + return DefWindowProc(hWnd, msg, wParam, lParam); + + switch (msg) + { + case WM_CLOSE: + TerminateScreenSaver(hWnd); + /* do NOT pass this to DefWindowProc; it will terminate even if + an invalid password was given. + */ + return 0; + case SCRM_VERIFYPW: + /* verify password or return TRUE if password checking is turned off */ + if (VerifyScreenSavePwd) + return VerifyScreenSavePwd(hWnd); + else + return TRUE; + case WM_SETCURSOR: + if (checking_pwd) + break; + SetCursor(NULL); + return TRUE; + case WM_NCACTIVATE: + case WM_ACTIVATE: + case WM_ACTIVATEAPP: + /* if wParam is FALSE then I am losing focus */ + if (wParam == FALSE && !checking_pwd) + PostMessage(hWnd, WM_CLOSE, 0, 0); + break; + case WM_MOUSEMOVE: + { + POINT pt; + GetCursorPos(&pt); + if (pt.x == pt_orig.x && pt.y == pt_orig.y) + break; + /* mouse moved */ + } + /* fallthrough */ + case WM_LBUTTONDOWN: + case WM_RBUTTONDOWN: + case WM_MBUTTONDOWN: + case WM_KEYDOWN: + case WM_SYSKEYDOWN: + /* try to terminate screen saver */ + if (!checking_pwd) + PostMessage(hWnd, WM_CLOSE, 0, 0); + break; + } + return DefWindowProc(hWnd, msg, wParam, lParam); +} + +static void TerminateScreenSaver(HWND hWnd) +{ + /* don't allow recursion */ + if (checking_pwd || closing) + return; + + /* verify password */ + if (VerifyScreenSavePwd) + { + checking_pwd = TRUE; + closing = SendMessage(hWnd, SCRM_VERIFYPW, 0, 0); + checking_pwd = FALSE; + } + else + closing = TRUE; + + /* are we closing? */ + if (closing) + { + DestroyWindow(hWnd); + } + else + GetCursorPos(&pt_orig); /* if not: get new mouse position */ +} + +/* + Register screen saver window class and call user + supplied hook. + */ +static BOOL RegisterClasses(void) +{ + WNDCLASS cls; + + cls.hCursor = NULL; + cls.hIcon = LoadIcon(hMainInstance, MAKEINTATOM(ID_APP)); + cls.lpszMenuName = NULL; + cls.lpszClassName = CLASS_SCRNSAVE; + cls.hbrBackground = GetStockObject(BLACK_BRUSH); + cls.hInstance = hMainInstance; + cls.style = CS_VREDRAW | CS_HREDRAW | CS_SAVEBITS | CS_PARENTDC; + cls.lpfnWndProc = SysScreenSaverProc; + cls.cbWndExtra = 0; + cls.cbClsExtra = 0; + + if (!RegisterClass(&cls)) + return FALSE; + + return RegisterDialogClasses(hMainInstance); +} + +void WINAPI ScreenSaverChangePassword(HWND hParent) +{ + /* load Master Password Router (MPR) */ + HINSTANCE hMpr = LoadLibrary(TEXT("MPR.DLL")); + + if (hMpr) + { + CHPWDPROC ChangePassword; + ChangePassword = (CHPWDPROC)(PVFV) GetProcAddress(hMpr, szPwdChangePassword); + + /* change password for screen saver provider */ + if (ChangePassword) + ChangePassword(TEXT("SCRSAVE"), hParent, 0, NULL); + + FreeLibrary(hMpr); + } +} diff --git a/lib/libc/mingw/libsrc/uuid.c b/lib/libc/mingw/libsrc/uuid.c @@ -15,6 +15,7 @@ #include <basetyps.h> #include <credentialprovider.h> +#include <functiondiscoverykeys.h> #include <textstor.h> #include <shobjidl.h> #include <propkey.h> diff --git a/lib/libc/mingw/libsrc/wspiapi/WspiapiFreeAddrInfo.c b/lib/libc/mingw/libsrc/wspiapi/WspiapiFreeAddrInfo.c @@ -12,6 +12,6 @@ WspiapiFreeAddrInfo (struct addrinfo *ai) static WSPIAPI_PFREEADDRINFO pfFreeAddrInfo = NULL; if (!pfFreeAddrInfo) - pfFreeAddrInfo = (WSPIAPI_PFREEADDRINFO) WspiapiLoad(2); + pfFreeAddrInfo = (WSPIAPI_PFREEADDRINFO)(void(*)(void)) WspiapiLoad(2); (*pfFreeAddrInfo) (ai); } diff --git a/lib/libc/mingw/libsrc/wspiapi/WspiapiGetAddrInfo.c b/lib/libc/mingw/libsrc/wspiapi/WspiapiGetAddrInfo.c @@ -14,7 +14,7 @@ WspiapiGetAddrInfo(const char *nodename, const char *servname, int err; if (!pfGetAddrInfo) - pfGetAddrInfo = (WSPIAPI_PGETADDRINFO) WspiapiLoad (0); + pfGetAddrInfo = (void*) WspiapiLoad (0); err = (*pfGetAddrInfo) (nodename, servname, hints, res); WSASetLastError (err); return err; diff --git a/lib/libc/mingw/libsrc/wspiapi/WspiapiGetNameInfo.c b/lib/libc/mingw/libsrc/wspiapi/WspiapiGetNameInfo.c @@ -15,7 +15,7 @@ WspiapiGetNameInfo (const struct sockaddr *sa, socklen_t salen, int err; if (!pfGetNameInfo) - pfGetNameInfo = (WSPIAPI_PGETNAMEINFO) WspiapiLoad(1); + pfGetNameInfo = (void*) WspiapiLoad(1); err = (*pfGetNameInfo) (sa, salen, host, hostlen, serv, servlen, flags); WSASetLastError (err); return err; diff --git a/lib/libc/mingw/math/_huge.c b/lib/libc/mingw/math/_huge.c @@ -1,2 +1,7 @@ /* For UCRT, positive infinity */ -double const _HUGE = __builtin_huge_val(); +#include <_mingw.h> +#undef _HUGE +static double _HUGE = __builtin_huge_val(); +double * __MINGW_IMP_SYMBOL(_HUGE) = &_HUGE; +#undef HUGE +extern double * __attribute__ ((alias (__MINGW64_STRINGIFY(__MINGW_IMP_SYMBOL(_HUGE))))) __MINGW_IMP_SYMBOL(HUGE); diff --git a/lib/libc/mingw/math/copysign.c b/lib/libc/mingw/math/copysign.c @@ -0,0 +1,21 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the mingw-w64 runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ +#include <math.h> + +typedef union U +{ + unsigned int u[2]; + double d; +} U; + +double copysign(double x, double y) +{ + U h,j; + h.d = x; + j.d = y; + h.u[1] = (h.u[1] & 0x7fffffff) | (j.u[1] & 0x80000000); + return h.d; +} diff --git a/lib/libc/mingw/math/copysignf.c b/lib/libc/mingw/math/copysignf.c @@ -0,0 +1,19 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the mingw-w64 runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ +#include <math.h> + +typedef union ui_f { + float f; + unsigned int ui; +} ui_f; + +float copysignf(float aX, float aY) +{ + ui_f x,y; + x.f=aX; y.f=aY; + x.ui= (x.ui & 0x7fffffff) | (y.ui & 0x80000000); + return x.f; +} diff --git a/lib/libc/mingw/misc/__initenv.c b/lib/libc/mingw/misc/__initenv.c @@ -4,9 +4,7 @@ * No warranty is given; refer to the file DISCLAIMER.PD within this package. */ -#include <internal.h> +#include <_mingw.h> static char ** local__initenv; -static wchar_t ** local__winitenv; char *** __MINGW_IMP_SYMBOL(__initenv) = &local__initenv; -wchar_t *** __MINGW_IMP_SYMBOL(__winitenv) = &local__winitenv; diff --git a/lib/libc/mingw/misc/__p___initenv.c b/lib/libc/mingw/misc/__p___initenv.c @@ -0,0 +1,16 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the mingw-w64 runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ + +#include <_mingw.h> + +extern char*** __MINGW_IMP_SYMBOL(__initenv); + +char*** __cdecl __p___initenv(void); +char*** __cdecl __p___initenv(void) +{ + return __MINGW_IMP_SYMBOL(__initenv); +} +char*** (__cdecl *__MINGW_IMP_SYMBOL(__p___initenv))(void) = __p___initenv; diff --git a/lib/libc/mingw/misc/__p___winitenv.c b/lib/libc/mingw/misc/__p___winitenv.c @@ -0,0 +1,17 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the mingw-w64 runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ + +#include <_mingw.h> +#include <stddef.h> + +extern wchar_t*** __MINGW_IMP_SYMBOL(__winitenv); + +wchar_t*** __cdecl __p___winitenv(void); +wchar_t*** __cdecl __p___winitenv(void) +{ + return __MINGW_IMP_SYMBOL(__winitenv); +} +wchar_t*** (__cdecl *__MINGW_IMP_SYMBOL(__p___winitenv))(void) = __p___winitenv; diff --git a/lib/libc/mingw/misc/__winitenv.c b/lib/libc/mingw/misc/__winitenv.c @@ -0,0 +1,11 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the mingw-w64 runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ + +#include <_mingw.h> +#include <stddef.h> + +static wchar_t ** local__winitenv; +wchar_t *** __MINGW_IMP_SYMBOL(__winitenv) = &local__winitenv; diff --git a/lib/libc/mingw/misc/_onexit.c b/lib/libc/mingw/misc/_onexit.c @@ -0,0 +1,16 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the mingw-w64 runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ + +#include <stdlib.h> + +_onexit_t __cdecl _onexit(_onexit_t func) +{ + return atexit((void (__cdecl *)(void))func) == 0 ? func : NULL; +} +_onexit_t __cdecl (*__MINGW_IMP_SYMBOL(_onexit))(_onexit_t func) = _onexit; + +_onexit_t __attribute__ ((alias ("_onexit"))) __cdecl onexit(_onexit_t); +extern _onexit_t (__cdecl * __attribute__ ((alias (__MINGW64_STRINGIFY(__MINGW_IMP_SYMBOL(_onexit))))) __MINGW_IMP_SYMBOL(onexit))(_onexit_t); diff --git a/lib/libc/mingw/misc/delayimp.c b/lib/libc/mingw/misc/delayimp.c @@ -177,7 +177,7 @@ FARPROC WINAPI __delayLoadHelper2(PCImgDelayDescr pidd,FARPROC *ppfnIATEntry) if(hmod==0) { if(__pfnDliNotifyHook2) hmod = (HMODULE) (((*__pfnDliNotifyHook2)(dliNotePreLoadLibrary,&dli))); - if(hmod==0) hmod = LoadLibrary(dli.szDll); + if(hmod==0) hmod = LoadLibraryA(dli.szDll); if(hmod==0) { dli.dwLastError = GetLastError(); if(__pfnDliFailureHook2) diff --git a/lib/libc/mingw/crt/dllentry.c b/lib/libc/mingw/misc/dllentrypoint.c diff --git a/lib/libc/mingw/crt/dllmain.c b/lib/libc/mingw/misc/dllmain.c diff --git a/lib/libc/mingw/misc/feclearexcept.c b/lib/libc/mingw/misc/feclearexcept.c @@ -3,36 +3,9 @@ * This file is part of the mingw-w64 runtime package. * No warranty is given; refer to the file DISCLAIMER.PD within this package. */ -#include <fenv.h> - -#if !(defined(_ARM_) || defined(__arm__) || defined(_ARM64_) || defined(__aarch64__)) -int __mingw_has_sse (void); -int __mingw_has_sse(void) -{ - int cpuInfo[4],infoType = 1; - -#ifndef _WIN64 - int o_flag, n_flag; - - __asm__ volatile ("pushfl\n\tpopl %0" : "=mr" (o_flag)); - n_flag = o_flag ^ 0x200000; - __asm__ volatile ("pushl %0\n\tpopfl" : : "g" (n_flag)); - __asm__ volatile ("pushfl\n\tpopl %0" : "=mr" (n_flag)); - if (n_flag == o_flag) - return 0; -#endif - - __asm__ __volatile__ ( - "cpuid" - : "=a" (cpuInfo[0]), "=b" (cpuInfo[1]), "=c" (cpuInfo[2]), - "=d" (cpuInfo[3]) - : "a" (infoType)); - if (cpuInfo[3] & 0x2000000) - return 1; - return 0; -} -#endif /* !(defined(_ARM_) || defined(__arm__) || defined(_ARM64_) || defined(__aarch64__)) */ +#include <fenv.h> +#include <internal.h> /* 7.6.2.1 The feclearexcept function clears the supported exceptions diff --git a/lib/libc/mingw/misc/fegetenv.c b/lib/libc/mingw/misc/fegetenv.c @@ -3,11 +3,9 @@ * This file is part of the mingw-w64 runtime package. * No warranty is given; refer to the file DISCLAIMER.PD within this package. */ -#include <fenv.h> -#if !(defined(_ARM_) || defined(__arm__) || defined(_ARM64_) || defined(__aarch64__)) -int __mingw_has_sse (void); -#endif /* !(defined(_ARM_) || defined(__arm__) || defined(_ARM64_) || defined(__aarch64__)) */ +#include <fenv.h> +#include <internal.h> /* 7.6.4.1 The fegetenv function stores the current floating-point environment diff --git a/lib/libc/mingw/misc/fegetexceptflag.c b/lib/libc/mingw/misc/fegetexceptflag.c @@ -3,13 +3,11 @@ * This file is part of the mingw-w64 runtime package. * No warranty is given; refer to the file DISCLAIMER.PD within this package. */ -#include <fenv.h> -#if !(defined(_ARM_) || defined(__arm__) || defined(_ARM64_) || defined(__aarch64__)) -extern int __mingw_has_sse (void); -#endif /* !(defined(_ARM_) || defined(__arm__) || defined(_ARM64_) || defined(__aarch64__)) */ +#include <fenv.h> +#include <internal.h> -/* 7.6.2.2 +/* 7.6.2.2 The fegetexceptflag function stores an implementation-defined representation of the exception flags indicated by the argument excepts in the object pointed to by the argument flagp. */ @@ -32,7 +30,7 @@ int fegetexceptflag (fexcept_t * flagp, int excepts) _mxcsr = 0; if (__mingw_has_sse ()) __asm__ volatile ("stmxcsr %0" : "=m" (_mxcsr)); - + *flagp = (_mxcsr | _status) & excepts & FE_ALL_EXCEPT; #endif /* defined(_ARM_) || defined(__arm__) || defined(_ARM64_) || defined(__aarch64__) */ return 0; diff --git a/lib/libc/mingw/misc/fesetenv.c b/lib/libc/mingw/misc/fesetenv.c @@ -3,13 +3,11 @@ * This file is part of the mingw-w64 runtime package. * No warranty is given; refer to the file DISCLAIMER.PD within this package. */ + #include <_mingw.h> #include <fenv.h> #include <float.h> - -#if !(defined(_ARM_) || defined(__arm__) || defined(_ARM64_) || defined(__aarch64__)) -extern int __mingw_has_sse (void); -#endif /* !(defined(_ARM_) || defined(__arm__) || defined(_ARM64_) || defined(__aarch64__)) */ +#include <internal.h> /* 7.6.4.3 The fesetenv function establishes the floating-point environment @@ -28,7 +26,7 @@ int fesetenv (const fenv_t * envp) { #if defined(_ARM_) || defined(__arm__) if (envp == FE_DFL_ENV) - /* Use the choice made at app startup */ + /* Use the choice made at app startup */ _fpreset(); else __asm__ volatile ("fmxr FPSCR, %0" : : "r" (*envp)); @@ -59,7 +57,7 @@ int fesetenv (const fenv_t * envp) (* __MINGW_IMP_SYMBOL(_fpreset))(); else if (envp == FE_DFL_ENV) - /* Use the choice made at app startup */ + /* Use the choice made at app startup */ _fpreset(); else diff --git a/lib/libc/mingw/misc/fesetexceptflag.c b/lib/libc/mingw/misc/fesetexceptflag.c @@ -3,11 +3,9 @@ * This file is part of the mingw-w64 runtime package. * No warranty is given; refer to the file DISCLAIMER.PD within this package. */ -#include <fenv.h> -#if !(defined(_ARM_) || defined(__arm__) || defined(_ARM64_) || defined(__aarch64__)) -extern int __mingw_has_sse (void); -#endif /* !(defined(_ARM_) || defined(__arm__) || defined(_ARM64_) || defined(__aarch64__)) */ +#include <fenv.h> +#include <internal.h> /* 7.6.2.4 The fesetexceptflag function sets the complete status for those @@ -16,9 +14,9 @@ extern int __mingw_has_sse (void); *flagp shall have been set by a previous call to fegetexceptflag whose second argument represented at least those exceptions represented by the argument excepts. This function does not raise - exceptions, but only sets the state of the flags. */ + exceptions, but only sets the state of the flags. */ -int fesetexceptflag (const fexcept_t * flagp, int excepts) +int fesetexceptflag (const fexcept_t * flagp, int excepts) { fenv_t _env; diff --git a/lib/libc/mingw/misc/fesetround.c b/lib/libc/mingw/misc/fesetround.c @@ -3,11 +3,9 @@ * This file is part of the mingw-w64 runtime package. * No warranty is given; refer to the file DISCLAIMER.PD within this package. */ -#include <fenv.h> -#if !(defined(_ARM_) || defined(__arm__) || defined(_ARM64_) || defined(__aarch64__)) -int __mingw_has_sse (void); -#endif /* !(defined(_ARM_) || defined(__arm__) || defined(_ARM64_) || defined(__aarch64__)) */ +#include <fenv.h> +#include <internal.h> /* 7.6.3.2 The fesetround function establishes the rounding direction @@ -42,7 +40,7 @@ int fesetround (int mode) _cw &= ~0xc00; _cw |= mode; __asm__ volatile ("fldcw %0;" : : "m" (*&_cw)); - + if (__mingw_has_sse ()) { int mxcsr; diff --git a/lib/libc/mingw/misc/fetestexcept.c b/lib/libc/mingw/misc/fetestexcept.c @@ -4,13 +4,10 @@ * No warranty is given; refer to the file DISCLAIMER.PD within this package. */ -#include <fenv.h> +#include <fenv.h> +#include <internal.h> -#if !(defined(_ARM_) || defined(__arm__) || defined(_ARM64_) || defined(__aarch64__)) -extern int __mingw_has_sse (void); -#endif /* !(defined(_ARM_) || defined(__arm__) || defined(_ARM64_) || defined(__aarch64__)) */ - -/* 7.6.2.5 +/* 7.6.2.5 The fetestexcept function determines which of a specified subset of the exception flags are currently set. The excepts argument specifies the exception flags to be queried. diff --git a/lib/libc/mingw/misc/getopt.c b/lib/libc/mingw/misc/getopt.c @@ -80,12 +80,6 @@ char *optarg; /* argument associated with option */ #define BADARG ((*options == ':') ? (int)':' : (int)'?') #define INORDER (int)1 -#ifndef __CYGWIN__ -#define __progname __argv[0] -#else -extern char __declspec(dllimport) *__progname; -#endif - #ifdef __CYGWIN__ static char EMSG[] = ""; #else @@ -114,20 +108,20 @@ static const char illoptchar[] = "unknown option -- %c"; static const char illoptstring[] = "unknown option -- %s"; static void -_vwarnx(const char *fmt,va_list ap) +_vwarnx(const char *argv0,const char *fmt,va_list ap) { - (void)fprintf(stderr,"%s: ",__progname); + (void)fprintf(stderr,"%s: ",argv0); if (fmt != NULL) (void)vfprintf(stderr,fmt,ap); (void)fprintf(stderr,"\n"); } static void -warnx(const char *fmt,...) +warnx(const char *argv0,const char *fmt,...) { va_list ap; va_start(ap,fmt); - _vwarnx(fmt,ap); + _vwarnx(argv0,fmt,ap); va_end(ap); } @@ -244,7 +238,7 @@ parse_long_options(char * const *nargv, const char *options, if (ambiguous) { /* ambiguous abbreviation */ if (PRINT_ERROR) - warnx(ambig, (int)current_argv_len, + warnx(nargv[0], ambig, (int)current_argv_len, current_argv); optopt = 0; return (BADCH); @@ -253,7 +247,7 @@ parse_long_options(char * const *nargv, const char *options, if (long_options[match].has_arg == no_argument && has_equal) { if (PRINT_ERROR) - warnx(noarg, (int)current_argv_len, + warnx(nargv[0], noarg, (int)current_argv_len, current_argv); /* * XXX: GNU sets optopt to val regardless of flag @@ -283,7 +277,7 @@ parse_long_options(char * const *nargv, const char *options, * should be generated. */ if (PRINT_ERROR) - warnx(recargstring, + warnx(nargv[0], recargstring, current_argv); /* * XXX: GNU sets optopt to val regardless of flag @@ -301,7 +295,7 @@ parse_long_options(char * const *nargv, const char *options, return (-1); } if (PRINT_ERROR) - warnx(illoptstring, current_argv); + warnx(nargv[0], illoptstring, current_argv); optopt = 0; return (BADCH); } @@ -467,7 +461,7 @@ start: if (!*place) ++optind; if (PRINT_ERROR) - warnx(illoptchar, optchar); + warnx(nargv[0], illoptchar, optchar); optopt = optchar; return (BADCH); } @@ -478,7 +472,7 @@ start: else if (++optind >= nargc) { /* no arg */ place = EMSG; if (PRINT_ERROR) - warnx(recargchar, optchar); + warnx(nargv[0], recargchar, optchar); optopt = optchar; return (BADARG); } else /* white space */ @@ -499,7 +493,7 @@ start: if (++optind >= nargc) { /* no arg */ place = EMSG; if (PRINT_ERROR) - warnx(recargchar, optchar); + warnx(nargv[0], recargchar, optchar); optopt = optchar; return (BADARG); } else diff --git a/lib/libc/mingw/misc/initenv.c b/lib/libc/mingw/misc/initenv.c @@ -1,12 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - -#include <wchar.h> - -static char ** local__initenv; -static wchar_t ** local__winitenv; -char *** __MINGW_IMP_SYMBOL(__initenv) = &local__initenv; -wchar_t *** __MINGW_IMP_SYMBOL(__winitenv) = &local__winitenv; diff --git a/lib/libc/mingw/misc/mkstemp.c b/lib/libc/mingw/misc/mkstemp.c @@ -7,6 +7,7 @@ #include <share.h> #include <fcntl.h> #include <sys/stat.h> +#include <limits.h> /* The mkstemp() function generates a unique temporary filename from template, @@ -25,8 +26,8 @@ */ int __cdecl mkstemp (char *template_name) { - int i, j, fd, len, index; - unsigned int r; + int j, fd, len, index; + unsigned int i, r; /* These are the (62) characters used in temporary filenames. */ static const char letters[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; @@ -41,11 +42,8 @@ int __cdecl mkstemp (char *template_name) /* User may supply more than six trailing Xs */ for (index = len - 6; index > 0 && template_name[index - 1] == 'X'; index--); - /* - Like OpenBSD, mkstemp() will try at least 2 ** 31 combinations before - giving up. - */ - for (i = 0; i >= 0; i++) { + /* Like OpenBSD, mkstemp() will try 2 ** 31 combinations before giving up. */ + for (i = 0; i <= INT_MAX; i++) { for(j = index; j < len; j++) { if (rand_s(&r)) r = rand(); diff --git a/lib/libc/mingw/misc/ucrt__getmainargs.c b/lib/libc/mingw/misc/ucrt__getmainargs.c @@ -0,0 +1,25 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the mingw-w64 runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ + +#undef __MSVCRT_VERSION__ +#define _UCRT + +#include <corecrt_startup.h> +#include <internal.h> +#include <stdlib.h> +#include <new.h> + +int __cdecl __getmainargs(int *argc, char ***argv, char ***env, int DoWildCard, _startupinfo *StartInfo) +{ + _initialize_narrow_environment(); + _configure_narrow_argv(DoWildCard ? _crt_argv_expanded_arguments : _crt_argv_unexpanded_arguments); + *argc = *__p___argc(); + *argv = *__p___argv(); + *env = *__p__environ(); + _set_new_mode(StartInfo->newmode); + return 0; +} +int __cdecl (*__MINGW_IMP_SYMBOL(__getmainargs))(int *, char ***, char ***, int, _startupinfo *) = __getmainargs; diff --git a/lib/libc/mingw/misc/ucrt__wgetmainargs.c b/lib/libc/mingw/misc/ucrt__wgetmainargs.c @@ -0,0 +1,25 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the mingw-w64 runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ + +#undef __MSVCRT_VERSION__ +#define _UCRT + +#include <corecrt_startup.h> +#include <internal.h> +#include <stdlib.h> +#include <new.h> + +int __cdecl __wgetmainargs(int *argc, wchar_t ***argv, wchar_t ***env, int DoWildCard, _startupinfo *StartInfo) +{ + _initialize_wide_environment(); + _configure_wide_argv(DoWildCard ? _crt_argv_expanded_arguments : _crt_argv_unexpanded_arguments); + *argc = *__p___argc(); + *argv = *__p___wargv(); + *env = *__p__wenviron(); + _set_new_mode(StartInfo->newmode); + return 0; +} +int __cdecl (*__MINGW_IMP_SYMBOL(__wgetmainargs))(int *, wchar_t ***, wchar_t ***, int, _startupinfo *) = __wgetmainargs; diff --git a/lib/libc/mingw/misc/ucrt_amsg_exit.c b/lib/libc/mingw/misc/ucrt_amsg_exit.c @@ -0,0 +1,19 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the mingw-w64 runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ + +#undef __MSVCRT_VERSION__ +#define _UCRT + +#include <stdio.h> +#include <stdlib.h> +#include <internal.h> + +void __cdecl __MINGW_ATTRIB_NORETURN _amsg_exit(int ret) +{ + fprintf(stderr, "runtime error %d\n", ret); + _exit(255); +} +void __cdecl (*__MINGW_IMP_SYMBOL(_amsg_exit))(int) = _amsg_exit; diff --git a/lib/libc/mingw/misc/ucrt_at_quick_exit.c b/lib/libc/mingw/misc/ucrt_at_quick_exit.c @@ -0,0 +1,24 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the mingw-w64 runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ + +#undef __MSVCRT_VERSION__ +#define _UCRT + +#include <stdlib.h> +#include <corecrt_startup.h> + +extern char __mingw_module_is_dll; + +int __cdecl at_quick_exit(void (__cdecl *func)(void)) +{ + // In a DLL, we can't register a function with _crt_at_quick_exit, because + // we can't unregister it when the DLL is unloaded. This matches how + // at_quick_exit/quick_exit work with MSVC with a dynamically linked CRT. + if (__mingw_module_is_dll) + return 0; + return _crt_at_quick_exit(func); +} +int __cdecl (*__MINGW_IMP_SYMBOL(at_quick_exit))(void (__cdecl *)(void)) = at_quick_exit; diff --git a/lib/libc/mingw/misc/ucrt_tzset.c b/lib/libc/mingw/misc/ucrt_tzset.c @@ -0,0 +1,45 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the mingw-w64 runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ + +#undef __MSVCRT_VERSION__ +#define _UCRT + +#include <time.h> + +// These are required to provide the unrepfixed data symbols "timezone" +// and "tzname"; we can't remap "timezone" via a define due to clashes +// with e.g. "struct timezone". +typedef void __cdecl (*_tzset_func)(void); +extern _tzset_func __MINGW_IMP_SYMBOL(_tzset); + +// Default initial values until _tzset has been called; these are the same +// as the initial values in msvcrt/ucrtbase. +static char initial_tzname0[] = "PST"; +static char initial_tzname1[] = "PDT"; +static char *initial_tznames[] = { initial_tzname0, initial_tzname1 }; +static long initial_timezone = 28800; +static int initial_daylight = 1; +char** __MINGW_IMP_SYMBOL(tzname) = initial_tznames; +long * __MINGW_IMP_SYMBOL(timezone) = &initial_timezone; +int * __MINGW_IMP_SYMBOL(daylight) = &initial_daylight; + +void __cdecl _tzset(void) +{ + __MINGW_IMP_SYMBOL(_tzset)(); + // Redirect the __imp_ pointers to the actual data provided by the UCRT. + // From this point, the exposed values should stay in sync. + __MINGW_IMP_SYMBOL(tzname) = _tzname; + __MINGW_IMP_SYMBOL(timezone) = __timezone(); + __MINGW_IMP_SYMBOL(daylight) = __daylight(); +} + +void __cdecl tzset(void) +{ + _tzset(); +} + +// Dummy/unused __imp_ wrappers, to make GNU ld not autoexport these symbols. +void __cdecl (*__MINGW_IMP_SYMBOL(tzset))(void) = tzset; diff --git a/lib/libc/mingw/misc/wcstoimax.c b/lib/libc/mingw/misc/wcstoimax.c @@ -33,6 +33,7 @@ #define valid(n, b) ((n) >= 0 && (n) < (b)) intmax_t +__cdecl wcstoimax(const wchar_t * __restrict__ nptr, wchar_t ** __restrict__ endptr, int base) { register uintmax_t accum; /* accumulates converted value */ @@ -116,6 +117,16 @@ wcstoimax(const wchar_t * __restrict__ nptr, wchar_t ** __restrict__ endptr, int else return (intmax_t)(minus ? -accum : accum); } +intmax_t (__cdecl *__MINGW_IMP_SYMBOL(wcstoimax))(const wchar_t * __restrict__, wchar_t ** __restrict__, int) = wcstoimax; long long __attribute__ ((alias ("wcstoimax"))) +__cdecl wcstoll (const wchar_t* __restrict__ nptr, wchar_t ** __restrict__ endptr, int base); +extern long long __attribute__ ((alias (__MINGW64_STRINGIFY(__MINGW_IMP_SYMBOL(wcstoimax))))) +(__cdecl *__MINGW_IMP_SYMBOL(wcstoll))(const wchar_t * __restrict__, wchar_t ** __restrict__, int); + +long long __attribute__ ((alias ("wcstoimax"))) +__cdecl +_wcstoi64 (const wchar_t* __restrict__ nptr, wchar_t ** __restrict__ endptr, int base); +extern long long __attribute__ ((alias (__MINGW64_STRINGIFY(__MINGW_IMP_SYMBOL(wcstoimax))))) +(__cdecl *__MINGW_IMP_SYMBOL(_wcstoi64))(const wchar_t * __restrict__, wchar_t ** __restrict__, int); diff --git a/lib/libc/mingw/misc/wcstoumax.c b/lib/libc/mingw/misc/wcstoumax.c @@ -33,6 +33,7 @@ #define valid(n, b) ((n) >= 0 && (n) < (b)) uintmax_t +__cdecl wcstoumax(const wchar_t * __restrict__ nptr, wchar_t ** __restrict__ endptr, int base) { register uintmax_t accum; /* accumulates converted value */ @@ -110,6 +111,16 @@ wcstoumax(const wchar_t * __restrict__ nptr, wchar_t ** __restrict__ endptr, int else return minus ? -accum : accum; /* (yes!) */ } +uintmax_t (__cdecl *__MINGW_IMP_SYMBOL(wcstoumax))(const wchar_t * __restrict__, wchar_t ** __restrict__, int) = wcstoumax; unsigned long long __attribute__ ((alias ("wcstoumax"))) +__cdecl wcstoull (const wchar_t* __restrict__ nptr, wchar_t ** __restrict__ endptr, int base); +extern unsigned long long __attribute__ ((alias (__MINGW64_STRINGIFY(__MINGW_IMP_SYMBOL(wcstoumax))))) +(__cdecl *__MINGW_IMP_SYMBOL(wcstoull))(const wchar_t * __restrict__, wchar_t ** __restrict__, int); + +unsigned long long __attribute__ ((alias ("wcstoumax"))) +__cdecl +_wcstoui64 (const wchar_t* __restrict__ nptr, wchar_t ** __restrict__ endptr, int base); +extern unsigned long long __attribute__ ((alias (__MINGW64_STRINGIFY(__MINGW_IMP_SYMBOL(wcstoumax))))) +(__cdecl *__MINGW_IMP_SYMBOL(_wcstoui64))(const wchar_t * __restrict__, wchar_t ** __restrict__, int); diff --git a/lib/libc/mingw/stdio/_fstat.c b/lib/libc/mingw/stdio/_fstat.c @@ -1,52 +0,0 @@ -#define __CRT__NO_INLINE -#include <sys/stat.h> - -/* FIXME: Relying on _USE_32BIT_TIME_T, which is a user-macro, -during CRT compilation is plainly broken. Need an appropriate -implementation to provide users the ability of compiling the -CRT only with 32-bit time_t behavior. */ -#if defined(_USE_32BIT_TIME_T) -int __cdecl -fstat(int _Desc,struct stat *_Stat) -{ - struct _stat32 st; - int ret=_fstat32(_Desc,&st); - if (ret == -1) { - memset(_Stat,0,sizeof(struct stat)); - return -1; - } - /* struct stat and struct _stat32 - are the same for this case. */ - memcpy(_Stat, &st, sizeof(struct _stat32)); - return ret; -} -#else -int __cdecl -fstat(int _Desc,struct stat *_Stat) -{ - struct _stat64 st; - int ret=_fstat64(_Desc,&st); - if (ret == -1) { - memset(_Stat,0,sizeof(struct stat)); - return -1; - } - /* struct stat and struct _stat64i32 - are the same for this case. */ - _Stat->st_dev=st.st_dev; - _Stat->st_ino=st.st_ino; - _Stat->st_mode=st.st_mode; - _Stat->st_nlink=st.st_nlink; - _Stat->st_uid=st.st_uid; - _Stat->st_gid=st.st_gid; - _Stat->st_rdev=st.st_rdev; - _Stat->st_size=(_off_t) st.st_size; - _Stat->st_atime=st.st_atime; - _Stat->st_mtime=st.st_mtime; - _Stat->st_ctime=st.st_ctime; - return ret; -} -#endif - -/* Add __imp__fstat and __imp__stat symbols. */ -int (*__MINGW_IMP_SYMBOL(fstat))(int, struct stat *) = &fstat; - diff --git a/lib/libc/mingw/stdio/_ftime.c b/lib/libc/mingw/stdio/_ftime.c @@ -1,19 +0,0 @@ -#define __CRT__NO_INLINE -#include <sys/stat.h> -#include <sys/timeb.h> - -/* FIXME: Relying on _USE_32BIT_TIME_T, which is a user-macro, -during CRT compilation is plainly broken. Need an appropriate -implementation to provide users the ability of compiling the -CRT only with 32-bit time_t behavior. */ -#if defined(_USE_32BIT_TIME_T) -void __cdecl ftime (struct timeb *b) -{ - return _ftime ((struct __timeb32 *)b); -} -#else -void __cdecl ftime (struct timeb *b) -{ - _ftime64((struct __timeb64 *)b); -} -#endif diff --git a/lib/libc/mingw/stdio/fgetpos64.c b/lib/libc/mingw/stdio/fgetpos64.c @@ -1,5 +0,0 @@ -#include <stdio.h> - -int __cdecl fgetpos64(FILE * __restrict__ _File ,fpos_t * __restrict__ _Pos){ - return fgetpos(_File, _Pos); -} diff --git a/lib/libc/mingw/stdio/fsetpos64.c b/lib/libc/mingw/stdio/fsetpos64.c @@ -1,5 +0,0 @@ -#include <stdio.h> - -int __cdecl fsetpos64(FILE *_File,const fpos_t *_Pos){ /* fsetpos already 64bit */ - return fsetpos(_File,_Pos); -} diff --git a/lib/libc/mingw/stdio/ftruncate64.c b/lib/libc/mingw/stdio/ftruncate64.c @@ -123,7 +123,7 @@ static LPWSTR xp_getfilepath(const HANDLE f, const LARGE_INTEGER fsize){ if (temp) free(temp); if (pMem) UnmapViewOfFile(pMem); if (hFileMap) CloseHandle(hFileMap); - _set_errno(EBADF); + errno = EBADF; return NULL; } #endif /* _CHECK_SPACE_BY_PSAPI_METHOD_ */ @@ -142,7 +142,7 @@ checkfreespace (const HANDLE f, const ULONGLONG requiredspace) check = GetFileSizeEx (f, ¤tsize); if (!check) { - _set_errno(EBADF); + errno = EBADF; return -1; /* Error checking file size */ } @@ -159,19 +159,19 @@ checkfreespace (const HANDLE f, const ULONGLONG requiredspace) check = GetFinalPathNameByHandleW(f,filepath,0,FILE_NAME_NORMALIZED|VOLUME_NAME_GUID); err = GetLastError(); if (err == ERROR_PATH_NOT_FOUND || err == ERROR_INVALID_PARAMETER) { - _set_errno(EINVAL); + errno = EINVAL; return -1; /* IO error */ } filepath = calloc(check + 1,sizeof(wchar_t)); if (!filepath) { - _set_errno(EBADF); + errno = EBADF; return -1; /* Out of memory */ } check = GetFinalPathNameByHandleW(f,filepath,check,FILE_NAME_NORMALIZED|VOLUME_NAME_GUID); /* FIXME: last error was set to error 87 (0x57) "The parameter is incorrect." for some reason but works out */ if (!check) { - _set_errno(EBADF); + errno = EBADF; return -1; /* Error resolving filename */ } #endif /* _CHECK_SPACE_BY_VISTA_METHOD_ */ @@ -185,21 +185,21 @@ checkfreespace (const HANDLE f, const ULONGLONG requiredspace) free(filepath); filepath = NULL; if (!dirpath) { - _set_errno(EBADF); + errno = EBADF; return -1; /* Out of memory */ } #endif /* _CHECK_SPACE_BY_PSAPI_METHOD_ */ #if _CHECK_SPACE_BY_VOLUME_METHOD_ if(!GetFileInformationByHandle(f,&fileinfo)) { - _set_errno(EINVAL); + errno = EINVAL; return -1; /* Resolution failure */ } volumeid = calloc(51,sizeof(wchar_t)); volumepath = calloc(MAX_PATH+2,sizeof(wchar_t)); if(!volumeid || !volumepath) { - _set_errno(EBADF); + errno = EBADF; return -1; /* Out of memory */ } @@ -226,14 +226,14 @@ checkfreespace (const HANDLE f, const ULONGLONG requiredspace) //wprintf(L"freespace %I64u\n",freespace); free(dirpath); if(!check) { - _set_errno(EFBIG); + errno = EFBIG; return -1; /* Error getting free space */ } /* Check space requirements */ if ((requiredspace - currentsize.QuadPart) > freespace.QuadPart) { - _set_errno(EFBIG); /* File too big for disk */ + errno = EFBIG; /* File too big for disk */ return -1; } /* We have enough space to truncate/expand */ return 0; @@ -258,7 +258,7 @@ int ftruncate64(int __fd, _off64_t __length) { f = (HANDLE)_get_osfhandle(__fd); if (f == INVALID_HANDLE_VALUE || (GetFileType(f) != FILE_TYPE_DISK)) { - _set_errno(EBADF); + errno = EBADF; return -1; } @@ -279,13 +279,13 @@ int ftruncate64(int __fd, _off64_t __length) { if (check == INVALID_SET_FILE_POINTER && quad.LowPart != INVALID_SET_FILE_POINTER) { switch (GetLastError()) { case ERROR_NEGATIVE_SEEK: - _set_errno(EFBIG); /* file too big? */ + errno = EFBIG; /* file too big? */ return -1; case INVALID_SET_FILE_POINTER: - _set_errno(EINVAL); /* shouldn't happen */ + errno = EINVAL; /* shouldn't happen */ return -1; default: - _set_errno(EINVAL); /* shouldn't happen */ + errno = EINVAL; /* shouldn't happen */ return -1; } } @@ -302,7 +302,7 @@ int ftruncate64(int __fd, _off64_t __length) { return ret; errorout: - _set_errno(EINVAL); + errno = EINVAL; return -1; } diff --git a/lib/libc/mingw/stdio/truncate.c b/lib/libc/mingw/stdio/truncate.c @@ -7,9 +7,9 @@ int truncate(const char *pathname, _off_t len){ int fd = _open(pathname,_O_BINARY|_O_RDWR); if (fd == -1) return fd; ret = ftruncate(fd,len); - _get_errno(&err); + err = errno; _close(fd); - _set_errno(err); + errno = err; return ret; } @@ -18,8 +18,8 @@ int truncate64(const char *pathname, _off64_t len){ int fd = _open(pathname,_O_BINARY|_O_RDWR); if (fd == -1) return fd; ret = ftruncate64(fd,len); - _get_errno(&err); + err = errno; _close(fd); - _set_errno(err); + errno = err; return ret; } diff --git a/lib/libc/mingw/stdio/ucrt__scprintf.c b/lib/libc/mingw/stdio/ucrt__scprintf.c @@ -0,0 +1,21 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the mingw-w64 runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ + +#undef __MSVCRT_VERSION__ +#define _UCRT +#include <stdio.h> +#include <stdarg.h> + +int __cdecl _scprintf(const char * __restrict__ _Format, ...) +{ + int ret; + va_list _ArgList; + va_start(_ArgList, _Format); + ret = __stdio_common_vsprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS | _CRT_INTERNAL_PRINTF_STANDARD_SNPRINTF_BEHAVIOR, NULL, 0, _Format, NULL, _ArgList); + va_end(_ArgList); + return ret; +} +int __cdecl (*__MINGW_IMP_SYMBOL(_scprintf))(const char *__restrict__, ...) = _scprintf; diff --git a/lib/libc/mingw/stdio/ucrt__snprintf.c b/lib/libc/mingw/stdio/ucrt__snprintf.c @@ -0,0 +1,21 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the mingw-w64 runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ + +#undef __MSVCRT_VERSION__ +#define _UCRT +#include <stdio.h> +#include <stdarg.h> + +int __cdecl _snprintf(char * __restrict__ _Dest, size_t _Count, const char * __restrict__ _Format, ...) +{ + int ret; + va_list _Args; + va_start(_Args, _Format); + ret = __stdio_common_vsprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS | _CRT_INTERNAL_PRINTF_LEGACY_VSPRINTF_NULL_TERMINATION, _Dest, _Count, _Format, NULL, _Args); + va_end(_Args); + return ret; +} +int __cdecl (*__MINGW_IMP_SYMBOL(_snprintf))(char *__restrict__, size_t, const char *__restrict__, ...) = _snprintf; diff --git a/lib/libc/mingw/stdio/ucrt__snscanf.c b/lib/libc/mingw/stdio/ucrt__snscanf.c @@ -0,0 +1,21 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the mingw-w64 runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ + +#undef __MSVCRT_VERSION__ +#define _UCRT +#include <stdio.h> +#include <stdarg.h> + +int __cdecl _snscanf(const char * __restrict__ _Src, size_t _MaxCount, const char * __restrict__ _Format, ...) +{ + int ret; + va_list _ArgList; + va_start(_ArgList, _Format); + ret = __stdio_common_vsscanf(0, _Src, _MaxCount, _Format, NULL, _ArgList); + va_end(_ArgList); + return ret; +} +int __cdecl (*__MINGW_IMP_SYMBOL(_snscanf))(const char *__restrict__, size_t, const char * __restrict__, ...) = _snscanf; diff --git a/lib/libc/mingw/stdio/ucrt__snwprintf.c b/lib/libc/mingw/stdio/ucrt__snwprintf.c @@ -30,7 +30,7 @@ int __cdecl _snwprintf(wchar_t * restrict _Dest, size_t _Count, const wchar_t * va_list ap; int ret; va_start(ap, _Format); - ret = vsnwprintf(_Dest, _Count, _Format, ap); + ret = __stdio_common_vswprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS | _CRT_INTERNAL_PRINTF_LEGACY_VSPRINTF_NULL_TERMINATION, _Dest, _Count, _Format, NULL, ap); va_end(ap); return ret; } diff --git a/lib/libc/mingw/stdio/ucrt__vscprintf.c b/lib/libc/mingw/stdio/ucrt__vscprintf.c @@ -10,6 +10,6 @@ int __cdecl _vscprintf(const char * __restrict__ _Format, va_list _ArgList) { - return __stdio_common_vsprintf(_CRT_INTERNAL_PRINTF_STANDARD_SNPRINTF_BEHAVIOR, NULL, 0, _Format, NULL, _ArgList); + return __stdio_common_vsprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS | _CRT_INTERNAL_PRINTF_STANDARD_SNPRINTF_BEHAVIOR, NULL, 0, _Format, NULL, _ArgList); } int __cdecl (*__MINGW_IMP_SYMBOL(_vscprintf))(const char *__restrict__, va_list) = _vscprintf; diff --git a/lib/libc/mingw/stdio/ucrt__vsnprintf.c b/lib/libc/mingw/stdio/ucrt__vsnprintf.c @@ -10,6 +10,6 @@ int __cdecl _vsnprintf(char * __restrict__ _Dest,size_t _Count,const char * __restrict__ _Format,va_list _Args) __MINGW_ATTRIB_DEPRECATED_SEC_WARN { - return __stdio_common_vsprintf(_CRT_INTERNAL_PRINTF_LEGACY_VSPRINTF_NULL_TERMINATION, _Dest, _Count, _Format, NULL, _Args); + return __stdio_common_vsprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS | _CRT_INTERNAL_PRINTF_LEGACY_VSPRINTF_NULL_TERMINATION, _Dest, _Count, _Format, NULL, _Args); } int __cdecl (*__MINGW_IMP_SYMBOL(_vsnprintf))(char *__restrict__, size_t, const char *__restrict__, va_list) = _vsnprintf; diff --git a/lib/libc/mingw/stdio/ucrt_fprintf.c b/lib/libc/mingw/stdio/ucrt_fprintf.c @@ -13,7 +13,7 @@ int __cdecl fprintf(FILE * __restrict__ _File,const char * __restrict__ _Format, __builtin_va_list ap; int ret; __builtin_va_start(ap, _Format); - ret = __stdio_common_vfprintf(0, _File, _Format, NULL, ap); + ret = __stdio_common_vfprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, _File, _Format, NULL, ap); __builtin_va_end(ap); return ret; } diff --git a/lib/libc/mingw/stdio/ucrt_ms_fwprintf.c b/lib/libc/mingw/stdio/ucrt_ms_fwprintf.c @@ -0,0 +1,24 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the mingw-w64 runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ + +#undef __MSVCRT_VERSION__ +#define _UCRT + +#include <stdio.h> +#include <stdarg.h> + +// This is called for wchar cases with __USE_MINGW_ANSI_STDIO enabled (where the +// char case just uses fputc). +int __cdecl __ms_fwprintf(FILE *file, const wchar_t *fmt, ...) +{ + va_list ap; + int ret; + va_start(ap, fmt); + ret = __stdio_common_vfwprintf(_CRT_INTERNAL_PRINTF_LEGACY_WIDE_SPECIFIERS, file, fmt, NULL, ap); + va_end(ap); + return ret; +} +int __cdecl (*__MINGW_IMP_SYMBOL(__ms_fwprintf))(FILE *, const wchar_t *, ...) = __ms_fwprintf; diff --git a/lib/libc/mingw/stdio/ucrt_printf.c b/lib/libc/mingw/stdio/ucrt_printf.c @@ -13,7 +13,7 @@ int __cdecl printf(const char * __restrict__ _Format,...) __builtin_va_list ap; int ret; __builtin_va_start(ap, _Format); - ret = __stdio_common_vfprintf(0, stdout, _Format, NULL, ap); + ret = __stdio_common_vfprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, stdout, _Format, NULL, ap); __builtin_va_end(ap); return ret; } diff --git a/lib/libc/mingw/stdio/ucrt_snprintf.c b/lib/libc/mingw/stdio/ucrt_snprintf.c @@ -13,7 +13,7 @@ int __cdecl snprintf (char * __restrict__ __stream, size_t __n, const char * __r __builtin_va_list ap; int ret; __builtin_va_start(ap, __format); - ret = __stdio_common_vsprintf(_CRT_INTERNAL_PRINTF_STANDARD_SNPRINTF_BEHAVIOR, __stream, __n, __format, NULL, ap); + ret = __stdio_common_vsprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS | _CRT_INTERNAL_PRINTF_STANDARD_SNPRINTF_BEHAVIOR, __stream, __n, __format, NULL, ap); __builtin_va_end(ap); return ret; } diff --git a/lib/libc/mingw/stdio/ucrt_sprintf.c b/lib/libc/mingw/stdio/ucrt_sprintf.c @@ -13,7 +13,7 @@ int __cdecl sprintf(char * __restrict__ _Dest,const char * __restrict__ _Format, __builtin_va_list ap; int ret; __builtin_va_start(ap, _Format); - ret = __stdio_common_vsprintf(_CRT_INTERNAL_PRINTF_STANDARD_SNPRINTF_BEHAVIOR, _Dest, (size_t)-1, _Format, NULL, ap); + ret = __stdio_common_vsprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS | _CRT_INTERNAL_PRINTF_STANDARD_SNPRINTF_BEHAVIOR, _Dest, (size_t)-1, _Format, NULL, ap); __builtin_va_end(ap); return ret; } diff --git a/lib/libc/mingw/stdio/ucrt_vfprintf.c b/lib/libc/mingw/stdio/ucrt_vfprintf.c @@ -10,6 +10,6 @@ int __cdecl vfprintf(FILE * __restrict__ _File,const char * __restrict__ _Format,va_list _ArgList) { - return __stdio_common_vfprintf(0, _File, _Format, NULL, _ArgList); + return __stdio_common_vfprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, _File, _Format, NULL, _ArgList); } int __cdecl (*__MINGW_IMP_SYMBOL(vfprintf))(FILE *__restrict__, const char *__restrict__, va_list) = vfprintf; diff --git a/lib/libc/mingw/stdio/ucrt_vprintf.c b/lib/libc/mingw/stdio/ucrt_vprintf.c @@ -10,6 +10,6 @@ int __cdecl vprintf(const char * __restrict__ _Format,va_list _ArgList) { - return __stdio_common_vfprintf(0, stdout, _Format, NULL, _ArgList); + return __stdio_common_vfprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, stdout, _Format, NULL, _ArgList); } int __cdecl (*__MINGW_IMP_SYMBOL(vprintf))(const char *__restrict__, va_list) = vprintf; diff --git a/lib/libc/mingw/stdio/ucrt_vsnprintf.c b/lib/libc/mingw/stdio/ucrt_vsnprintf.c @@ -10,6 +10,6 @@ int __cdecl vsnprintf (char * __restrict__ __stream, size_t __n, const char * __restrict__ __format, va_list __local_argv) { - return __stdio_common_vsprintf(_CRT_INTERNAL_PRINTF_STANDARD_SNPRINTF_BEHAVIOR, __stream, __n, __format, NULL, __local_argv); + return __stdio_common_vsprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS | _CRT_INTERNAL_PRINTF_STANDARD_SNPRINTF_BEHAVIOR, __stream, __n, __format, NULL, __local_argv); } int __cdecl (*__MINGW_IMP_SYMBOL(vsnprintf))(char *__restrict__, size_t, const char *__restrict__, va_list) = vsnprintf; diff --git a/lib/libc/mingw/stdio/ucrt_vsprintf.c b/lib/libc/mingw/stdio/ucrt_vsprintf.c @@ -10,6 +10,6 @@ int __cdecl vsprintf(char * __restrict__ _Dest,const char * __restrict__ _Format,va_list _Args) __MINGW_ATTRIB_DEPRECATED_SEC_WARN { - return __stdio_common_vsprintf(_CRT_INTERNAL_PRINTF_STANDARD_SNPRINTF_BEHAVIOR, _Dest, (size_t)-1, _Format, NULL, _Args); + return __stdio_common_vsprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS | _CRT_INTERNAL_PRINTF_STANDARD_SNPRINTF_BEHAVIOR, _Dest, (size_t)-1, _Format, NULL, _Args); } int __cdecl (*__MINGW_IMP_SYMBOL(vsprintf))(char *__restrict__, const char *__restrict__, va_list) = vsprintf; diff --git a/lib/libc/mingw/string/ucrt__wcstok.c b/lib/libc/mingw/string/ucrt__wcstok.c @@ -0,0 +1,14 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the mingw-w64 runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ + +#include <wchar.h> + +wchar_t *__cdecl _wcstok(wchar_t *restrict str, const wchar_t *restrict delim) +{ + /* NULL as a third param can be specified only for UCRT version of wcstok() */ + return wcstok(str, delim, NULL); +} +wchar_t *(__cdecl *__MINGW_IMP_SYMBOL(_wcstok))(wchar_t *restrict, const wchar_t *restrict) = _wcstok; diff --git a/lib/libc/mingw/winpthreads/barrier.c b/lib/libc/mingw/winpthreads/barrier.c @@ -0,0 +1,246 @@ +/* + Copyright (c) 2011-2016 mingw-w64 project + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#include <windows.h> +#include <stdio.h> +#include <malloc.h> +#include "pthread.h" +#include "barrier.h" +#include "ref.h" +#include "misc.h" + +static pthread_spinlock_t barrier_global = PTHREAD_SPINLOCK_INITIALIZER; + +static WINPTHREADS_ATTRIBUTE((noinline)) int +barrier_unref(volatile pthread_barrier_t *barrier, int res) +{ + pthread_spin_lock(&barrier_global); +#ifdef WINPTHREAD_DBG + assert((((barrier_t *)*barrier)->valid == LIFE_BARRIER) && (((barrier_t *)*barrier)->busy > 0)); +#endif + ((barrier_t *)*barrier)->busy -= 1; + pthread_spin_unlock(&barrier_global); + return res; +} + +static WINPTHREADS_ATTRIBUTE((noinline)) int barrier_ref(volatile pthread_barrier_t *barrier) +{ + int r = 0; + pthread_spin_lock(&barrier_global); + + if (!barrier || !*barrier || ((barrier_t *)*barrier)->valid != LIFE_BARRIER) r = EINVAL; + else { + ((barrier_t *)*barrier)->busy += 1; + } + + pthread_spin_unlock(&barrier_global); + + return r; +} + +static WINPTHREADS_ATTRIBUTE((noinline)) int +barrier_ref_destroy(volatile pthread_barrier_t *barrier, pthread_barrier_t *bDestroy) +{ + int r = 0; + + *bDestroy = NULL; + pthread_spin_lock(&barrier_global); + + if (!barrier || !*barrier || ((barrier_t *)*barrier)->valid != LIFE_BARRIER) r = EINVAL; + else { + barrier_t *b_ = (barrier_t *)*barrier; + if (b_->busy) r = EBUSY; + else { + *bDestroy = *barrier; + *barrier = NULL; + } + } + + pthread_spin_unlock(&barrier_global); + return r; +} + +static WINPTHREADS_ATTRIBUTE((noinline)) void +barrier_ref_set (volatile pthread_barrier_t *barrier, void *v) +{ + pthread_spin_lock(&barrier_global); + *barrier = v; + pthread_spin_unlock(&barrier_global); +} + +int pthread_barrier_destroy(pthread_barrier_t *b_) +{ + pthread_barrier_t bDestroy; + barrier_t *b; + int r; + + while ((r = barrier_ref_destroy(b_,&bDestroy)) == EBUSY) + Sleep(0); + + if (r) + return r; + + b = (barrier_t *)bDestroy; + + pthread_mutex_lock(&b->m); + + if (sem_destroy(&b->sems[0]) != 0) + { + /* Could this happen? */ + *b_ = bDestroy; + pthread_mutex_unlock (&b->m); + return EBUSY; + } + if (sem_destroy(&b->sems[1]) != 0) + { + sem_init (&b->sems[0], b->share, 0); + *b_ = bDestroy; + pthread_mutex_unlock (&b->m); + return -1; + } + pthread_mutex_unlock(&b->m); + if(pthread_mutex_destroy(&b->m) != 0) { + sem_init (&b->sems[0], b->share, 0); + sem_init (&b->sems[1], b->share, 0); + *b_ = bDestroy; + return -1; + } + b->valid = DEAD_BARRIER; + free(bDestroy); + return 0; + +} + +int +pthread_barrier_init (pthread_barrier_t *b_, const void *attr, + unsigned int count) +{ + barrier_t *b; + + if (!count || !b_) + return EINVAL; + + if ((b = (pthread_barrier_t)calloc(1,sizeof(*b))) == NULL) + return ENOMEM; + if (!attr || *((int **)attr) == NULL) + b->share = PTHREAD_PROCESS_PRIVATE; + else + memcpy (&b->share, *((void **) attr), sizeof (int)); + b->total = count; + b->count = count; + b->valid = LIFE_BARRIER; + b->sel = 0; + + if (pthread_mutex_init(&b->m, NULL) != 0) + { + free (b); + return ENOMEM; + } + + if (sem_init(&b->sems[0], b->share, 0) != 0) + { + pthread_mutex_destroy(&b->m); + free (b); + return ENOMEM; + } + if (sem_init(&b->sems[1], b->share, 0) != 0) + { + pthread_mutex_destroy(&b->m); + sem_destroy(&b->sems[0]); + free (b); + return ENOMEM; + } + barrier_ref_set (b_,b); + + return 0; +} + +int pthread_barrier_wait(pthread_barrier_t *b_) +{ + long sel; + int r, e, rslt; + barrier_t *b; + + r = barrier_ref(b_); + if(r) return r; + + b = (barrier_t *)*b_; + + if ((r = pthread_mutex_lock(&b->m)) != 0) return barrier_unref(b_,EINVAL); + sel = b->sel; + InterlockedDecrement((long*)&b->total); + if (b->total == 0) + { + b->total = b->count; + b->sel = (sel != 0 ? 0 : 1); + e = 1; + rslt = PTHREAD_BARRIER_SERIAL_THREAD; + r = (b->count > 1 ? sem_post_multiple (&b->sems[sel], b->count - 1) : 0); + } + else { e = 0; rslt= 0; } + pthread_mutex_unlock(&b->m); + if (!e) + r = sem_wait(&b->sems[sel]); + + if (!r) r = rslt; + return barrier_unref(b_,r); +} + +int pthread_barrierattr_init(void **attr) +{ + int *p; + + if ((p = (int *) calloc (1, sizeof (int))) == NULL) + return ENOMEM; + + *p = PTHREAD_PROCESS_PRIVATE; + *attr = p; + + return 0; +} + +int pthread_barrierattr_destroy(void **attr) +{ + void *p; + if (!attr || (p = *attr) == NULL) + return EINVAL; + *attr = NULL; + free (p); + return 0; +} + +int pthread_barrierattr_setpshared(void **attr, int s) +{ + if (!attr || *attr == NULL + || (s != PTHREAD_PROCESS_SHARED && s != PTHREAD_PROCESS_PRIVATE)) + return EINVAL; + memcpy (*attr, &s, sizeof (int)); + return 0; +} + +int pthread_barrierattr_getpshared(void **attr, int *s) +{ + if (!attr || !s || *attr == NULL) + return EINVAL; + memcpy (s, *attr, sizeof (int)); + return 0; +} diff --git a/lib/libc/mingw/winpthreads/barrier.h b/lib/libc/mingw/winpthreads/barrier.h @@ -0,0 +1,52 @@ +/* + Copyright (c) 2011-2016 mingw-w64 project + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#ifndef WIN_PTHREADS_BARRIER_H +#define WIN_PTHREADS_BARRIER_H + +#define LIFE_BARRIER 0xBAB1FEED +#define DEAD_BARRIER 0xDEADB00F + +#define _PTHREAD_BARRIER_FLAG (1<<30) + +#define CHECK_BARRIER(b) \ + do { \ + if (!(b) || ( ((barrier_t *)(*b))->valid != (unsigned int)LIFE_BARRIER ) ) \ + return EINVAL; \ + } while (0) + +#include "semaphore.h" + +typedef struct barrier_t barrier_t; +struct barrier_t +{ + int valid; + int busy; + int count; + int total; + int share; + long sel; + pthread_mutex_t m; + sem_t sems[2]; +}; + +#endif diff --git a/lib/libc/mingw/winpthreads/clock.c b/lib/libc/mingw/winpthreads/clock.c @@ -0,0 +1,257 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ + +#include <errno.h> +#include <stdint.h> +#include <time.h> +#include <windows.h> +#ifndef IN_WINPTHREAD +#define IN_WINPTHREAD 1 +#endif +#include "pthread.h" +#include "pthread_time.h" +#include "misc.h" + +#define POW10_7 10000000 +#define POW10_9 1000000000 + +/* Number of 100ns-seconds between the beginning of the Windows epoch + * (Jan. 1, 1601) and the Unix epoch (Jan. 1, 1970) + */ +#define DELTA_EPOCH_IN_100NS INT64_C(116444736000000000) + +static WINPTHREADS_INLINE int lc_set_errno(int result) +{ + if (result != 0) { + errno = result; + return -1; + } + return 0; +} + +/** + * Get the resolution of the specified clock clock_id and + * stores it in the struct timespec pointed to by res. + * @param clock_id The clock_id argument is the identifier of the particular + * clock on which to act. The following clocks are supported: + * <pre> + * CLOCK_REALTIME System-wide real-time clock. Setting this clock + * requires appropriate privileges. + * CLOCK_MONOTONIC Clock that cannot be set and represents monotonic + * time since some unspecified starting point. + * CLOCK_PROCESS_CPUTIME_ID High-resolution per-process timer from the CPU. + * CLOCK_THREAD_CPUTIME_ID Thread-specific CPU-time clock. + * </pre> + * @param res The pointer to a timespec structure to receive the time + * resolution. + * @return If the function succeeds, the return value is 0. + * If the function fails, the return value is -1, + * with errno set to indicate the error. + */ +int clock_getres(clockid_t clock_id, struct timespec *res) +{ + clockid_t id = clock_id; + + if (id == CLOCK_REALTIME && _pthread_get_system_time_best_as_file_time == GetSystemTimeAsFileTime) + id = CLOCK_REALTIME_COARSE; /* GetSystemTimePreciseAsFileTime() not available */ + + switch(id) { + case CLOCK_REALTIME: + case CLOCK_MONOTONIC: + { + LARGE_INTEGER pf; + + if (QueryPerformanceFrequency(&pf) == 0) + return lc_set_errno(EINVAL); + + res->tv_sec = 0; + res->tv_nsec = (int) ((POW10_9 + (pf.QuadPart >> 1)) / pf.QuadPart); + if (res->tv_nsec < 1) + res->tv_nsec = 1; + + return 0; + } + + case CLOCK_REALTIME_COARSE: + case CLOCK_PROCESS_CPUTIME_ID: + case CLOCK_THREAD_CPUTIME_ID: + { + DWORD timeAdjustment, timeIncrement; + BOOL isTimeAdjustmentDisabled; + + (void) GetSystemTimeAdjustment(&timeAdjustment, &timeIncrement, &isTimeAdjustmentDisabled); + res->tv_sec = 0; + res->tv_nsec = timeIncrement * 100; + + return 0; + } + default: + break; + } + + return lc_set_errno(EINVAL); +} + +/** + * Get the time of the specified clock clock_id and stores it in the struct + * timespec pointed to by tp. + * @param clock_id The clock_id argument is the identifier of the particular + * clock on which to act. The following clocks are supported: + * <pre> + * CLOCK_REALTIME System-wide real-time clock. Setting this clock + * requires appropriate privileges. + * CLOCK_MONOTONIC Clock that cannot be set and represents monotonic + * time since some unspecified starting point. + * CLOCK_PROCESS_CPUTIME_ID High-resolution per-process timer from the CPU. + * CLOCK_THREAD_CPUTIME_ID Thread-specific CPU-time clock. + * </pre> + * @param tp The pointer to a timespec structure to receive the time. + * @return If the function succeeds, the return value is 0. + * If the function fails, the return value is -1, + * with errno set to indicate the error. + */ +int clock_gettime(clockid_t clock_id, struct timespec *tp) +{ + unsigned __int64 t; + LARGE_INTEGER pf, pc; + union { + unsigned __int64 u64; + FILETIME ft; + } ct, et, kt, ut; + + switch(clock_id) { + case CLOCK_REALTIME: + { + _pthread_get_system_time_best_as_file_time(&ct.ft); + t = ct.u64 - DELTA_EPOCH_IN_100NS; + tp->tv_sec = t / POW10_7; + tp->tv_nsec = ((int) (t % POW10_7)) * 100; + + return 0; + } + + case CLOCK_REALTIME_COARSE: + { + GetSystemTimeAsFileTime(&ct.ft); + t = ct.u64 - DELTA_EPOCH_IN_100NS; + tp->tv_sec = t / POW10_7; + tp->tv_nsec = ((int) (t % POW10_7)) * 100; + + return 0; + } + + case CLOCK_MONOTONIC: + { + if (QueryPerformanceFrequency(&pf) == 0) + return lc_set_errno(EINVAL); + + if (QueryPerformanceCounter(&pc) == 0) + return lc_set_errno(EINVAL); + + tp->tv_sec = pc.QuadPart / pf.QuadPart; + tp->tv_nsec = (int) (((pc.QuadPart % pf.QuadPart) * POW10_9 + (pf.QuadPart >> 1)) / pf.QuadPart); + if (tp->tv_nsec >= POW10_9) { + tp->tv_sec ++; + tp->tv_nsec -= POW10_9; + } + + return 0; + } + + case CLOCK_PROCESS_CPUTIME_ID: + { + if(0 == GetProcessTimes(GetCurrentProcess(), &ct.ft, &et.ft, &kt.ft, &ut.ft)) + return lc_set_errno(EINVAL); + t = kt.u64 + ut.u64; + tp->tv_sec = t / POW10_7; + tp->tv_nsec = ((int) (t % POW10_7)) * 100; + + return 0; + } + + case CLOCK_THREAD_CPUTIME_ID: + { + if(0 == GetThreadTimes(GetCurrentThread(), &ct.ft, &et.ft, &kt.ft, &ut.ft)) + return lc_set_errno(EINVAL); + t = kt.u64 + ut.u64; + tp->tv_sec = t / POW10_7; + tp->tv_nsec = ((int) (t % POW10_7)) * 100; + + return 0; + } + + default: + break; + } + + return lc_set_errno(EINVAL); +} + +/** + * Sleep for the specified time. + * @param clock_id This argument should always be CLOCK_REALTIME (0). + * @param flags 0 for relative sleep interval, others for absolute waking up. + * @param request The desired sleep interval or absolute waking up time. + * @param remain The remain amount of time to sleep. + * The current implemention just ignore it. + * @return If the function succeeds, the return value is 0. + * If the function fails, the return value is -1, + * with errno set to indicate the error. + */ +int clock_nanosleep(clockid_t clock_id, int flags, + const struct timespec *request, + struct timespec *remain) +{ + struct timespec tp; + + if (clock_id != CLOCK_REALTIME) + return lc_set_errno(EINVAL); + + if (flags == 0) + return nanosleep(request, remain); + + /* TIMER_ABSTIME = 1 */ + clock_gettime(CLOCK_REALTIME, &tp); + + tp.tv_sec = request->tv_sec - tp.tv_sec; + tp.tv_nsec = request->tv_nsec - tp.tv_nsec; + if (tp.tv_nsec < 0) { + tp.tv_nsec += POW10_9; + tp.tv_sec --; + } + + return nanosleep(&tp, remain); +} + +/** + * Set the time of the specified clock clock_id. + * @param clock_id This argument should always be CLOCK_REALTIME (0). + * @param tp The requested time. + * @return If the function succeeds, the return value is 0. + * If the function fails, the return value is -1, + * with errno set to indicate the error. + */ +int clock_settime(clockid_t clock_id, const struct timespec *tp) +{ + SYSTEMTIME st; + + union { + unsigned __int64 u64; + FILETIME ft; + } t; + + if (clock_id != CLOCK_REALTIME) + return lc_set_errno(EINVAL); + + t.u64 = tp->tv_sec * (__int64) POW10_7 + tp->tv_nsec / 100 + DELTA_EPOCH_IN_100NS; + if (FileTimeToSystemTime(&t.ft, &st) == 0) + return lc_set_errno(EINVAL); + + if (SetSystemTime(&st) == 0) + return lc_set_errno(EPERM); + + return 0; +} diff --git a/lib/libc/mingw/winpthreads/cond.c b/lib/libc/mingw/winpthreads/cond.c @@ -0,0 +1,755 @@ +/* + Copyright (c) 2011-2016 mingw-w64 project + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +/* + * Posix Condition Variables for Microsoft Windows. + * 22-9-2010 Partly based on the ACE framework implementation. + */ +#include <windows.h> +#include <stdio.h> +#include <malloc.h> +#include <time.h> +#include "pthread.h" +#include "pthread_time.h" +#include "ref.h" +#include "cond.h" +#include "thread.h" +#include "misc.h" +#include "winpthread_internal.h" + +#include "pthread_compat.h" + +int __pthread_shallcancel (void); + +static int do_sema_b_wait (HANDLE sema, int nointerrupt, DWORD timeout,CRITICAL_SECTION *cs, LONG *val); +static int do_sema_b_release(HANDLE sema, LONG count,CRITICAL_SECTION *cs, LONG *val); +static void cleanup_wait(void *arg); + +typedef struct sCondWaitHelper { + cond_t *c; + pthread_mutex_t *external_mutex; + int *r; +} sCondWaitHelper; + +int do_sema_b_wait_intern (HANDLE sema, int nointerrupt, DWORD timeout); + +#ifdef WINPTHREAD_DBG +static int print_state = 0; +static FILE *fo; +void cond_print_set(int state, FILE *f) +{ + if (f) fo = f; + if (!fo) fo = stdout; + print_state = state; +} + +void cond_print(volatile pthread_cond_t *c, char *txt) +{ + if (!print_state) return; + cond_t *c_ = (cond_t *)*c; + if (c_ == NULL) { + fprintf(fo,"C%p %lu %s\n",(void *)*c,GetCurrentThreadId(),txt); + } else { + fprintf(fo,"C%p %lu V=%0X w=%ld %s\n", + (void *)*c, + GetCurrentThreadId(), + (int)c_->valid, + c_->waiters_count_, + txt + ); + } +} +#endif + +static pthread_spinlock_t cond_locked = PTHREAD_SPINLOCK_INITIALIZER; + +static int +cond_static_init (pthread_cond_t *c) +{ + int r = 0; + + pthread_spin_lock (&cond_locked); + if (c == NULL) + r = EINVAL; + else if (*c == PTHREAD_COND_INITIALIZER) + r = pthread_cond_init (c, NULL); + else + /* We assume someone was faster ... */ + r = 0; + pthread_spin_unlock (&cond_locked); + return r; +} + +int +pthread_condattr_destroy (pthread_condattr_t *a) +{ + if (!a) + return EINVAL; + *a = 0; + return 0; +} + +int +pthread_condattr_init (pthread_condattr_t *a) +{ + if (!a) + return EINVAL; + *a = 0; + return 0; +} + +int +pthread_condattr_getpshared (const pthread_condattr_t *a, int *s) +{ + if (!a || !s) + return EINVAL; + *s = *a; + return 0; +} + +int +pthread_condattr_getclock (const pthread_condattr_t *a, clockid_t *clock_id) +{ + if (!a || !clock_id) + return EINVAL; + *clock_id = 0; + return 0; +} + +int +pthread_condattr_setclock(pthread_condattr_t *a, clockid_t clock_id) +{ + if (!a || clock_id != 0) + return EINVAL; + return 0; +} + +int +__pthread_clock_nanosleep (clockid_t clock_id, int flags, const struct timespec *rqtp, + struct timespec *rmtp) +{ + unsigned long long tick, tick2; + unsigned long long delay; + DWORD dw; + + if (clock_id != CLOCK_REALTIME + && clock_id != CLOCK_MONOTONIC + && clock_id != CLOCK_PROCESS_CPUTIME_ID) + return EINVAL; + if ((flags & TIMER_ABSTIME) != 0) + delay = _pthread_rel_time_in_ms (rqtp); + else + delay = _pthread_time_in_ms_from_timespec (rqtp); + do + { + dw = (DWORD) (delay >= 99999ULL ? 99999ULL : delay); + tick = _pthread_time_in_ms (); + pthread_delay_np_ms (dw); + tick2 = _pthread_time_in_ms (); + tick2 -= tick; + if (tick2 >= delay) + delay = 0; + else + delay -= tick2; + } + while (delay != 0ULL); + if (rmtp) + memset (rmtp, 0, sizeof (*rmtp)); + return 0; +} + +int +pthread_condattr_setpshared (pthread_condattr_t *a, int s) +{ + if (!a || (s != PTHREAD_PROCESS_SHARED && s != PTHREAD_PROCESS_PRIVATE)) + return EINVAL; + if (s == PTHREAD_PROCESS_SHARED) + { + *a = PTHREAD_PROCESS_PRIVATE; + return ENOSYS; + } + *a = s; + return 0; +} + +int +pthread_cond_init (pthread_cond_t *c, const pthread_condattr_t *a) +{ + cond_t *_c; + int r = 0; + + if (!c) + return EINVAL; + if (a && *a == PTHREAD_PROCESS_SHARED) + return ENOSYS; + + if ((_c = calloc(1, sizeof(*_c))) == NULL) + return ENOMEM; + + _c->valid = DEAD_COND; + _c->busy = 0; + _c->waiters_count_ = 0; + _c->waiters_count_gone_ = 0; + _c->waiters_count_unblock_ = 0; + + _c->sema_q = CreateSemaphore (NULL, /* no security */ + 0, /* initially 0 */ + 0x7fffffff, /* max count */ + NULL); /* unnamed */ + _c->sema_b = CreateSemaphore (NULL, /* no security */ + 0, /* initially 0 */ + 0x7fffffff, /* max count */ + NULL); + if (_c->sema_q == NULL || _c->sema_b == NULL) { + if (_c->sema_q != NULL) + CloseHandle (_c->sema_q); + if (_c->sema_b != NULL) + CloseHandle (_c->sema_b); + free (_c); + r = EAGAIN; + } else { + InitializeCriticalSection(&_c->waiters_count_lock_); + InitializeCriticalSection(&_c->waiters_b_lock_); + InitializeCriticalSection(&_c->waiters_q_lock_); + _c->value_q = 0; + _c->value_b = 1; + } + if (!r) + { + _c->valid = LIFE_COND; + *c = (pthread_cond_t)_c; + } + else + *c = (pthread_cond_t)NULL; + return r; +} + +int +pthread_cond_destroy (pthread_cond_t *c) +{ + cond_t *_c; + int r; + if (!c || !*c) + return EINVAL; + if (*c == PTHREAD_COND_INITIALIZER) + { + pthread_spin_lock (&cond_locked); + if (*c == PTHREAD_COND_INITIALIZER) + { + *c = (pthread_cond_t)NULL; + r = 0; + } + else + r = EBUSY; + pthread_spin_unlock (&cond_locked); + return r; + } + _c = (cond_t *) *c; + r = do_sema_b_wait(_c->sema_b, 0, INFINITE,&_c->waiters_b_lock_,&_c->value_b); + if (r != 0) + return r; + if (!TryEnterCriticalSection (&_c->waiters_count_lock_)) + { + do_sema_b_release (_c->sema_b, 1,&_c->waiters_b_lock_,&_c->value_b); + return EBUSY; + } + if (_c->waiters_count_ > _c->waiters_count_gone_) + { + r = do_sema_b_release (_c->sema_b, 1,&_c->waiters_b_lock_,&_c->value_b); + if (!r) r = EBUSY; + LeaveCriticalSection(&_c->waiters_count_lock_); + return r; + } + *c = (pthread_cond_t)NULL; + do_sema_b_release (_c->sema_b, 1,&_c->waiters_b_lock_,&_c->value_b); + + if (!CloseHandle (_c->sema_q) && !r) + r = EINVAL; + if (!CloseHandle (_c->sema_b) && !r) + r = EINVAL; + LeaveCriticalSection (&_c->waiters_count_lock_); + DeleteCriticalSection(&_c->waiters_count_lock_); + DeleteCriticalSection(&_c->waiters_b_lock_); + DeleteCriticalSection(&_c->waiters_q_lock_); + _c->valid = DEAD_COND; + free(_c); + return 0; +} + +int +pthread_cond_signal (pthread_cond_t *c) +{ + cond_t *_c; + int r; + + if (!c || !*c) + return EINVAL; + _c = (cond_t *)*c; + if (_c == (cond_t *)PTHREAD_COND_INITIALIZER) + return 0; + else if (_c->valid != (unsigned int)LIFE_COND) + return EINVAL; + + EnterCriticalSection (&_c->waiters_count_lock_); + /* If there aren't any waiters, then this is a no-op. */ + if (_c->waiters_count_unblock_ != 0) + { + if (_c->waiters_count_ == 0) + { + LeaveCriticalSection (&_c->waiters_count_lock_); + /* pthread_testcancel(); */ + return 0; + } + _c->waiters_count_ -= 1; + _c->waiters_count_unblock_ += 1; + } + else if (_c->waiters_count_ > _c->waiters_count_gone_) + { + r = do_sema_b_wait (_c->sema_b, 1, INFINITE,&_c->waiters_b_lock_,&_c->value_b); + if (r != 0) + { + LeaveCriticalSection (&_c->waiters_count_lock_); + /* pthread_testcancel(); */ + return r; + } + if (_c->waiters_count_gone_ != 0) + { + _c->waiters_count_ -= _c->waiters_count_gone_; + _c->waiters_count_gone_ = 0; + } + _c->waiters_count_ -= 1; + _c->waiters_count_unblock_ = 1; + } + else + { + LeaveCriticalSection (&_c->waiters_count_lock_); + /* pthread_testcancel(); */ + return 0; + } + LeaveCriticalSection (&_c->waiters_count_lock_); + r = do_sema_b_release(_c->sema_q, 1,&_c->waiters_q_lock_,&_c->value_q); + /* pthread_testcancel(); */ + return r; +} + +int +pthread_cond_broadcast (pthread_cond_t *c) +{ + cond_t *_c; + int r; + int relCnt = 0; + + if (!c || !*c) + return EINVAL; + _c = (cond_t *)*c; + if (_c == (cond_t*)PTHREAD_COND_INITIALIZER) + return 0; + else if (_c->valid != (unsigned int)LIFE_COND) + return EINVAL; + + EnterCriticalSection (&_c->waiters_count_lock_); + /* If there aren't any waiters, then this is a no-op. */ + if (_c->waiters_count_unblock_ != 0) + { + if (_c->waiters_count_ == 0) + { + LeaveCriticalSection (&_c->waiters_count_lock_); + /* pthread_testcancel(); */ + return 0; + } + relCnt = _c->waiters_count_; + _c->waiters_count_ = 0; + _c->waiters_count_unblock_ += relCnt; + } + else if (_c->waiters_count_ > _c->waiters_count_gone_) + { + r = do_sema_b_wait (_c->sema_b, 1, INFINITE,&_c->waiters_b_lock_,&_c->value_b); + if (r != 0) + { + LeaveCriticalSection (&_c->waiters_count_lock_); + /* pthread_testcancel(); */ + return r; + } + if (_c->waiters_count_gone_ != 0) + { + _c->waiters_count_ -= _c->waiters_count_gone_; + _c->waiters_count_gone_ = 0; + } + relCnt = _c->waiters_count_; + _c->waiters_count_ = 0; + _c->waiters_count_unblock_ = relCnt; + } + else + { + LeaveCriticalSection (&_c->waiters_count_lock_); + /* pthread_testcancel(); */ + return 0; + } + LeaveCriticalSection (&_c->waiters_count_lock_); + r = do_sema_b_release(_c->sema_q, relCnt,&_c->waiters_q_lock_,&_c->value_q); + /* pthread_testcancel(); */ + return r; +} + +int +pthread_cond_wait (pthread_cond_t *c, pthread_mutex_t *external_mutex) +{ + sCondWaitHelper ch; + cond_t *_c; + int r; + + /* pthread_testcancel(); */ + + if (!c || *c == (pthread_cond_t)NULL) + return EINVAL; + _c = (cond_t *)*c; + if (*c == PTHREAD_COND_INITIALIZER) + { + r = cond_static_init(c); + if (r != 0 && r != EBUSY) + return r; + _c = (cond_t *) *c; + } else if (_c->valid != (unsigned int)LIFE_COND) + return EINVAL; + +tryagain: + r = do_sema_b_wait (_c->sema_b, 0, INFINITE,&_c->waiters_b_lock_,&_c->value_b); + if (r != 0) + return r; + + if (!TryEnterCriticalSection (&_c->waiters_count_lock_)) + { + r = do_sema_b_release (_c->sema_b, 1,&_c->waiters_b_lock_,&_c->value_b); + if (r != 0) + return r; + sched_yield(); + goto tryagain; + } + + _c->waiters_count_++; + LeaveCriticalSection(&_c->waiters_count_lock_); + r = do_sema_b_release (_c->sema_b, 1,&_c->waiters_b_lock_,&_c->value_b); + if (r != 0) + return r; + + ch.c = _c; + ch.r = &r; + ch.external_mutex = external_mutex; + + pthread_cleanup_push(cleanup_wait, (void *) &ch); + r = pthread_mutex_unlock(external_mutex); + if (!r) + r = do_sema_b_wait (_c->sema_q, 0, INFINITE,&_c->waiters_q_lock_,&_c->value_q); + + pthread_cleanup_pop(1); + return r; +} + +static int +pthread_cond_timedwait_impl (pthread_cond_t *c, pthread_mutex_t *external_mutex, const struct timespec *t, int rel) +{ + sCondWaitHelper ch; + DWORD dwr; + int r; + cond_t *_c; + + /* pthread_testcancel(); */ + + if (!c || !*c) + return EINVAL; + _c = (cond_t *)*c; + if (_c == (cond_t *)PTHREAD_COND_INITIALIZER) + { + r = cond_static_init(c); + if (r && r != EBUSY) + return r; + _c = (cond_t *) *c; + } else if ((_c)->valid != (unsigned int)LIFE_COND) + return EINVAL; + + if (rel == 0) + { + dwr = dwMilliSecs(_pthread_rel_time_in_ms(t)); + } + else + { + dwr = dwMilliSecs(_pthread_time_in_ms_from_timespec(t)); + } + +tryagain: + r = do_sema_b_wait (_c->sema_b, 0, INFINITE,&_c->waiters_b_lock_,&_c->value_b); + if (r != 0) + return r; + + if (!TryEnterCriticalSection (&_c->waiters_count_lock_)) + { + r = do_sema_b_release (_c->sema_b, 1,&_c->waiters_b_lock_,&_c->value_b); + if (r != 0) + return r; + sched_yield(); + goto tryagain; + } + + _c->waiters_count_++; + LeaveCriticalSection(&_c->waiters_count_lock_); + r = do_sema_b_release (_c->sema_b, 1,&_c->waiters_b_lock_,&_c->value_b); + if (r != 0) + return r; + + ch.c = _c; + ch.r = &r; + ch.external_mutex = external_mutex; + { + pthread_cleanup_push(cleanup_wait, (void *) &ch); + + r = pthread_mutex_unlock(external_mutex); + if (!r) + r = do_sema_b_wait (_c->sema_q, 0, dwr,&_c->waiters_q_lock_,&_c->value_q); + + pthread_cleanup_pop(1); + } + return r; +} + +int +pthread_cond_timedwait(pthread_cond_t *c, pthread_mutex_t *m, const struct timespec *t) +{ + return pthread_cond_timedwait_impl(c, m, t, 0); +} + +int +pthread_cond_timedwait_relative_np(pthread_cond_t *c, pthread_mutex_t *m, const struct timespec *t) +{ + return pthread_cond_timedwait_impl(c, m, t, 1); +} + +static void +cleanup_wait (void *arg) +{ + int n, r; + sCondWaitHelper *ch = (sCondWaitHelper *) arg; + cond_t *_c; + + _c = ch->c; + EnterCriticalSection (&_c->waiters_count_lock_); + n = _c->waiters_count_unblock_; + if (n != 0) + _c->waiters_count_unblock_ -= 1; + else if ((INT_MAX/2) - 1 == _c->waiters_count_gone_) + { + _c->waiters_count_gone_ += 1; + r = do_sema_b_wait (_c->sema_b, 1, INFINITE,&_c->waiters_b_lock_,&_c->value_b); + if (r != 0) + { + LeaveCriticalSection(&_c->waiters_count_lock_); + ch->r[0] = r; + return; + } + _c->waiters_count_ -= _c->waiters_count_gone_; + r = do_sema_b_release (_c->sema_b, 1,&_c->waiters_b_lock_,&_c->value_b); + if (r != 0) + { + LeaveCriticalSection(&_c->waiters_count_lock_); + ch->r[0] = r; + return; + } + _c->waiters_count_gone_ = 0; + } + else + _c->waiters_count_gone_ += 1; + LeaveCriticalSection (&_c->waiters_count_lock_); + + if (n == 1) + { + r = do_sema_b_release (_c->sema_b, 1,&_c->waiters_b_lock_,&_c->value_b); + if (r != 0) + { + ch->r[0] = r; + return; + } + } + r = pthread_mutex_lock(ch->external_mutex); + if (r != 0) + ch->r[0] = r; +} + +static int +do_sema_b_wait (HANDLE sema, int nointerrupt, DWORD timeout,CRITICAL_SECTION *cs, LONG *val) +{ + int r; + LONG v; + EnterCriticalSection(cs); + InterlockedDecrement(val); + v = val[0]; + LeaveCriticalSection(cs); + if (v >= 0) + return 0; + r = do_sema_b_wait_intern (sema, nointerrupt, timeout); + EnterCriticalSection(cs); + if (r != 0) + InterlockedIncrement(val); + LeaveCriticalSection(cs); + return r; +} + +int +do_sema_b_wait_intern (HANDLE sema, int nointerrupt, DWORD timeout) +{ + HANDLE arr[2]; + DWORD maxH = 1; + int r = 0; + DWORD res, dt; + if (nointerrupt == 1) + { + res = _pthread_wait_for_single_object(sema, timeout); + switch (res) { + case WAIT_TIMEOUT: + r = ETIMEDOUT; + break; + case WAIT_ABANDONED: + r = EPERM; + break; + case WAIT_OBJECT_0: + break; + default: + /*We can only return EINVAL though it might not be posix compliant */ + r = EINVAL; + } + if (r != 0 && r != EINVAL && WaitForSingleObject(sema, 0) == WAIT_OBJECT_0) + r = 0; + return r; + } + arr[0] = sema; + arr[1] = (HANDLE) pthread_getevent (); + if (arr[1] != NULL) maxH += 1; + if (maxH == 2) + { +redo: + res = _pthread_wait_for_multiple_objects(maxH, arr, 0, timeout); + switch (res) { + case WAIT_TIMEOUT: + r = ETIMEDOUT; + break; + case (WAIT_OBJECT_0 + 1): + ResetEvent(arr[1]); + if (nointerrupt != 2) + { + pthread_testcancel(); + return EINVAL; + } + pthread_testcancel (); + goto redo; + case WAIT_ABANDONED: + r = EPERM; + break; + case WAIT_OBJECT_0: + r = 0; + break; + default: + /*We can only return EINVAL though it might not be posix compliant */ + r = EINVAL; + } + if (r != 0 && r != EINVAL && WaitForSingleObject(arr[0], 0) == WAIT_OBJECT_0) + r = 0; + if (r != 0 && nointerrupt != 2 && __pthread_shallcancel ()) + return EINVAL; + return r; + } + if (timeout == INFINITE) + { + do { + res = _pthread_wait_for_single_object(sema, 40); + switch (res) { + case WAIT_TIMEOUT: + r = ETIMEDOUT; + break; + case WAIT_ABANDONED: + r = EPERM; + break; + case WAIT_OBJECT_0: + r = 0; + break; + default: + /*We can only return EINVAL though it might not be posix compliant */ + r = EINVAL; + } + if (r != 0 && __pthread_shallcancel ()) + { + if (nointerrupt != 2) + pthread_testcancel(); + return EINVAL; + } + } while (r == ETIMEDOUT); + if (r != 0 && r != EINVAL && WaitForSingleObject(sema, 0) == WAIT_OBJECT_0) + r = 0; + return r; + } + dt = 20; + do { + if (dt > timeout) dt = timeout; + res = _pthread_wait_for_single_object(sema, dt); + switch (res) { + case WAIT_TIMEOUT: + r = ETIMEDOUT; + break; + case WAIT_ABANDONED: + r = EPERM; + break; + case WAIT_OBJECT_0: + r = 0; + break; + default: + /*We can only return EINVAL though it might not be posix compliant */ + r = EINVAL; + } + timeout -= dt; + if (timeout != 0 && r != 0 && __pthread_shallcancel ()) + return EINVAL; + } while (r == ETIMEDOUT && timeout != 0); + if (r != 0 && r == ETIMEDOUT && WaitForSingleObject(sema, 0) == WAIT_OBJECT_0) + r = 0; + if (r != 0 && nointerrupt != 2) + pthread_testcancel(); + return r; +} + +static int +do_sema_b_release(HANDLE sema, LONG count,CRITICAL_SECTION *cs, LONG *val) +{ + int wc; + EnterCriticalSection(cs); + if (((long long) val[0] + (long long) count) > (long long) 0x7fffffffLL) + { + LeaveCriticalSection(cs); + return ERANGE; + } + wc = -val[0]; + InterlockedExchangeAdd(val, count); + if (wc <= 0 || ReleaseSemaphore(sema, (wc < count ? wc : count), NULL)) + { + LeaveCriticalSection(cs); + return 0; + } + InterlockedExchangeAdd(val, -count); + LeaveCriticalSection(cs); + return EINVAL; +} diff --git a/lib/libc/mingw/winpthreads/cond.h b/lib/libc/mingw/winpthreads/cond.h @@ -0,0 +1,63 @@ +/* + Copyright (c) 2011-2016 mingw-w64 project + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#ifndef WIN_PTHREADS_COND_H +#define WIN_PTHREADS_COND_H + +#include <windows.h> + +#define CHECK_COND(c) \ + do { \ + if (!(c) || !*c || (*c == PTHREAD_COND_INITIALIZER) \ + || ( ((cond_t *)(*c))->valid != (unsigned int)LIFE_COND ) ) \ + return EINVAL; \ + } while (0) + +#define LIFE_COND 0xC0BAB1FD +#define DEAD_COND 0xC0DEADBF + +#define STATIC_COND_INITIALIZER(x) ((pthread_cond_t)(x) == ((pthread_cond_t)PTHREAD_COND_INITIALIZER)) + +typedef struct cond_t cond_t; +struct cond_t +{ + unsigned int valid; + int busy; + LONG waiters_count_; /* Number of waiting threads. */ + LONG waiters_count_unblock_; /* Number of waiting threads whitch can be unblocked. */ + LONG waiters_count_gone_; /* Number of waiters which are gone. */ + CRITICAL_SECTION waiters_count_lock_; /* Serialize access to <waiters_count_>. */ + CRITICAL_SECTION waiters_q_lock_; /* Serialize access to sema_q. */ + LONG value_q; + CRITICAL_SECTION waiters_b_lock_; /* Serialize access to sema_b. */ + LONG value_b; + HANDLE sema_q; /* Semaphore used to queue up threads waiting for the condition to + become signaled. */ + HANDLE sema_b; /* Semaphore used to queue up threads waiting for the condition which + became signaled. */ +}; + +void cond_print_set(int state, FILE *f); + +void cond_print(volatile pthread_cond_t *c, char *txt); + +#endif diff --git a/lib/libc/mingw/winpthreads/misc.c b/lib/libc/mingw/winpthreads/misc.c @@ -0,0 +1,205 @@ +/* + Copyright (c) 2011-2016 mingw-w64 project + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#include <windows.h> +#include "pthread.h" +#include "misc.h" + +void (WINAPI *_pthread_get_system_time_best_as_file_time) (LPFILETIME) = NULL; +static ULONGLONG (WINAPI *_pthread_get_tick_count_64) (VOID); +HRESULT (WINAPI *_pthread_set_thread_description) (HANDLE, PCWSTR) = NULL; + +#if defined(__GNUC__) || defined(__clang__) +__attribute__((constructor(0))) +#endif +static void winpthreads_init(void) +{ + HMODULE mod = GetModuleHandleA("kernel32.dll"); + if (mod) + { + _pthread_get_tick_count_64 = + (ULONGLONG (WINAPI *)(VOID))(void*) GetProcAddress(mod, "GetTickCount64"); + + /* <1us precision on Windows 10 */ + _pthread_get_system_time_best_as_file_time = + (void (WINAPI *)(LPFILETIME))(void*) GetProcAddress(mod, "GetSystemTimePreciseAsFileTime"); + } + + if (!_pthread_get_system_time_best_as_file_time) + /* >15ms precision on Windows 10 */ + _pthread_get_system_time_best_as_file_time = GetSystemTimeAsFileTime; + + mod = GetModuleHandleA("kernelbase.dll"); + if (mod) + { + _pthread_set_thread_description = + (HRESULT (WINAPI *)(HANDLE, PCWSTR))(void*) GetProcAddress(mod, "SetThreadDescription"); + } +} + +#if defined(_MSC_VER) && !defined(__clang__) +/* Force a reference to __xc_t to prevent whole program optimization + * from discarding the variable. */ + +/* On x86, symbols are prefixed with an underscore. */ +# if defined(_M_IX86) +# pragma comment(linker, "/include:___xc_t") +# else +# pragma comment(linker, "/include:__xc_t") +# endif + +#pragma section(".CRT$XCT", long, read) +__declspec(allocate(".CRT$XCT")) +extern const _PVFV __xc_t; +const _PVFV __xc_t = winpthreads_init; +#endif + +unsigned long long _pthread_time_in_ms(void) +{ + FILETIME ft; + + GetSystemTimeAsFileTime(&ft); + return (((unsigned long long)ft.dwHighDateTime << 32) + ft.dwLowDateTime + - 0x19DB1DED53E8000ULL) / 10000ULL; +} + +unsigned long long _pthread_time_in_ms_from_timespec(const struct timespec *ts) +{ + unsigned long long t = (unsigned long long) ts->tv_sec * 1000LL; + /* The +999999 is here to ensure that the division always rounds up */ + t += (unsigned long long) (ts->tv_nsec + 999999) / 1000000; + + return t; +} + +unsigned long long _pthread_rel_time_in_ms(const struct timespec *ts) +{ + unsigned long long t1 = _pthread_time_in_ms_from_timespec(ts); + unsigned long long t2 = _pthread_time_in_ms(); + + /* Prevent underflow */ + if (t1 < t2) return 0; + return t1 - t2; +} + +static unsigned long long +_pthread_get_tick_count (long long *frequency) +{ + if (_pthread_get_tick_count_64 != NULL) + return _pthread_get_tick_count_64 (); + + LARGE_INTEGER freq, timestamp; + + if (*frequency == 0) + { + if (QueryPerformanceFrequency (&freq)) + *frequency = freq.QuadPart; + else + *frequency = -1; + } + + if (*frequency > 0 && QueryPerformanceCounter (×tamp)) + return timestamp.QuadPart / (*frequency / 1000); + + /* Fallback */ + return GetTickCount (); +} + +/* A wrapper around WaitForSingleObject() that ensures that + * the wait function does not time out before the time + * actually runs out. This is needed because WaitForSingleObject() + * might have poor accuracy, returning earlier than expected. + * On the other hand, returning a bit *later* than expected + * is acceptable in a preemptive multitasking environment. + */ +unsigned long +_pthread_wait_for_single_object (void *handle, unsigned long timeout) +{ + DWORD result; + unsigned long long start_time, end_time; + unsigned long wait_time; + long long frequency = 0; + + if (timeout == INFINITE || timeout == 0) + return WaitForSingleObject ((HANDLE) handle, (DWORD) timeout); + + start_time = _pthread_get_tick_count (&frequency); + end_time = start_time + timeout; + wait_time = timeout; + + do + { + unsigned long long current_time; + + result = WaitForSingleObject ((HANDLE) handle, (DWORD) wait_time); + if (result != WAIT_TIMEOUT) + break; + + current_time = _pthread_get_tick_count (&frequency); + if (current_time >= end_time) + break; + + wait_time = (DWORD) (end_time - current_time); + } while (TRUE); + + return result; +} + +/* A wrapper around WaitForMultipleObjects() that ensures that + * the wait function does not time out before the time + * actually runs out. This is needed because WaitForMultipleObjects() + * might have poor accuracy, returning earlier than expected. + * On the other hand, returning a bit *later* than expected + * is acceptable in a preemptive multitasking environment. + */ +unsigned long +_pthread_wait_for_multiple_objects (unsigned long count, void **handles, unsigned int all, unsigned long timeout) +{ + DWORD result; + unsigned long long start_time, end_time; + unsigned long wait_time; + long long frequency = 0; + + if (timeout == INFINITE || timeout == 0) + return WaitForMultipleObjects ((DWORD) count, (HANDLE *) handles, all, (DWORD) timeout); + + start_time = _pthread_get_tick_count (&frequency); + end_time = start_time + timeout; + wait_time = timeout; + + do + { + unsigned long long current_time; + + result = WaitForMultipleObjects ((DWORD) count, (HANDLE *) handles, all, (DWORD) wait_time); + if (result != WAIT_TIMEOUT) + break; + + current_time = _pthread_get_tick_count (&frequency); + if (current_time >= end_time) + break; + + wait_time = (DWORD) (end_time - current_time); + } while (TRUE); + + return result; +} diff --git a/lib/libc/mingw/winpthreads/misc.h b/lib/libc/mingw/winpthreads/misc.h @@ -0,0 +1,127 @@ +/* + Copyright (c) 2011-2016 mingw-w64 project + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#ifndef WIN_PTHREADS_MISC_H +#define WIN_PTHREADS_MISC_H + +#include "pthread_compat.h" + +#ifndef assert + +#ifndef ASSERT_TRACE +# define ASSERT_TRACE 0 +#else +# undef ASSERT_TRACE +# define ASSERT_TRACE 0 +#endif + +# define assert(e) \ + ((e) ? ((ASSERT_TRACE) ? fprintf(stderr, \ + "Assertion succeeded: (%s), file %s, line %d\n", \ + #e, __FILE__, (int) __LINE__), \ + fflush(stderr) : \ + 0) : \ + (fprintf(stderr, "Assertion failed: (%s), file %s, line %d\n", \ + #e, __FILE__, (int) __LINE__), exit(1), 0)) + +# define fixme(e) \ + ((e) ? ((ASSERT_TRACE) ? fprintf(stderr, \ + "Assertion succeeded: (%s), file %s, line %d\n", \ + #e, __FILE__, (int) __LINE__), \ + fflush(stderr) : \ + 0) : \ + (fprintf(stderr, "FIXME: (%s), file %s, line %d\n", \ + #e, __FILE__, (int) __LINE__), 0, 0)) + +#endif + +#define PTR2INT(x) ((int)(uintptr_t)(x)) + +#if SIZE_MAX>UINT_MAX +typedef long long LONGBAG; +#else +typedef long LONGBAG; +#endif + +#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) +#undef GetHandleInformation +#define GetHandleInformation(h,f) (1) +#endif + +#define CHECK_HANDLE(h) \ + do { \ + DWORD dwFlags; \ + if (!(h) || ((h) == INVALID_HANDLE_VALUE) || !GetHandleInformation((h), &dwFlags)) \ + return EINVAL; \ + } while (0) + +#define CHECK_PTR(p) do { if (!(p)) return EINVAL; } while (0) + +#define UPD_RESULT(x,r) do { int _r = (x); (r) = (r) ? (r) : _r; } while (0) + +#define CHECK_THREAD(t) \ + do { \ + CHECK_PTR(t); \ + CHECK_HANDLE((t)->h); \ + } while (0) + +#define CHECK_OBJECT(o, e) \ + do { \ + DWORD dwFlags; \ + if (!(o)) return e; \ + if (!((o)->h) || (((o)->h) == INVALID_HANDLE_VALUE) || !GetHandleInformation(((o)->h), &dwFlags)) \ + return e; \ + } while (0) + +#define VALID(x) if (!(p)) return EINVAL; + +/* ms can be 64 bit, solve wrap-around issues: */ +static WINPTHREADS_INLINE unsigned long dwMilliSecs(unsigned long long ms) +{ + if (ms >= 0xffffffffULL) return 0xfffffffful; + return (unsigned long) ms; +} + +unsigned long long _pthread_time_in_ms(void); +unsigned long long _pthread_time_in_ms_from_timespec(const struct timespec *ts); +unsigned long long _pthread_rel_time_in_ms(const struct timespec *ts); +unsigned long _pthread_wait_for_single_object (void *handle, unsigned long timeout); +unsigned long _pthread_wait_for_multiple_objects (unsigned long count, void **handles, unsigned int all, unsigned long timeout); + +extern void (WINAPI *_pthread_get_system_time_best_as_file_time) (LPFILETIME); +extern HRESULT (WINAPI *_pthread_set_thread_description) (HANDLE, PCWSTR); + +#if defined(__GNUC__) || defined(__clang__) +#define likely(cond) __builtin_expect((cond) != 0, 1) +#define unlikely(cond) __builtin_expect((cond) != 0, 0) +#else +#define likely(cond) (cond) +#define unlikely(cond) (cond) +#endif + +#if defined(__GNUC__) || defined(__clang__) +#define UNREACHABLE() __builtin_unreachable() +#elif defined(_MSC_VER) +#define UNREACHABLE() __assume(0) +#endif + +#endif diff --git a/lib/libc/mingw/winpthreads/mutex.c b/lib/libc/mingw/winpthreads/mutex.c @@ -0,0 +1,381 @@ +/* + Copyright (c) 2011, 2014 mingw-w64 project + Copyright (c) 2015 Intel Corporation + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#include <windows.h> +#include <stdio.h> +#include <malloc.h> +#include <stdbool.h> +#include "pthread.h" +#include "misc.h" + +typedef enum { + Unlocked, /* Not locked. */ + Locked, /* Locked but without waiters. */ + Waiting, /* Locked, may have waiters. */ +} mutex_state_t; + +typedef enum { + Normal, + Errorcheck, + Recursive, +} mutex_type_t; + +/* The heap-allocated part of a mutex. */ +typedef struct { + mutex_state_t state; + mutex_type_t type; + HANDLE event; /* Auto-reset event, or NULL if not yet allocated. */ + unsigned rec_lock; /* For recursive mutexes, the number of times the + mutex has been locked in excess by the same thread. */ + volatile DWORD owner; /* For recursive and error-checking mutexes, the + ID of the owning thread if the mutex is locked. */ +} mutex_impl_t; + +/* Whether a mutex is still a static initializer (not a pointer to + a mutex_impl_t). */ +static bool +is_static_initializer(pthread_mutex_t m) +{ + /* Treat 0 as a static initializer as well (for normal mutexes), + to tolerate sloppy code in libgomp. (We should rather fix that code!) */ + intptr_t v = (intptr_t)m; + return v >= -3 && v <= 0; +/* Should be simple: + return (uintptr_t)m >= (uintptr_t)-3; */ +} + +/* Create and return the implementation part of a mutex from a static + initialiser. Return NULL on out-of-memory error. */ +static WINPTHREADS_ATTRIBUTE((noinline)) mutex_impl_t * +mutex_impl_init(pthread_mutex_t *m, mutex_impl_t *mi) +{ + mutex_impl_t *new_mi = malloc(sizeof(mutex_impl_t)); + if (new_mi == NULL) + return NULL; + new_mi->state = Unlocked; + new_mi->type = (mi == (void *)PTHREAD_RECURSIVE_MUTEX_INITIALIZER ? Recursive + : mi == (void *)PTHREAD_ERRORCHECK_MUTEX_INITIALIZER ? Errorcheck + : Normal); + new_mi->event = NULL; + new_mi->rec_lock = 0; + new_mi->owner = (DWORD)-1; + if (InterlockedCompareExchangePointer((PVOID volatile *)m, new_mi, mi) == mi) { + return new_mi; + } else { + /* Someone created the struct before us. */ + free(new_mi); + return (mutex_impl_t *)*m; + } +} + +/* Return the implementation part of a mutex, creating it if necessary. + Return NULL on out-of-memory error. */ +static inline mutex_impl_t * +mutex_impl(pthread_mutex_t *m) +{ + mutex_impl_t *mi = (mutex_impl_t *)*m; + if (is_static_initializer((pthread_mutex_t)mi)) { + return mutex_impl_init(m, mi); + } else { + /* mi cannot be null here; avoid a test in the fast path. */ + if (mi == NULL) + UNREACHABLE(); + return mi; + } +} + +/* Lock a mutex. Give up after 'timeout' ms (with ETIMEDOUT), + or never if timeout=INFINITE. */ +static inline int +pthread_mutex_lock_intern (pthread_mutex_t *m, DWORD timeout) +{ + mutex_impl_t *mi = mutex_impl(m); + if (mi == NULL) + return ENOMEM; + mutex_state_t old_state = InterlockedExchange((long *)&mi->state, Locked); + if (unlikely(old_state != Unlocked)) { + /* The mutex is already locked. */ + + if (mi->type != Normal) { + /* Recursive or Errorcheck */ + if (mi->owner == GetCurrentThreadId()) { + /* FIXME: A recursive mutex should not need two atomic ops when locking + recursively. We could rewrite by doing compare-and-swap instead of + test-and-set the first time, but it would lead to more code + duplication and add a conditional branch to the critical path. */ + InterlockedCompareExchange((long *)&mi->state, old_state, Locked); + if (mi->type == Recursive) { + mi->rec_lock++; + return 0; + } else { + /* type == Errorcheck */ + return EDEADLK; + } + } + } + + /* Make sure there is an event object on which to wait. */ + if (mi->event == NULL) { + /* Make an auto-reset event object. */ + HANDLE ev = CreateEvent(NULL, false, false, NULL); + if (ev == NULL) { + switch (GetLastError()) { + case ERROR_ACCESS_DENIED: + return EPERM; + default: + return ENOMEM; /* Probably accurate enough. */ + } + } + if (InterlockedCompareExchangePointer(&mi->event, ev, NULL) != NULL) { + /* Someone created the event before us. */ + CloseHandle(ev); + } + } + + /* At this point, mi->event is non-NULL. */ + + while (InterlockedExchange((long *)&mi->state, Waiting) != Unlocked) { + /* For timed locking attempts, it is possible (although unlikely) + that we are woken up but someone else grabs the lock before us, + and we have to go back to sleep again. In that case, the total + wait may be longer than expected. */ + + unsigned r = _pthread_wait_for_single_object(mi->event, timeout); + switch (r) { + case WAIT_TIMEOUT: + return ETIMEDOUT; + case WAIT_OBJECT_0: + break; + default: + return EINVAL; + } + } + } + + if (mi->type != Normal) + mi->owner = GetCurrentThreadId(); + + return 0; +} + +int +pthread_mutex_lock (pthread_mutex_t *m) +{ + return pthread_mutex_lock_intern (m, INFINITE); +} + +int pthread_mutex_timedlock(pthread_mutex_t *m, const struct timespec *ts) +{ + unsigned long long patience; + if (ts != NULL) { + unsigned long long end = _pthread_time_in_ms_from_timespec(ts); + unsigned long long now = _pthread_time_in_ms(); + patience = end > now ? end - now : 0; + if (patience > 0xffffffff) + patience = INFINITE; + } else { + patience = INFINITE; + } + return pthread_mutex_lock_intern(m, patience); +} + +int pthread_mutex_unlock(pthread_mutex_t *m) +{ + /* Here m might an initialiser of an error-checking or recursive mutex, in + which case the behaviour is well-defined, so we can't skip this check. */ + mutex_impl_t *mi = mutex_impl(m); + if (mi == NULL) + return ENOMEM; + + if (unlikely(mi->type != Normal)) { + if (mi->state == Unlocked) + return EINVAL; + if (mi->owner != GetCurrentThreadId()) + return EPERM; + if (mi->rec_lock > 0) { + mi->rec_lock--; + return 0; + } + mi->owner = (DWORD)-1; + } + if (unlikely(InterlockedExchange((long *)&mi->state, Unlocked) == Waiting)) { + if (!SetEvent(mi->event)) + return EPERM; + } + return 0; +} + +int pthread_mutex_trylock(pthread_mutex_t *m) +{ + mutex_impl_t *mi = mutex_impl(m); + if (mi == NULL) + return ENOMEM; + + if (InterlockedCompareExchange((long *)&mi->state, Locked, Unlocked) == Unlocked) { + if (mi->type != Normal) + mi->owner = GetCurrentThreadId(); + return 0; + } else { + if (mi->type == Recursive && mi->owner == GetCurrentThreadId()) { + mi->rec_lock++; + return 0; + } + return EBUSY; + } +} + +int +pthread_mutex_init (pthread_mutex_t *m, const pthread_mutexattr_t *a) +{ + pthread_mutex_t init = PTHREAD_MUTEX_INITIALIZER; + if (a != NULL) { + int pshared; + if (pthread_mutexattr_getpshared(a, &pshared) == 0 + && pshared == PTHREAD_PROCESS_SHARED) + return ENOSYS; + + int type; + if (pthread_mutexattr_gettype(a, &type) == 0) { + switch (type) { + case PTHREAD_MUTEX_ERRORCHECK: + init = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER; + break; + case PTHREAD_MUTEX_RECURSIVE: + init = PTHREAD_RECURSIVE_MUTEX_INITIALIZER; + break; + default: + init = PTHREAD_MUTEX_INITIALIZER; + break; + } + } + } + *m = init; + return 0; +} + +int pthread_mutex_destroy (pthread_mutex_t *m) +{ + mutex_impl_t *mi = (mutex_impl_t *)*m; + if (!is_static_initializer((pthread_mutex_t)mi)) { + if (mi->event != NULL) + CloseHandle(mi->event); + free(mi); + /* Sabotage attempts to re-use the mutex before initialising it again. */ + *m = (pthread_mutex_t)NULL; + } + + return 0; +} + +int pthread_mutexattr_init(pthread_mutexattr_t *a) +{ + *a = PTHREAD_MUTEX_NORMAL | (PTHREAD_PROCESS_PRIVATE << 3); + return 0; +} + +int pthread_mutexattr_destroy(pthread_mutexattr_t *a) +{ + if (!a) + return EINVAL; + + return 0; +} + +int pthread_mutexattr_gettype(const pthread_mutexattr_t *a, int *type) +{ + if (!a || !type) + return EINVAL; + + *type = *a & 3; + + return 0; +} + +int pthread_mutexattr_settype(pthread_mutexattr_t *a, int type) +{ + if (!a || (type != PTHREAD_MUTEX_NORMAL && type != PTHREAD_MUTEX_RECURSIVE && type != PTHREAD_MUTEX_ERRORCHECK)) + return EINVAL; + *a &= ~3; + *a |= type; + + return 0; +} + +int pthread_mutexattr_getpshared(const pthread_mutexattr_t *a, int *type) +{ + if (!a || !type) + return EINVAL; + *type = (*a & 4 ? PTHREAD_PROCESS_SHARED : PTHREAD_PROCESS_PRIVATE); + + return 0; +} + +int pthread_mutexattr_setpshared(pthread_mutexattr_t * a, int type) +{ + int r = 0; + if (!a || (type != PTHREAD_PROCESS_SHARED + && type != PTHREAD_PROCESS_PRIVATE)) + return EINVAL; + if (type == PTHREAD_PROCESS_SHARED) + { + type = PTHREAD_PROCESS_PRIVATE; + r = ENOSYS; + } + type = (type == PTHREAD_PROCESS_SHARED ? 4 : 0); + + *a &= ~4; + *a |= type; + + return r; +} + +int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *a, int *type) +{ + *type = *a & (8 + 16); + + return 0; +} + +int pthread_mutexattr_setprotocol(pthread_mutexattr_t *a, int type) +{ + if ((type & (8 + 16)) != 8 + 16) return EINVAL; + + *a &= ~(8 + 16); + *a |= type; + + return 0; +} + +int pthread_mutexattr_getprioceiling(const pthread_mutexattr_t *a, int * prio) +{ + *prio = *a / PTHREAD_PRIO_MULT; + return 0; +} + +int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *a, int prio) +{ + *a &= (PTHREAD_PRIO_MULT - 1); + *a += prio * PTHREAD_PRIO_MULT; + + return 0; +} diff --git a/lib/libc/mingw/winpthreads/nanosleep.c b/lib/libc/mingw/winpthreads/nanosleep.c @@ -0,0 +1,71 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ + +#include <errno.h> +#include <time.h> +#include <windows.h> +#include "pthread.h" +#include "pthread_time.h" +#include "winpthread_internal.h" + +#define POW10_3 1000 +#define POW10_4 10000 +#define POW10_6 1000000 +#define POW10_9 1000000000 +#define MAX_SLEEP_IN_MS 4294967294UL + +/** + * Sleep for the specified time. + * @param request The desired amount of time to sleep. + * @param remain The remain amount of time to sleep. + * @return If the function succeeds, the return value is 0. + * If the function fails, the return value is -1, + * with errno set to indicate the error. + */ +int nanosleep(const struct timespec *request, struct timespec *remain) +{ + unsigned long ms, rc = 0; + unsigned __int64 u64, want, real; + + union { + unsigned __int64 ns100; + FILETIME ft; + } _start, _end; + + if (request->tv_sec < 0 || request->tv_nsec < 0 || request->tv_nsec >= POW10_9) { + errno = EINVAL; + return -1; + } + + if (remain != NULL) GetSystemTimeAsFileTime(&_start.ft); + + want = u64 = request->tv_sec * POW10_3 + request->tv_nsec / POW10_6; + while (u64 > 0 && rc == 0) { + if (u64 >= MAX_SLEEP_IN_MS) ms = MAX_SLEEP_IN_MS; + else ms = (unsigned long) u64; + + u64 -= ms; + rc = pthread_delay_np_ms(ms); + } + + if (rc != 0) { /* WAIT_IO_COMPLETION (192) */ + if (remain != NULL) { + GetSystemTimeAsFileTime(&_end.ft); + real = (_end.ns100 - _start.ns100) / POW10_4; + + if (real >= want) u64 = 0; + else u64 = want - real; + + remain->tv_sec = u64 / POW10_3; + remain->tv_nsec = (long) (u64 % POW10_3) * POW10_6; + } + + errno = EINTR; + return -1; + } + + return 0; +} diff --git a/lib/libc/mingw/winpthreads/ref.c b/lib/libc/mingw/winpthreads/ref.c @@ -0,0 +1,34 @@ +/* + Copyright (c) 2011-2016 mingw-w64 project + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#include <windows.h> +#include <winternl.h> +#include <stdio.h> +#include "pthread.h" +#include "semaphore.h" +#include "rwlock.h" +#include "cond.h" +#include "barrier.h" +#include "sem.h" +#include "ref.h" +#include "misc.h" + diff --git a/lib/libc/mingw/winpthreads/ref.h b/lib/libc/mingw/winpthreads/ref.h @@ -0,0 +1,29 @@ +/* + Copyright (c) 2011-2016 mingw-w64 project + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#ifndef WIN_PTHREADS_REF_H +#define WIN_PTHREADS_REF_H +#include "pthread.h" +#include "semaphore.h" + +#endif + diff --git a/lib/libc/mingw/winpthreads/rwlock.c b/lib/libc/mingw/winpthreads/rwlock.c @@ -0,0 +1,537 @@ +/* + Copyright (c) 2011-2016 mingw-w64 project + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#include <windows.h> +#include <stdio.h> +#include <malloc.h> +#include "pthread.h" +#include "thread.h" +#include "ref.h" +#include "rwlock.h" +#include "misc.h" + +static pthread_spinlock_t rwl_global = PTHREAD_SPINLOCK_INITIALIZER; + +static WINPTHREADS_ATTRIBUTE((noinline)) int rwlock_static_init(pthread_rwlock_t *rw); + +static WINPTHREADS_ATTRIBUTE((noinline)) int rwl_unref(volatile pthread_rwlock_t *rwl, int res) +{ + pthread_spin_lock(&rwl_global); +#ifdef WINPTHREAD_DBG + assert((((rwlock_t *)*rwl)->valid == LIFE_RWLOCK) && (((rwlock_t *)*rwl)->busy > 0)); +#endif + ((rwlock_t *)*rwl)->busy--; + pthread_spin_unlock(&rwl_global); + return res; +} + +static WINPTHREADS_ATTRIBUTE((noinline)) int rwl_ref(pthread_rwlock_t *rwl, int f ) +{ + int r = 0; + if (STATIC_RWL_INITIALIZER(*rwl)) { + r = rwlock_static_init(rwl); + if (r != 0 && r != EBUSY) + return r; + } + pthread_spin_lock(&rwl_global); + + if (!rwl || !*rwl || ((rwlock_t *)*rwl)->valid != LIFE_RWLOCK) r = EINVAL; + else { + ((rwlock_t *)*rwl)->busy ++; + } + + pthread_spin_unlock(&rwl_global); + + return r; +} + +static WINPTHREADS_ATTRIBUTE((noinline)) int rwl_ref_unlock(pthread_rwlock_t *rwl ) +{ + int r = 0; + + pthread_spin_lock(&rwl_global); + + if (!rwl || !*rwl || ((rwlock_t *)*rwl)->valid != LIFE_RWLOCK) r = EINVAL; + else if (STATIC_RWL_INITIALIZER(*rwl)) r= EPERM; + else { + ((rwlock_t *)*rwl)->busy ++; + } + + pthread_spin_unlock(&rwl_global); + + return r; +} + +static WINPTHREADS_ATTRIBUTE((noinline)) int rwl_ref_destroy(pthread_rwlock_t *rwl, pthread_rwlock_t *rDestroy ) +{ + int r = 0; + + *rDestroy = (pthread_rwlock_t)NULL; + pthread_spin_lock(&rwl_global); + + if (!rwl || !*rwl) r = EINVAL; + else { + rwlock_t *r_ = (rwlock_t *)*rwl; + if (STATIC_RWL_INITIALIZER(*rwl)) *rwl = (pthread_rwlock_t)NULL; + else if (r_->valid != LIFE_RWLOCK) r = EINVAL; + else if (r_->busy) r = EBUSY; + else { + *rDestroy = *rwl; + *rwl = (pthread_rwlock_t)NULL; + } + } + + pthread_spin_unlock(&rwl_global); + return r; +} + +static int rwlock_gain_both_locks(rwlock_t *rwlock) +{ + int ret; + ret = pthread_mutex_lock(&rwlock->mex); + if (ret != 0) + return ret; + ret = pthread_mutex_lock(&rwlock->mcomplete); + if (ret != 0) + pthread_mutex_unlock(&rwlock->mex); + return ret; +} + +static int rwlock_free_both_locks(rwlock_t *rwlock, int last_fail) +{ + int ret, ret2; + ret = pthread_mutex_unlock(&rwlock->mcomplete); + ret2 = pthread_mutex_unlock(&rwlock->mex); + if (last_fail && ret2 != 0) + ret = ret2; + else if (!last_fail && !ret) + ret = ret2; + return ret; +} + +#ifdef WINPTHREAD_DBG +static int print_state = 0; +void rwl_print_set(int state) +{ + print_state = state; +} + +void rwl_print(volatile pthread_rwlock_t *rwl, char *txt) +{ + if (!print_state) return; + rwlock_t *r = (rwlock_t *)*rwl; + if (r == NULL) { + printf("RWL%p %lu %s\n",(void *)*rwl,GetCurrentThreadId(),txt); + } else { + printf("RWL%p %lu V=%0X B=%d r=%ld w=%ld L=%p %s\n", + (void *)*rwl, + GetCurrentThreadId(), + (int)r->valid, + (int)r->busy, + 0L,0L,NULL,txt); + } +} +#endif + +static pthread_spinlock_t cond_locked = PTHREAD_SPINLOCK_INITIALIZER; + +static WINPTHREADS_ATTRIBUTE((noinline)) int rwlock_static_init(pthread_rwlock_t *rw) +{ + int r; + pthread_spin_lock(&cond_locked); + if (*rw != PTHREAD_RWLOCK_INITIALIZER) + { + pthread_spin_unlock(&cond_locked); + return EINVAL; + } + r = pthread_rwlock_init (rw, NULL); + pthread_spin_unlock(&cond_locked); + + return r; +} + +int pthread_rwlock_init (pthread_rwlock_t *rwlock_, const pthread_rwlockattr_t *attr) +{ + rwlock_t *rwlock; + int r; + + if(!rwlock_) + return EINVAL; + *rwlock_ = (pthread_rwlock_t)NULL; + if ((rwlock = calloc(1, sizeof(*rwlock))) == NULL) + return ENOMEM; + rwlock->valid = DEAD_RWLOCK; + + rwlock->nex_count = rwlock->nsh_count = rwlock->ncomplete = 0; + if ((r = pthread_mutex_init (&rwlock->mex, NULL)) != 0) + { + free(rwlock); + return r; + } + if ((r = pthread_mutex_init (&rwlock->mcomplete, NULL)) != 0) + { + pthread_mutex_destroy(&rwlock->mex); + free(rwlock); + return r; + } + if ((r = pthread_cond_init (&rwlock->ccomplete, NULL)) != 0) + { + pthread_mutex_destroy(&rwlock->mex); + pthread_mutex_destroy (&rwlock->mcomplete); + free(rwlock); + return r; + } + rwlock->valid = LIFE_RWLOCK; + *rwlock_ = (pthread_rwlock_t)rwlock; + return r; +} + +int pthread_rwlock_destroy (pthread_rwlock_t *rwlock_) +{ + rwlock_t *rwlock; + pthread_rwlock_t rDestroy; + int r, r2; + + pthread_spin_lock(&cond_locked); + r = rwl_ref_destroy(rwlock_,&rDestroy); + pthread_spin_unlock(&cond_locked); + + if(r) return r; + if(!rDestroy) return 0; /* destroyed a (still) static initialized rwl */ + + rwlock = (rwlock_t *)rDestroy; + r = rwlock_gain_both_locks (rwlock); + if (r != 0) + { + *rwlock_ = rDestroy; + return r; + } + if (rwlock->nsh_count > rwlock->ncomplete || rwlock->nex_count > 0) + { + *rwlock_ = rDestroy; + r = rwlock_free_both_locks(rwlock, 1); + if (!r) + r = EBUSY; + return r; + } + rwlock->valid = DEAD_RWLOCK; + r = rwlock_free_both_locks(rwlock, 0); + if (r != 0) { *rwlock_ = rDestroy; return r; } + + r = pthread_cond_destroy(&rwlock->ccomplete); + r2 = pthread_mutex_destroy(&rwlock->mex); + if (!r) r = r2; + r2 = pthread_mutex_destroy(&rwlock->mcomplete); + if (!r) r = r2; + rwlock->valid = DEAD_RWLOCK; + free((void *)rDestroy); + return 0; +} + +int pthread_rwlock_rdlock (pthread_rwlock_t *rwlock_) +{ + rwlock_t *rwlock; + int ret; + + /* pthread_testcancel(); */ + + ret = rwl_ref(rwlock_,0); + if(ret != 0) return ret; + + rwlock = (rwlock_t *)*rwlock_; + + ret = pthread_mutex_lock(&rwlock->mex); + if (ret != 0) return rwl_unref(rwlock_, ret); + InterlockedIncrement((long*)&rwlock->nsh_count); + if (rwlock->nsh_count == INT_MAX) + { + ret = pthread_mutex_lock(&rwlock->mcomplete); + if (ret != 0) + { + pthread_mutex_unlock(&rwlock->mex); + return rwl_unref(rwlock_,ret); + } + rwlock->nsh_count -= rwlock->ncomplete; + rwlock->ncomplete = 0; + ret = rwlock_free_both_locks(rwlock, 0); + return rwl_unref(rwlock_, ret); + } + ret = pthread_mutex_unlock(&rwlock->mex); + return rwl_unref(rwlock_, ret); +} + +int pthread_rwlock_timedrdlock (pthread_rwlock_t *rwlock_, const struct timespec *ts) +{ + rwlock_t *rwlock; + int ret; + + /* pthread_testcancel(); */ + + ret = rwl_ref(rwlock_,0); + if(ret != 0) return ret; + + rwlock = (rwlock_t *)*rwlock_; + if ((ret = pthread_mutex_timedlock (&rwlock->mex, ts)) != 0) + return rwl_unref(rwlock_, ret); + InterlockedIncrement(&rwlock->nsh_count); + if (rwlock->nsh_count == INT_MAX) + { + ret = pthread_mutex_timedlock(&rwlock->mcomplete, ts); + if (ret != 0) + { + if (ret == ETIMEDOUT) + InterlockedIncrement(&rwlock->ncomplete); + pthread_mutex_unlock(&rwlock->mex); + return rwl_unref(rwlock_, ret); + } + rwlock->nsh_count -= rwlock->ncomplete; + rwlock->ncomplete = 0; + ret = rwlock_free_both_locks(rwlock, 0); + return rwl_unref(rwlock_, ret); + } + ret = pthread_mutex_unlock(&rwlock->mex); + return rwl_unref(rwlock_, ret); +} + +int pthread_rwlock_tryrdlock (pthread_rwlock_t *rwlock_) +{ + rwlock_t *rwlock; + int ret; + + ret = rwl_ref(rwlock_,RWL_TRY); + if(ret != 0) return ret; + + rwlock = (rwlock_t *)*rwlock_; + ret = pthread_mutex_trylock(&rwlock->mex); + if (ret != 0) + return rwl_unref(rwlock_, ret); + InterlockedIncrement(&rwlock->nsh_count); + if (rwlock->nsh_count == INT_MAX) + { + ret = pthread_mutex_lock(&rwlock->mcomplete); + if (ret != 0) + { + pthread_mutex_unlock(&rwlock->mex); + return rwl_unref(rwlock_, ret); + } + rwlock->nsh_count -= rwlock->ncomplete; + rwlock->ncomplete = 0; + ret = rwlock_free_both_locks(rwlock, 0); + return rwl_unref(rwlock_, ret); + } + ret = pthread_mutex_unlock(&rwlock->mex); + return rwl_unref(rwlock_,ret); +} + +int pthread_rwlock_trywrlock (pthread_rwlock_t *rwlock_) +{ + rwlock_t *rwlock; + int ret; + + ret = rwl_ref(rwlock_,RWL_TRY); + if(ret != 0) return ret; + + rwlock = (rwlock_t *)*rwlock_; + ret = pthread_mutex_trylock (&rwlock->mex); + if (ret != 0) + return rwl_unref(rwlock_, ret); + ret = pthread_mutex_trylock(&rwlock->mcomplete); + if (ret != 0) + { + int r1 = pthread_mutex_unlock(&rwlock->mex); + if (r1 != 0) + ret = r1; + return rwl_unref(rwlock_, ret); + } + if (rwlock->nex_count != 0) + return rwl_unref(rwlock_, EBUSY); + if (rwlock->ncomplete > 0) + { + rwlock->nsh_count -= rwlock->ncomplete; + rwlock->ncomplete = 0; + } + if (rwlock->nsh_count > 0) + { + ret = rwlock_free_both_locks(rwlock, 0); + if (!ret) + ret = EBUSY; + return rwl_unref(rwlock_, ret); + } + rwlock->nex_count = 1; + return rwl_unref(rwlock_, 0); +} + +int pthread_rwlock_unlock (pthread_rwlock_t *rwlock_) +{ + rwlock_t *rwlock; + int ret; + + ret = rwl_ref_unlock(rwlock_); + if(ret != 0) return ret; + + rwlock = (rwlock_t *)*rwlock_; + if (rwlock->nex_count == 0) + { + ret = pthread_mutex_lock(&rwlock->mcomplete); + if (!ret) + { + int r1; + InterlockedIncrement(&rwlock->ncomplete); + if (rwlock->ncomplete == 0) + ret = pthread_cond_signal(&rwlock->ccomplete); + r1 = pthread_mutex_unlock(&rwlock->mcomplete); + if (!ret) + ret = r1; + } + } + else + { + InterlockedDecrement(&rwlock->nex_count); + ret = rwlock_free_both_locks(rwlock, 0); + } + return rwl_unref(rwlock_, ret); +} + +static void st_cancelwrite (void *arg) +{ + rwlock_t *rwlock = (rwlock_t *)arg; + + rwlock->nsh_count = - rwlock->ncomplete; + rwlock->ncomplete = 0; + rwlock_free_both_locks(rwlock, 0); +} + +int pthread_rwlock_wrlock (pthread_rwlock_t *rwlock_) +{ + rwlock_t *rwlock; + int ret; + + /* pthread_testcancel(); */ + ret = rwl_ref(rwlock_,0); + if(ret != 0) return ret; + + rwlock = (rwlock_t *)*rwlock_; + ret = rwlock_gain_both_locks(rwlock); + if (ret != 0) + return rwl_unref(rwlock_,ret); + + if (rwlock->nex_count == 0) + { + if (rwlock->ncomplete > 0) + { + rwlock->nsh_count -= rwlock->ncomplete; + rwlock->ncomplete = 0; + } + if (rwlock->nsh_count > 0) + { + rwlock->ncomplete = -rwlock->nsh_count; + pthread_cleanup_push(st_cancelwrite, (void *) rwlock); + do { + ret = pthread_cond_wait(&rwlock->ccomplete, &rwlock->mcomplete); + } while (!ret && rwlock->ncomplete < 0); + + pthread_cleanup_pop(!ret ? 0 : 1); + if (!ret) + rwlock->nsh_count = 0; + } + } + if(!ret) + InterlockedIncrement((long*)&rwlock->nex_count); + return rwl_unref(rwlock_,ret); +} + +int pthread_rwlock_timedwrlock (pthread_rwlock_t *rwlock_, const struct timespec *ts) +{ + int ret; + rwlock_t *rwlock; + + /* pthread_testcancel(); */ + if (!rwlock_ || !ts) + return EINVAL; + if ((ret = rwl_ref(rwlock_,0)) != 0) + return ret; + rwlock = (rwlock_t *)*rwlock_; + + ret = pthread_mutex_timedlock(&rwlock->mex, ts); + if (ret != 0) + return rwl_unref(rwlock_,ret); + ret = pthread_mutex_timedlock (&rwlock->mcomplete, ts); + if (ret != 0) + { + pthread_mutex_unlock(&rwlock->mex); + return rwl_unref(rwlock_,ret); + } + if (rwlock->nex_count == 0) + { + if (rwlock->ncomplete > 0) + { + rwlock->nsh_count -= rwlock->ncomplete; + rwlock->ncomplete = 0; + } + if (rwlock->nsh_count > 0) + { + rwlock->ncomplete = -rwlock->nsh_count; + pthread_cleanup_push(st_cancelwrite, (void *) rwlock); + do { + ret = pthread_cond_timedwait(&rwlock->ccomplete, &rwlock->mcomplete, ts); + } while (rwlock->ncomplete < 0 && !ret); + pthread_cleanup_pop(!ret ? 0 : 1); + + if (!ret) + rwlock->nsh_count = 0; + } + } + if(!ret) + InterlockedIncrement((long*)&rwlock->nex_count); + return rwl_unref(rwlock_,ret); +} + +int pthread_rwlockattr_destroy(pthread_rwlockattr_t *a) +{ + if (!a) + return EINVAL; + return 0; +} + +int pthread_rwlockattr_init(pthread_rwlockattr_t *a) +{ + if (!a) + return EINVAL; + *a = PTHREAD_PROCESS_PRIVATE; + return 0; +} + +int pthread_rwlockattr_getpshared(pthread_rwlockattr_t *a, int *s) +{ + if (!a || !s) + return EINVAL; + *s = *a; + return 0; +} + +int pthread_rwlockattr_setpshared(pthread_rwlockattr_t *a, int s) +{ + if (!a || (s != PTHREAD_PROCESS_SHARED && s != PTHREAD_PROCESS_PRIVATE)) + return EINVAL; + *a = s; + return 0; +} diff --git a/lib/libc/mingw/winpthreads/rwlock.h b/lib/libc/mingw/winpthreads/rwlock.h @@ -0,0 +1,49 @@ +/* + Copyright (c) 2011-2016 mingw-w64 project + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#ifndef WIN_PTHREADS_RWLOCK_H +#define WIN_PTHREADS_RWLOCK_H + +#define LIFE_RWLOCK 0xBAB1F0ED +#define DEAD_RWLOCK 0xDEADB0EF + +#define STATIC_RWL_INITIALIZER(x) ((pthread_rwlock_t)(x) == ((pthread_rwlock_t)PTHREAD_RWLOCK_INITIALIZER)) + +typedef struct rwlock_t rwlock_t; +struct rwlock_t { + unsigned int valid; + int busy; + LONG nex_count; /* Exclusive access counter. */ + LONG nsh_count; /* Shared access counter. */ + LONG ncomplete; /* Shared completed counter. */ + pthread_mutex_t mex; /* Exclusive access protection. */ + pthread_mutex_t mcomplete; /* Shared completed protection. */ + pthread_cond_t ccomplete; /* Shared access completed queue. */ +}; + +#define RWL_SET 0x01 +#define RWL_TRY 0x02 + +void rwl_print(volatile pthread_rwlock_t *rwl, char *txt); +void rwl_print_set(int state); + +#endif diff --git a/lib/libc/mingw/winpthreads/sched.c b/lib/libc/mingw/winpthreads/sched.c @@ -0,0 +1,218 @@ +/* + Copyright (c) 2011-2016 mingw-w64 project + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#include <windows.h> +#include <stdio.h> +#include "pthread.h" +#include "thread.h" + +#include "misc.h" + +int sched_get_priority_min(int pol) +{ + if (pol < SCHED_MIN || pol > SCHED_MAX) { + errno = EINVAL; + return -1; + } + + return THREAD_PRIORITY_IDLE; +} + +int sched_get_priority_max(int pol) +{ + if (pol < SCHED_MIN || pol > SCHED_MAX) { + errno = EINVAL; + return -1; + } + + return THREAD_PRIORITY_TIME_CRITICAL; +} + +int pthread_attr_setschedparam(pthread_attr_t *attr, const struct sched_param *p) +{ + int r = 0; + + if (attr == NULL || p == NULL) { + return EINVAL; + } + memcpy(&attr->param, p, sizeof (*p)); + return r; +} + +int pthread_attr_getschedparam(const pthread_attr_t *attr, struct sched_param *p) +{ + int r = 0; + + if (attr == NULL || p == NULL) { + return EINVAL; + } + memcpy(p, &attr->param, sizeof (*p)); + return r; +} + +int pthread_attr_setschedpolicy (pthread_attr_t *attr, int pol) +{ + if (!attr || pol < SCHED_MIN || pol > SCHED_MAX) + return EINVAL; + if (pol != SCHED_OTHER) + return ENOTSUP; + return 0; +} + +int pthread_attr_getschedpolicy (const pthread_attr_t *attr, int *pol) +{ + if (!attr || !pol) + return EINVAL; + *pol = SCHED_OTHER; + return 0; +} + +static int pthread_check(pthread_t t) +{ + struct _pthread_v *pv; + + if (!t) + return ESRCH; + pv = __pth_gpointer_locked (t); + if (pv->ended == 0) + return 0; + CHECK_OBJECT(pv, ESRCH); + return 0; +} + +int pthread_getschedparam(pthread_t t, int *pol, struct sched_param *p) +{ + int r; + //if (!t) + // t = pthread_self(); + + if ((r = pthread_check(t)) != 0) + { + return r; + } + + if (!p || !pol) + { + return EINVAL; + } + *pol = __pth_gpointer_locked (t)->sched_pol; + p->sched_priority = __pth_gpointer_locked (t)->sched.sched_priority; + + return 0; +} + +int pthread_setschedparam(pthread_t t, int pol, const struct sched_param *p) +{ + struct _pthread_v *pv; + int r, pr = 0; + //if (!t.p) t = pthread_self(); + + if ((r = pthread_check(t)) != 0) + return r; + + if (pol < SCHED_MIN || pol > SCHED_MAX || p == NULL) + return EINVAL; + if (pol != SCHED_OTHER) + return ENOTSUP; + pr = p->sched_priority; + if (pr < sched_get_priority_min(pol) || pr > sched_get_priority_max(pol)) + return EINVAL; + + /* See msdn: there are actually 7 priorities: + THREAD_PRIORITY_IDLE - -15 + THREAD_PRIORITY_LOWEST -2 + THREAD_PRIORITY_BELOW_NORMAL -1 + THREAD_PRIORITY_NORMAL 0 + THREAD_PRIORITY_ABOVE_NORMAL 1 + THREAD_PRIORITY_HIGHEST 2 + THREAD_PRIORITY_TIME_CRITICAL 15 + */ + if (pr <= THREAD_PRIORITY_IDLE) { + pr = THREAD_PRIORITY_IDLE; + } else if (pr <= THREAD_PRIORITY_LOWEST) { + pr = THREAD_PRIORITY_LOWEST; + } else if (pr >= THREAD_PRIORITY_TIME_CRITICAL) { + pr = THREAD_PRIORITY_TIME_CRITICAL; + } else if (pr >= THREAD_PRIORITY_HIGHEST) { + pr = THREAD_PRIORITY_HIGHEST; + } + pv = __pth_gpointer_locked (t); + if (SetThreadPriority(pv->h, pr)) { + pv->sched_pol = pol; + pv->sched.sched_priority = p->sched_priority; + } else + r = EINVAL; + return r; +} + +int sched_getscheduler(pid_t pid) +{ + if (pid != 0) + { + HANDLE h = NULL; + int selfPid = (int) GetCurrentProcessId (); + + if (pid != (pid_t) selfPid && (h = OpenProcess (PROCESS_QUERY_INFORMATION, 0, (DWORD) pid)) == NULL) + { + errno = (GetLastError () == (0xFF & ERROR_ACCESS_DENIED)) ? EPERM : ESRCH; + return -1; + } + if (h) + CloseHandle (h); + } + return SCHED_OTHER; +} + +int sched_setscheduler(pid_t pid, int pol, const struct sched_param *param) +{ + if (!param) + { + errno = EINVAL; + return -1; + } + if (pid != 0) + { + HANDLE h = NULL; + int selfPid = (int) GetCurrentProcessId (); + + if (pid != (pid_t) selfPid && (h = OpenProcess (PROCESS_SET_INFORMATION, 0, (DWORD) pid)) == NULL) + { + errno = (GetLastError () == (0xFF & ERROR_ACCESS_DENIED)) ? EPERM : ESRCH; + return -1; + } + if (h) + CloseHandle (h); + } + + if (pol != SCHED_OTHER) + { + errno = ENOSYS; + return -1; + } + return SCHED_OTHER; +} + +int sched_yield(void) +{ + Sleep(0); + return 0; +} diff --git a/lib/libc/mingw/winpthreads/sem.c b/lib/libc/mingw/winpthreads/sem.c @@ -0,0 +1,354 @@ +/* + Copyright (c) 2011-2016 mingw-w64 project + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#include <windows.h> +#include <stdio.h> +#include <malloc.h> +#include "pthread.h" +#include "thread.h" +#include "misc.h" +#include "semaphore.h" +#include "sem.h" +#include "ref.h" + +int do_sema_b_wait_intern (HANDLE sema, int nointerrupt, DWORD timeout); + +static int +sem_result (int res) +{ + if (res != 0) { + errno = res; + return -1; + } + return 0; +} + +int +sem_init (sem_t *sem, int pshared, unsigned int value) +{ + _sem_t *sv; + + if (!sem || value > (unsigned int)SEM_VALUE_MAX) + return sem_result (EINVAL); + if (pshared != PTHREAD_PROCESS_PRIVATE) + return sem_result (EPERM); + + if ((sv = (sem_t) calloc (1,sizeof (*sv))) == NULL) + return sem_result (ENOMEM); + + sv->value = value; + if (pthread_mutex_init (&sv->vlock, NULL) != 0) + { + free (sv); + return sem_result (ENOSPC); + } + if ((sv->s = CreateSemaphore (NULL, 0, SEM_VALUE_MAX, NULL)) == NULL) + { + pthread_mutex_destroy (&sv->vlock); + free (sv); + return sem_result (ENOSPC); + } + + sv->valid = LIFE_SEM; + *sem = sv; + return 0; +} + +int +sem_destroy (sem_t *sem) +{ + int r; + _sem_t *sv = NULL; + + if (!sem || (sv = *sem) == NULL) + return sem_result (EINVAL); + if ((r = pthread_mutex_lock (&sv->vlock)) != 0) + return sem_result (r); + +#if 0 + /* We don't wait for destroying a semaphore ... + or? */ + if (sv->value < 0) + { + pthread_mutex_unlock (&sv->vlock); + return sem_result (EBUSY); + } +#endif + + if (!CloseHandle (sv->s)) + { + pthread_mutex_unlock (&sv->vlock); + return sem_result (EINVAL); + } + *sem = NULL; + sv->value = SEM_VALUE_MAX; + pthread_mutex_unlock(&sv->vlock); + Sleep (0); + while (pthread_mutex_destroy (&sv->vlock) == EBUSY) + Sleep (0); + sv->valid = DEAD_SEM; + free (sv); + return 0; +} + +static int +sem_std_enter (sem_t *sem,_sem_t **svp, int do_test) +{ + int r; + _sem_t *sv; + + if (do_test) + pthread_testcancel (); + if (!sem) + return sem_result (EINVAL); + sv = *sem; + if (sv == NULL) + return sem_result (EINVAL); + + if ((r = pthread_mutex_lock (&sv->vlock)) != 0) + return sem_result (r); + + if (*sem == NULL) + { + pthread_mutex_unlock(&sv->vlock); + return sem_result (EINVAL); + } + *svp = sv; + return 0; +} + +int +sem_trywait (sem_t *sem) +{ + _sem_t *sv; + + if (sem_std_enter (sem, &sv, 0) != 0) + return -1; + if (sv->value <= 0) + { + pthread_mutex_unlock (&sv->vlock); + return sem_result (EAGAIN); + } + sv->value--; + pthread_mutex_unlock (&sv->vlock); + + return 0; +} + +struct sSemTimedWait +{ + sem_t *p; + int *ret; +}; + +static void +clean_wait_sem (void *s) +{ + struct sSemTimedWait *p = (struct sSemTimedWait *) s; + _sem_t *sv = NULL; + + if (sem_std_enter (p->p, &sv, 0) != 0) + return; + + if (WaitForSingleObject (sv->s, 0) != WAIT_OBJECT_0) + InterlockedIncrement (&sv->value); + else if (p->ret) + p->ret[0] = 0; + pthread_mutex_unlock (&sv->vlock); +} + +int +sem_wait (sem_t *sem) +{ + long cur_v; + int ret = 0; + _sem_t *sv; + HANDLE semh; + struct sSemTimedWait arg; + + if (sem_std_enter (sem, &sv, 1) != 0) + return -1; + + arg.ret = &ret; + arg.p = sem; + InterlockedDecrement (&sv->value); + cur_v = sv->value; + semh = sv->s; + pthread_mutex_unlock (&sv->vlock); + + if (cur_v >= 0) + return 0; + else + { + pthread_cleanup_push (clean_wait_sem, (void *) &arg); + ret = do_sema_b_wait_intern (semh, 2, INFINITE); + pthread_cleanup_pop (ret); + if (ret == EINVAL) + return 0; + } + + if (!ret) + return 0; + + return sem_result (ret); +} + +int +sem_timedwait (sem_t *sem, const struct timespec *t) +{ + int cur_v, ret = 0; + DWORD dwr; + HANDLE semh; + _sem_t *sv; + struct sSemTimedWait arg; + + if (!t) + return sem_wait (sem); + dwr = dwMilliSecs(_pthread_rel_time_in_ms (t)); + + if (sem_std_enter (sem, &sv, 1) != 0) + return -1; + + arg.ret = &ret; + arg.p = sem; + InterlockedDecrement (&sv->value); + cur_v = sv->value; + semh = sv->s; + pthread_mutex_unlock(&sv->vlock); + + if (cur_v >= 0) + return 0; + else + { + pthread_cleanup_push (clean_wait_sem, (void *) &arg); + ret = do_sema_b_wait_intern (semh, 2, dwr); + pthread_cleanup_pop (ret); + if (ret == EINVAL) + return 0; + } + + if (!ret) + return 0; + return sem_result (ret); +} + +int +sem_post (sem_t *sem) +{ + _sem_t *sv; + + if (sem_std_enter (sem, &sv, 0) != 0) + return -1; + + if (sv->value >= SEM_VALUE_MAX) + { + pthread_mutex_unlock (&sv->vlock); + return sem_result (ERANGE); + } + InterlockedIncrement (&sv->value); + if (sv->value > 0 || ReleaseSemaphore (sv->s, 1, NULL)) + { + pthread_mutex_unlock (&sv->vlock); + return 0; + } + InterlockedDecrement (&sv->value); + pthread_mutex_unlock (&sv->vlock); + + return sem_result (EINVAL); +} + +int +sem_post_multiple (sem_t *sem, int count) +{ + int waiters_count; + _sem_t *sv; + + if (count <= 0) + return sem_result (EINVAL); + if (sem_std_enter (sem, &sv, 0) != 0) + return -1; + + if (sv->value > (SEM_VALUE_MAX - count)) + { + pthread_mutex_unlock (&sv->vlock); + return sem_result (ERANGE); + } + waiters_count = -sv->value; + sv->value += count; + /*InterlockedExchangeAdd((long*)&sv->value, (long) count);*/ + if (waiters_count <= 0 + || ReleaseSemaphore (sv->s, + (waiters_count < count ? waiters_count + : count), NULL)) + { + pthread_mutex_unlock(&sv->vlock); + return 0; + } + /*InterlockedExchangeAdd((long*)&sv->value, -((long) count));*/ + sv->value -= count; + pthread_mutex_unlock(&sv->vlock); + return sem_result (EINVAL); +} + +sem_t * +sem_open (const char *name, int oflag, mode_t mode, unsigned int value) +{ + sem_result (ENOSYS); + return NULL; +} + +int +sem_close (sem_t *sem) +{ + return sem_result (ENOSYS); +} + +int +sem_unlink (const char *name) +{ + return sem_result (ENOSYS); +} + +int +sem_getvalue (sem_t *sem, int *sval) +{ + _sem_t *sv; + int r; + + if (!sval) + return sem_result (EINVAL); + + if (!sem || (sv = *sem) == NULL) + return sem_result (EINVAL); + + if ((r = pthread_mutex_lock (&sv->vlock)) != 0) + return sem_result (r); + if (*sem == NULL) + { + pthread_mutex_unlock (&sv->vlock); + return sem_result (EINVAL); + } + + *sval = (int) sv->value; + pthread_mutex_unlock (&sv->vlock); + return 0; +} diff --git a/lib/libc/mingw/winpthreads/sem.h b/lib/libc/mingw/winpthreads/sem.h @@ -0,0 +1,40 @@ +/* + Copyright (c) 2011-2016 mingw-w64 project + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#ifndef WIN_SEM +#define WIN_SEM + +#include <windows.h> + +#define LIFE_SEM 0xBAB1F00D +#define DEAD_SEM 0xDEADBEEF + +typedef struct _sem_t _sem_t; +struct _sem_t +{ + unsigned int valid; + HANDLE s; + volatile long value; + pthread_mutex_t vlock; +}; + +#endif /* WIN_SEM */ diff --git a/lib/libc/mingw/winpthreads/spinlock.c b/lib/libc/mingw/winpthreads/spinlock.c @@ -0,0 +1,74 @@ +/* + Copyright (c) 2013 mingw-w64 project + Copyright (c) 2015 Intel Corporation + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#include <windows.h> +#include "pthread.h" +#include "misc.h" + +/* We use the pthread_spinlock_t itself as a lock: + -1 is free, 0 is locked. + (This is dictated by PTHREAD_SPINLOCK_INITIALIZER, which we can't change + without breaking binary compatibility.) */ +typedef intptr_t spinlock_word_t; + +int +pthread_spin_init (pthread_spinlock_t *lock, int pshared) +{ + spinlock_word_t *lk = (spinlock_word_t *)lock; + *lk = -1; + return 0; +} + + +int +pthread_spin_destroy (pthread_spinlock_t *lock) +{ + return 0; +} + +int +pthread_spin_lock (pthread_spinlock_t *lock) +{ + volatile spinlock_word_t *lk = (volatile spinlock_word_t *)lock; + while (unlikely(InterlockedExchangePointer((PVOID volatile *)lk, 0) == 0)) + do { + YieldProcessor(); + } while (*lk == 0); + return 0; +} + +int +pthread_spin_trylock (pthread_spinlock_t *lock) +{ + spinlock_word_t *lk = (spinlock_word_t *)lock; + return InterlockedExchangePointer((PVOID volatile *)lk, 0) == 0 ? EBUSY : 0; +} + + +int +pthread_spin_unlock (pthread_spinlock_t *lock) +{ + volatile spinlock_word_t *lk = (volatile spinlock_word_t *)lock; + *lk = -1; + return 0; +} diff --git a/lib/libc/mingw/winpthreads/thread.c b/lib/libc/mingw/winpthreads/thread.c @@ -0,0 +1,1929 @@ +/* + Copyright (c) 2011-2016 mingw-w64 project + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#include <windows.h> +#include <strsafe.h> +#include <stdio.h> +#include <stdlib.h> +#include <malloc.h> +#include <signal.h> +#include "pthread.h" +#include "thread.h" +#include "misc.h" +#include "winpthread_internal.h" + +static _pthread_v *__pthread_self_lite (void); + +void (**_pthread_key_dest)(void *) = NULL; + +static volatile long _pthread_cancelling; +static int _pthread_concur; + +/* FIXME Will default to zero as needed */ +static pthread_once_t _pthread_tls_once; +static DWORD _pthread_tls = 0xffffffff; + +static pthread_rwlock_t _pthread_key_lock = PTHREAD_RWLOCK_INITIALIZER; +static unsigned long _pthread_key_max=0L; +static unsigned long _pthread_key_sch=0L; + +static _pthread_v *pthr_root = NULL, *pthr_last = NULL; +static pthread_mutex_t mtx_pthr_locked = PTHREAD_RECURSIVE_MUTEX_INITIALIZER; + +static __pthread_idlist *idList = NULL; +static size_t idListCnt = 0; +static size_t idListMax = 0; +static pthread_t idListNextId = 0; + +#if !defined(_MSC_VER) +#define USE_VEH_FOR_MSC_SETTHREADNAME +#endif +#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) +/* forbidden RemoveVectoredExceptionHandler/AddVectoredExceptionHandler APIs */ +#undef USE_VEH_FOR_MSC_SETTHREADNAME +#endif + +#if defined(USE_VEH_FOR_MSC_SETTHREADNAME) +static void *SetThreadName_VEH_handle = NULL; + +static LONG __stdcall +SetThreadName_VEH (PEXCEPTION_POINTERS ExceptionInfo) +{ + if (ExceptionInfo->ExceptionRecord != NULL && + ExceptionInfo->ExceptionRecord->ExceptionCode == EXCEPTION_SET_THREAD_NAME) + return EXCEPTION_CONTINUE_EXECUTION; + + return EXCEPTION_CONTINUE_SEARCH; +} + +static PVOID (WINAPI *AddVectoredExceptionHandlerFuncPtr) (ULONG, PVECTORED_EXCEPTION_HANDLER); +static ULONG (WINAPI *RemoveVectoredExceptionHandlerFuncPtr) (PVOID); + +static void __attribute__((constructor)) +ctor (void) +{ + HMODULE module = GetModuleHandleA("kernel32.dll"); + if (module) { + AddVectoredExceptionHandlerFuncPtr = (__typeof__(AddVectoredExceptionHandlerFuncPtr)) GetProcAddress(module, "AddVectoredExceptionHandler"); + RemoveVectoredExceptionHandlerFuncPtr = (__typeof__(RemoveVectoredExceptionHandlerFuncPtr)) GetProcAddress(module, "RemoveVectoredExceptionHandler"); + } +} +#endif + +typedef struct _THREADNAME_INFO +{ + DWORD dwType; /* must be 0x1000 */ + LPCSTR szName; /* pointer to name (in user addr space) */ + DWORD dwThreadID; /* thread ID (-1=caller thread) */ + DWORD dwFlags; /* reserved for future use, must be zero */ +} THREADNAME_INFO; + +static void +SetThreadName (DWORD dwThreadID, LPCSTR szThreadName) +{ + THREADNAME_INFO info; + DWORD infosize; + + info.dwType = 0x1000; + info.szName = szThreadName; + info.dwThreadID = dwThreadID; + info.dwFlags = 0; + + infosize = sizeof (info) / sizeof (ULONG_PTR); + +#if defined(_MSC_VER) && !defined (USE_VEH_FOR_MSC_SETTHREADNAME) + __try + { + RaiseException (EXCEPTION_SET_THREAD_NAME, 0, infosize, (ULONG_PTR *)&info); + } + __except (EXCEPTION_EXECUTE_HANDLER) + { + } +#else + /* Without a debugger we *must* have an exception handler, + * otherwise raising an exception will crash the process. + */ +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) + if ((!IsDebuggerPresent ()) && (SetThreadName_VEH_handle == NULL)) +#else + if (!IsDebuggerPresent ()) +#endif + return; + + RaiseException (EXCEPTION_SET_THREAD_NAME, 0, infosize, (ULONG_PTR *) &info); +#endif +} + +/* Search the list idList for an element with identifier ID. If + found, its associated _pthread_v pointer is returned, otherwise + NULL. + NOTE: This method is not locked. */ +static struct _pthread_v * +__pthread_get_pointer (pthread_t id) +{ + size_t l, r, p; + if (!idListCnt) + return NULL; + if (idListCnt == 1) + return (idList[0].id == id ? idList[0].ptr : NULL); + l = 0; r = idListCnt - 1; + while (l <= r) + { + p = (l + r) >> 1; + if (idList[p].id == id) + return idList[p].ptr; + else if (idList[p].id > id) + { + if (p == l) + return NULL; + r = p - 1; + } + else + { + l = p + 1; + } + } + + return NULL; +} + +static void +__pth_remove_use_for_key (pthread_key_t key) +{ + int i; + + pthread_mutex_lock (&mtx_pthr_locked); + for (i = 0; i < idListCnt; i++) + { + if (idList[i].ptr != NULL + && idList[i].ptr->keyval != NULL + && key < idList[i].ptr->keymax) + { + idList[i].ptr->keyval[key] = NULL; + idList[i].ptr->keyval_set[key] = 0; + } + } + pthread_mutex_unlock (&mtx_pthr_locked); +} + +/* Search the list idList for an element with identifier ID. If + found, its associated _pthread_v pointer is returned, otherwise + NULL. + NOTE: This method uses lock mtx_pthr_locked. */ +struct _pthread_v * +__pth_gpointer_locked (pthread_t id) +{ + struct _pthread_v *ret; + if (!id) + return NULL; + pthread_mutex_lock (&mtx_pthr_locked); + ret = __pthread_get_pointer (id); + pthread_mutex_unlock (&mtx_pthr_locked); + return ret; +} + +/* Registers in the list idList an element with _pthread_v pointer + and creates and unique identifier ID. If successful created the + ID of this element is returned, otherwise on failure zero ID gets + returned. + NOTE: This method is not locked. */ +static pthread_t +__pthread_register_pointer (struct _pthread_v *ptr) +{ + __pthread_idlist *e; + size_t i; + + if (!ptr) + return 0; + /* Check if a resize of list is necessary. */ + if (idListCnt >= idListMax) + { + if (!idListCnt) + { + e = (__pthread_idlist *) malloc (sizeof (__pthread_idlist) * 16); + if (!e) + return 0; + idListMax = 16; + idList = e; + } + else + { + e = (__pthread_idlist *) realloc (idList, sizeof (__pthread_idlist) * (idListMax + 16)); + if (!e) + return 0; + idListMax += 16; + idList = e; + } + } + do + { + ++idListNextId; + /* If two MSB are set we reset to id 1. We need to check here bits + to avoid gcc's no-overflow issue on increment. Additionally we + need to handle different size of pthread_t on 32-bit/64-bit. */ + if ((idListNextId & ( ((pthread_t) 1) << ((sizeof (pthread_t) * 8) - 2))) != 0) + idListNextId = 1; + } + while (idListNextId == 0 || __pthread_get_pointer (idListNextId)); + /* We assume insert at end of list. */ + i = idListCnt; + if (i != 0) + { + /* Find position we can actual insert sorted. */ + while (i > 0 && idList[i - 1].id > idListNextId) + --i; + if (i != idListCnt) + memmove (&idList[i + 1], &idList[i], sizeof (__pthread_idlist) * (idListCnt - i)); + } + idList[i].id = idListNextId; + idList[i].ptr = ptr; + ++idListCnt; + return idListNextId; +} + +/* Deregisters in the list idList an element with identifier ID and + returns its _pthread_v pointer on success. Otherwise NULL is returned. + NOTE: This method is not locked. */ +static struct _pthread_v * +__pthread_deregister_pointer (pthread_t id) +{ + size_t l, r, p; + if (!idListCnt) + return NULL; + l = 0; r = idListCnt - 1; + while (l <= r) + { + p = (l + r) >> 1; + if (idList[p].id == id) + { + struct _pthread_v *ret = idList[p].ptr; + p++; + if (p < idListCnt) + memmove (&idList[p - 1], &idList[p], sizeof (__pthread_idlist) * (idListCnt - p)); + --idListCnt; + /* Is this last element in list then free list. */ + if (idListCnt == 0) + { + free (idList); + idListCnt = idListMax = 0; + } + return ret; + } + else if (idList[p].id > id) + { + if (p == l) + return NULL; + r = p - 1; + } + else + { + l = p + 1; + } + } + return NULL; +} + +/* Save a _pthread_v element for reuse in pool. */ +static void +push_pthread_mem (_pthread_v *sv) +{ + if (!sv || sv->next != NULL) + return; + pthread_mutex_lock (&mtx_pthr_locked); + if (sv->x != 0) + __pthread_deregister_pointer (sv->x); + if (sv->keyval) + free (sv->keyval); + if (sv->keyval_set) + free (sv->keyval_set); + if (sv->thread_name) + free (sv->thread_name); + memset (sv, 0, sizeof(struct _pthread_v)); + if (pthr_last == NULL) + pthr_root = pthr_last = sv; + else + { + pthr_last->next = sv; + pthr_last = sv; + } + pthread_mutex_unlock (&mtx_pthr_locked); +} + +/* Get a _pthread_v element from pool, or allocate it. + Note the unique identifier is created for the element here, too. */ +static _pthread_v * +pop_pthread_mem (void) +{ + _pthread_v *r = NULL; + + pthread_mutex_lock (&mtx_pthr_locked); + if ((r = pthr_root) == NULL) + { + if ((r = (_pthread_v *)calloc (1,sizeof(struct _pthread_v))) != NULL) + { + r->x = __pthread_register_pointer (r); + if (r->x == 0) + { + free (r); + r = NULL; + } + } + pthread_mutex_unlock (&mtx_pthr_locked); + return r; + } + r->x = __pthread_register_pointer (r); + if (r->x == 0) + r = NULL; + else + { + if((pthr_root = r->next) == NULL) + pthr_last = NULL; + + r->next = NULL; + } + pthread_mutex_unlock (&mtx_pthr_locked); + return r; +} + +/* Free memory consumed in _pthread_v pointer pool. */ +static void +free_pthread_mem (void) +{ +#if 0 + _pthread_v *t; + + pthread_mutex_lock (&mtx_pthr_locked); + t = pthr_root; + while (t != NULL) + { + _pthread_v *sv = t; + t = t->next; + if (sv->x != 0 && sv->ended == 0 && sv->valid != DEAD_THREAD) + { + pthread_mutex_unlock (&mtx_pthr_locked); + pthread_cancel (t->x); + Sleep (0); + pthread_mutex_lock (&mtx_pthr_locked); + t = pthr_root; + continue; + } + else if (sv->x != 0 && sv->valid != DEAD_THREAD) + { + pthread_mutex_unlock (&mtx_pthr_locked); + Sleep (0); + pthread_mutex_lock (&mtx_pthr_locked); + continue; + } + if (sv->x != 0) + __pthread_deregister_pointer (sv->x); + sv->x = 0; + free (sv); + pthr_root = t; + } + pthread_mutex_unlock (&mtx_pthr_locked); +#endif + return; +} + +static void +replace_spin_keys (pthread_spinlock_t *old, pthread_spinlock_t new) +{ + if (old == NULL) + return; + + if (EPERM == pthread_spin_destroy (old)) + { +#define THREADERR "Error cleaning up spin_keys for thread %lu.\n" + char threaderr[sizeof(THREADERR) + 8] = { 0 }; + snprintf(threaderr, sizeof(threaderr), THREADERR, GetCurrentThreadId()); +#undef THREADERR + OutputDebugStringA (threaderr); + abort (); + } + + *old = new; +} + +/* Hook for TLS-based deregistration/registration of thread. */ +static void WINAPI +__dyn_tls_pthread (HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved) +{ + _pthread_v *t = NULL; + pthread_spinlock_t new_spin_keys = PTHREAD_SPINLOCK_INITIALIZER; + + if (dwReason == DLL_PROCESS_DETACH) + { +#if defined(USE_VEH_FOR_MSC_SETTHREADNAME) + if (lpreserved == NULL && SetThreadName_VEH_handle != NULL) + { + if (RemoveVectoredExceptionHandlerFuncPtr != NULL) + RemoveVectoredExceptionHandlerFuncPtr (SetThreadName_VEH_handle); + SetThreadName_VEH_handle = NULL; + } +#endif + free_pthread_mem (); + } + else if (dwReason == DLL_PROCESS_ATTACH) + { +#if defined(USE_VEH_FOR_MSC_SETTHREADNAME) + if (AddVectoredExceptionHandlerFuncPtr != NULL) + SetThreadName_VEH_handle = AddVectoredExceptionHandlerFuncPtr (1, &SetThreadName_VEH); + else + SetThreadName_VEH_handle = NULL; + /* Can't do anything on error anyway, check for NULL later */ +#endif + } + else if (dwReason == DLL_THREAD_DETACH) + { + if (_pthread_tls != 0xffffffff) + t = (_pthread_v *)TlsGetValue(_pthread_tls); + if (t && t->thread_noposix != 0) + { + _pthread_cleanup_dest (t->x); + if (t->h != NULL) + { + CloseHandle (t->h); + if (t->evStart) + CloseHandle (t->evStart); + t->evStart = NULL; + t->h = NULL; + } + pthread_mutex_destroy (&t->p_clock); + replace_spin_keys (&t->spin_keys, new_spin_keys); + push_pthread_mem (t); + t = NULL; + TlsSetValue (_pthread_tls, t); + } + else if (t && t->ended == 0) + { + if (t->evStart) + CloseHandle(t->evStart); + t->evStart = NULL; + t->ended = 1; + _pthread_cleanup_dest (t->x); + if ((t->p_state & PTHREAD_CREATE_DETACHED) == PTHREAD_CREATE_DETACHED) + { + t->valid = DEAD_THREAD; + if (t->h != NULL) + CloseHandle (t->h); + t->h = NULL; + pthread_mutex_destroy(&t->p_clock); + replace_spin_keys (&t->spin_keys, new_spin_keys); + push_pthread_mem (t); + t = NULL; + TlsSetValue (_pthread_tls, t); + return; + } + pthread_mutex_destroy(&t->p_clock); + replace_spin_keys (&t->spin_keys, new_spin_keys); + } + else if (t) + { + if (t->evStart) + CloseHandle (t->evStart); + t->evStart = NULL; + pthread_mutex_destroy (&t->p_clock); + replace_spin_keys (&t->spin_keys, new_spin_keys); + } + } +} + +/* TLS-runtime section variable. */ + +#if defined(_MSC_VER) +/* Force a reference to _tls_used to make the linker create the TLS + * directory if it's not already there. (e.g. if __declspec(thread) + * is not used). + * Force a reference to __xl_f to prevent whole program optimization + * from discarding the variable. */ + +/* On x86, symbols are prefixed with an underscore. */ +# if defined(_M_IX86) +# pragma comment(linker, "/include:__tls_used") +# pragma comment(linker, "/include:___xl_f") +# else +# pragma comment(linker, "/include:_tls_used") +# pragma comment(linker, "/include:__xl_f") +# endif + +/* .CRT$XLA to .CRT$XLZ is an array of PIMAGE_TLS_CALLBACK + * pointers. Pick an arbitrary location for our callback. + * + * See VC\...\crt\src\vcruntime\tlssup.cpp for reference. */ + +# pragma section(".CRT$XLF", long, read) +#endif + +WINPTHREADS_ATTRIBUTE((WINPTHREADS_SECTION(".CRT$XLF"))) +extern const PIMAGE_TLS_CALLBACK __xl_f; +const PIMAGE_TLS_CALLBACK __xl_f = __dyn_tls_pthread; + + +#ifdef WINPTHREAD_DBG +static int print_state = 0; +void thread_print_set (int state) +{ + print_state = state; +} + +void +thread_print (volatile pthread_t t, char *txt) +{ + if (!print_state) + return; + if (!t) + printf("T%p %lu %s\n",NULL,GetCurrentThreadId(),txt); + else + { + printf("T%p %lu V=%0X H=%p %s\n", + (void *) __pth_gpointer_locked (t), + GetCurrentThreadId(), + (__pth_gpointer_locked (t))->valid, + (__pth_gpointer_locked (t))->h, + txt + ); + } +} +#endif + +/* Internal collect-once structure. */ +typedef struct collect_once_t { + pthread_once_t *o; + pthread_mutex_t m; + int count; + struct collect_once_t *next; +} collect_once_t; + +static collect_once_t *once_obj = NULL; + +static pthread_spinlock_t once_global = PTHREAD_SPINLOCK_INITIALIZER; + +static collect_once_t * +enterOnceObject (pthread_once_t *o) +{ + collect_once_t *c, *p = NULL; + pthread_spin_lock (&once_global); + c = once_obj; + while (c != NULL && c->o != o) + { + c = (p = c)->next; + } + if (!c) + { + c = (collect_once_t *) calloc(1,sizeof(collect_once_t)); + c->o = o; + c->count = 1; + if (!p) + once_obj = c; + else + p->next = c; + pthread_mutex_init(&c->m, NULL); + } + else + c->count += 1; + pthread_spin_unlock (&once_global); + return c; +} + +static void +leaveOnceObject (collect_once_t *c) +{ + collect_once_t *h, *p = NULL; + if (!c) + return; + pthread_spin_lock (&once_global); + h = once_obj; + while (h != NULL && c != h) + h = (p = h)->next; + + if (h) + { + c->count -= 1; + if (c->count == 0) + { + pthread_mutex_destroy(&c->m); + if (!p) + once_obj = c->next; + else + p->next = c->next; + free (c); + } + } + else + fprintf(stderr, "%p not found?!?!\n", (void *) c); + pthread_spin_unlock (&once_global); +} + +static void +_pthread_once_cleanup (void *o) +{ + collect_once_t *co = (collect_once_t *) o; + pthread_mutex_unlock (&co->m); + leaveOnceObject (co); +} + +static int +_pthread_once_raw (pthread_once_t *o, void (*func)(void)) +{ + collect_once_t *co; + long state = *o; + + CHECK_PTR(o); + CHECK_PTR(func); + + if (state == 1) + return 0; + co = enterOnceObject(o); + pthread_mutex_lock(&co->m); + if (*o == 0) + { + func(); + *o = 1; + } + else if (*o != 1) + fprintf (stderr," once %p is %ld\n", (void *) o, (long) *o); + pthread_mutex_unlock(&co->m); + leaveOnceObject(co); + + /* Done */ + return 0; +} + +/* Unimplemented. */ +void * +pthread_timechange_handler_np(void *dummy) +{ + return NULL; +} + +/* Compatibility routine for pthread-win32. It waits for ellapse of + interval and additionally checks for possible thread-cancelation. */ +int +pthread_delay_np (const struct timespec *interval) +{ + DWORD to = (!interval ? 0 : dwMilliSecs (_pthread_time_in_ms_from_timespec (interval))); + struct _pthread_v *s = __pthread_self_lite (); + + if (!to) + { + pthread_testcancel (); + Sleep (0); + pthread_testcancel (); + return 0; + } + pthread_testcancel (); + if (s->evStart) + _pthread_wait_for_single_object (s->evStart, to); + else + Sleep (to); + pthread_testcancel (); + return 0; +} + +int pthread_delay_np_ms (DWORD to); + +int +pthread_delay_np_ms (DWORD to) +{ + struct _pthread_v *s = __pthread_self_lite (); + + if (!to) + { + pthread_testcancel (); + Sleep (0); + pthread_testcancel (); + return 0; + } + pthread_testcancel (); + if (s->evStart) + _pthread_wait_for_single_object (s->evStart, to); + else + Sleep (to); + pthread_testcancel (); + return 0; +} + +/* Compatibility routine for pthread-win32. It returns the + amount of available CPUs on system. */ +int +pthread_num_processors_np(void) +{ + int r = 0; + DWORD_PTR ProcessAffinityMask, SystemAffinityMask; + + if (GetProcessAffinityMask(GetCurrentProcess(), &ProcessAffinityMask, &SystemAffinityMask)) + { + for(; ProcessAffinityMask != 0; ProcessAffinityMask >>= 1) + r += (ProcessAffinityMask & 1) != 0; + } + /* assume at least 1 */ + return r ? r : 1; +} + +/* Compatiblity routine for pthread-win32. Allows to set amount of used + CPUs for process. */ +int +pthread_set_num_processors_np(int n) +{ + DWORD_PTR ProcessAffinityMask, ProcessNewAffinityMask = 0, SystemAffinityMask; + int r = 0; + /* need at least 1 */ + n = n ? n : 1; + if (GetProcessAffinityMask (GetCurrentProcess (), &ProcessAffinityMask, &SystemAffinityMask)) + { + for (; ProcessAffinityMask != 0; ProcessAffinityMask >>= 1) + { + ProcessNewAffinityMask <<= 1; + if ((ProcessAffinityMask & 1) != 0 && r < n) + { + ProcessNewAffinityMask |= 1; + r++; + } + } + SetProcessAffinityMask (GetCurrentProcess (),ProcessNewAffinityMask); + } + return r; +} + +int +pthread_once (pthread_once_t *o, void (*func)(void)) +{ + collect_once_t *co; + long state = *o; + + CHECK_PTR(o); + CHECK_PTR(func); + + if (state == 1) + return 0; + co = enterOnceObject(o); + pthread_mutex_lock(&co->m); + if (*o == 0) + { + pthread_cleanup_push(_pthread_once_cleanup, co); + func(); + pthread_cleanup_pop(0); + *o = 1; + } + else if (*o != 1) + fprintf (stderr," once %p is %ld\n", (void *) o, (long) *o); + pthread_mutex_unlock(&co->m); + leaveOnceObject(co); + + return 0; +} + +int +pthread_key_create (pthread_key_t *key, void (* dest)(void *)) +{ + unsigned int i; + long nmax; + void (**d)(void *); + + if (!key) + return EINVAL; + + pthread_rwlock_wrlock (&_pthread_key_lock); + + for (i = _pthread_key_sch; i < _pthread_key_max; i++) + { + if (!_pthread_key_dest[i]) + { + *key = i; + if (dest) + _pthread_key_dest[i] = dest; + else + _pthread_key_dest[i] = (void(*)(void *))1; + pthread_rwlock_unlock (&_pthread_key_lock); + return 0; + } + } + + for (i = 0; i < _pthread_key_sch; i++) + { + if (!_pthread_key_dest[i]) + { + *key = i; + if (dest) + _pthread_key_dest[i] = dest; + else + _pthread_key_dest[i] = (void(*)(void *))1; + pthread_rwlock_unlock (&_pthread_key_lock); + + return 0; + } + } + + if (_pthread_key_max == PTHREAD_KEYS_MAX) + { + pthread_rwlock_unlock(&_pthread_key_lock); + return ENOMEM; + } + + nmax = _pthread_key_max * 2; + if (nmax == 0) + nmax = _pthread_key_max + 1; + if (nmax > PTHREAD_KEYS_MAX) + nmax = PTHREAD_KEYS_MAX; + + /* No spare room anywhere */ + d = (void (__cdecl **)(void *))realloc(_pthread_key_dest, nmax * sizeof(*d)); + if (!d) + { + pthread_rwlock_unlock (&_pthread_key_lock); + return ENOMEM; + } + + /* Clear new region */ + memset ((void *) &d[_pthread_key_max], 0, (nmax-_pthread_key_max)*sizeof(void *)); + + /* Use new region */ + _pthread_key_dest = d; + _pthread_key_sch = _pthread_key_max + 1; + *key = _pthread_key_max; + _pthread_key_max = nmax; + + if (dest) + _pthread_key_dest[*key] = dest; + else + _pthread_key_dest[*key] = (void(*)(void *))1; + + pthread_rwlock_unlock (&_pthread_key_lock); + return 0; +} + +int +pthread_key_delete (pthread_key_t key) +{ + if (key >= _pthread_key_max || !_pthread_key_dest) + return EINVAL; + + pthread_rwlock_wrlock (&_pthread_key_lock); + + _pthread_key_dest[key] = NULL; + + /* Start next search from our location */ + if (_pthread_key_sch > key) + _pthread_key_sch = key; + /* So now we need to walk the complete list of threads + and remove key's reference for it. */ + __pth_remove_use_for_key (key); + + pthread_rwlock_unlock (&_pthread_key_lock); + return 0; +} + +void * +pthread_getspecific (pthread_key_t key) +{ + DWORD lasterr = GetLastError (); + void *r; + _pthread_v *t = __pthread_self_lite (); + pthread_spin_lock (&t->spin_keys); + r = (key >= t->keymax || t->keyval_set[key] == 0 ? NULL : t->keyval[key]); + pthread_spin_unlock (&t->spin_keys); + SetLastError (lasterr); + return r; +} + +int +pthread_setspecific (pthread_key_t key, const void *value) +{ + DWORD lasterr = GetLastError (); + _pthread_v *t = __pthread_self_lite (); + + pthread_spin_lock (&t->spin_keys); + + if (key >= t->keymax) + { + int keymax = (key + 1); + void **kv; + unsigned char *kv_set; + + kv = (void **) realloc (t->keyval, keymax * sizeof (void *)); + + if (!kv) + { + pthread_spin_unlock (&t->spin_keys); + return ENOMEM; + } + kv_set = (unsigned char *) realloc (t->keyval_set, keymax); + if (!kv_set) + { + pthread_spin_unlock (&t->spin_keys); + return ENOMEM; + } + + /* Clear new region */ + memset (&kv[t->keymax], 0, (keymax - t->keymax)*sizeof(void *)); + memset (&kv_set[t->keymax], 0, (keymax - t->keymax)); + + t->keyval = kv; + t->keyval_set = kv_set; + t->keymax = keymax; + } + + t->keyval[key] = (void *) value; + t->keyval_set[key] = 1; + pthread_spin_unlock (&t->spin_keys); + SetLastError (lasterr); + + return 0; +} + +int +pthread_equal (pthread_t t1, pthread_t t2) +{ + return (t1 == t2); +} + +void +pthread_tls_init (void) +{ + _pthread_tls = TlsAlloc(); + + /* Cannot continue if out of indexes */ + if (_pthread_tls == TLS_OUT_OF_INDEXES) + abort(); +} + +void +_pthread_cleanup_dest (pthread_t t) +{ + _pthread_v *tv; + unsigned int i, j; + + if (!t) + return; + tv = __pth_gpointer_locked (t); + if (!tv) + return; + + for (j = 0; j < PTHREAD_DESTRUCTOR_ITERATIONS; j++) + { + int flag = 0; + + pthread_spin_lock (&tv->spin_keys); + for (i = 0; i < tv->keymax; i++) + { + void *val = tv->keyval[i]; + + if (tv->keyval_set[i]) + { + pthread_rwlock_rdlock (&_pthread_key_lock); + if ((uintptr_t) _pthread_key_dest[i] > 1) + { + /* Call destructor */ + tv->keyval[i] = NULL; + tv->keyval_set[i] = 0; + pthread_spin_unlock (&tv->spin_keys); + _pthread_key_dest[i](val); + pthread_spin_lock (&tv->spin_keys); + flag = 1; + } + else + { + tv->keyval[i] = NULL; + tv->keyval_set[i] = 0; + } + pthread_rwlock_unlock(&_pthread_key_lock); + } + } + pthread_spin_unlock (&tv->spin_keys); + /* Nothing to do? */ + if (!flag) + return; + } +} + +static _pthread_v * +__pthread_self_lite (void) +{ + _pthread_v *t; + pthread_spinlock_t new_spin_keys = PTHREAD_SPINLOCK_INITIALIZER; + + _pthread_once_raw (&_pthread_tls_once, pthread_tls_init); + + t = (_pthread_v *) TlsGetValue (_pthread_tls); + if (t) + return t; + /* Main thread? */ + t = (struct _pthread_v *) pop_pthread_mem (); + + /* If cannot initialize main thread, then the only thing we can do is return null pthread_t */ + if (!__xl_f || !t) + return 0; + + t->p_state = PTHREAD_DEFAULT_ATTR /*| PTHREAD_CREATE_DETACHED*/; + t->tid = GetCurrentThreadId(); + t->evStart = CreateEvent (NULL, 1, 0, NULL); + t->p_clock = PTHREAD_MUTEX_INITIALIZER; + replace_spin_keys (&t->spin_keys, new_spin_keys); + t->sched_pol = SCHED_OTHER; + t->h = NULL; //GetCurrentThread(); + if (!DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &t->h, 0, FALSE, DUPLICATE_SAME_ACCESS)) + abort (); + t->sched.sched_priority = GetThreadPriority(t->h); + t->ended = 0; + t->thread_noposix = 1; + + /* Save for later */ + if (!TlsSetValue(_pthread_tls, t)) + abort (); + return t; +} + +pthread_t +pthread_self (void) +{ + _pthread_v *t = __pthread_self_lite (); + + if (!t) + return 0; + return t->x; +} + +/* Internal helper for getting event handle of thread T. */ +void * +pthread_getevent (void) +{ + _pthread_v *t = __pthread_self_lite (); + return (!t ? NULL : t->evStart); +} + +/* Internal helper for getting thread handle of thread T. */ +void * +pthread_gethandle (pthread_t t) +{ + struct _pthread_v *tv = __pth_gpointer_locked (t); + return (!tv ? NULL : tv->h); +} + +/* Internal helper for getting pointer of clean of current thread. */ +struct _pthread_cleanup ** +pthread_getclean (void) +{ + struct _pthread_v *t = __pthread_self_lite (); + if (!t) return NULL; + return &t->clean; +} + +int +pthread_get_concurrency (int *val) +{ + *val = _pthread_concur; + return 0; +} + +int +pthread_set_concurrency (int val) +{ + _pthread_concur = val; + return 0; +} + +void +pthread_exit (void *res) +{ + _pthread_v *t = NULL; + unsigned rslt = (unsigned) ((intptr_t) res); + struct _pthread_v *id = __pthread_self_lite (); + + id->ret_arg = res; + + _pthread_cleanup_dest (id->x); + if (id->thread_noposix == 0) + longjmp(id->jb, 1); + + /* Make sure we free ourselves if we are detached */ + if ((t = (_pthread_v *)TlsGetValue(_pthread_tls)) != NULL) + { + if (!t->h) + { + t->valid = DEAD_THREAD; + if (t->evStart) + CloseHandle (t->evStart); + t->evStart = NULL; + rslt = (unsigned) (size_t) t->ret_arg; + push_pthread_mem(t); + t = NULL; + TlsSetValue (_pthread_tls, t); + } + else + { + rslt = (unsigned) (size_t) t->ret_arg; + t->ended = 1; + if (t->evStart) + CloseHandle (t->evStart); + t->evStart = NULL; + if ((t->p_state & PTHREAD_CREATE_DETACHED) == PTHREAD_CREATE_DETACHED) + { + t->valid = DEAD_THREAD; + CloseHandle (t->h); + t->h = NULL; + push_pthread_mem(t); + t = NULL; + TlsSetValue(_pthread_tls, t); + } + } + } + /* Time to die */ + _endthreadex(rslt); +} + +void +_pthread_invoke_cancel (void) +{ + _pthread_cleanup *pcup; + struct _pthread_v *se = __pthread_self_lite (); + se->in_cancel = 1; + _pthread_setnobreak (1); + InterlockedDecrement(&_pthread_cancelling); + + /* Call cancel queue */ + for (pcup = se->clean; pcup; pcup = pcup->next) + { + pcup->func((pthread_once_t *)pcup->arg); + } + + _pthread_setnobreak (0); + pthread_exit(PTHREAD_CANCELED); +} + +int +__pthread_shallcancel (void) +{ + struct _pthread_v *t; + if (!_pthread_cancelling) + return 0; + t = __pthread_self_lite (); + if (t == NULL) + return 0; + if (t->nobreak <= 0 && t->cancelled && (t->p_state & PTHREAD_CANCEL_ENABLE)) + return 1; + return 0; +} + +void +_pthread_setnobreak (int v) +{ + struct _pthread_v *t = __pthread_self_lite (); + if (t == NULL) + return; + if (v > 0) + InterlockedIncrement ((long*)&t->nobreak); + else + InterlockedDecrement((long*)&t->nobreak); +} + +void +pthread_testcancel (void) +{ + struct _pthread_v *self = __pthread_self_lite (); + + if (!self || self->in_cancel) + return; + if (!_pthread_cancelling) + return; + pthread_mutex_lock (&self->p_clock); + + if (self->cancelled && (self->p_state & PTHREAD_CANCEL_ENABLE) && self->nobreak <= 0) + { + self->in_cancel = 1; + self->p_state &= ~PTHREAD_CANCEL_ENABLE; + if (self->evStart) + ResetEvent (self->evStart); + pthread_mutex_unlock (&self->p_clock); + _pthread_invoke_cancel (); + } + pthread_mutex_unlock (&self->p_clock); +} + +int +pthread_cancel (pthread_t t) +{ + struct _pthread_v *tv = __pth_gpointer_locked (t); + + if (tv == NULL) + return ESRCH; + CHECK_OBJECT(tv, ESRCH); + /*if (tv->ended) return ESRCH;*/ + pthread_mutex_lock(&tv->p_clock); + if (pthread_equal(pthread_self(), t)) + { + if(tv->cancelled) + { + pthread_mutex_unlock(&tv->p_clock); + return (tv->in_cancel ? ESRCH : 0); + } + tv->cancelled = 1; + InterlockedIncrement(&_pthread_cancelling); + if(tv->evStart) SetEvent(tv->evStart); + if ((tv->p_state & PTHREAD_CANCEL_ASYNCHRONOUS) != 0 && (tv->p_state & PTHREAD_CANCEL_ENABLE) != 0) + { + tv->p_state &= ~PTHREAD_CANCEL_ENABLE; + tv->in_cancel = 1; + pthread_mutex_unlock(&tv->p_clock); + _pthread_invoke_cancel(); + } + else + pthread_mutex_unlock(&tv->p_clock); + return 0; + } + + if ((tv->p_state & PTHREAD_CANCEL_ASYNCHRONOUS) != 0 && (tv->p_state & PTHREAD_CANCEL_ENABLE) != 0) + { + /* Dangerous asynchronous cancelling */ + CONTEXT ctxt; + + if(tv->in_cancel) + { + pthread_mutex_unlock(&tv->p_clock); + return (tv->in_cancel ? ESRCH : 0); + } + /* Already done? */ + if(tv->cancelled || tv->in_cancel) + { + /* ??? pthread_mutex_unlock (&tv->p_clock); */ + return ESRCH; + } + + ctxt.ContextFlags = CONTEXT_CONTROL; + + SuspendThread (tv->h); + if (WaitForSingleObject (tv->h, 0) == WAIT_TIMEOUT) + { + GetThreadContext(tv->h, &ctxt); +#ifdef _M_X64 + ctxt.Rip = (uintptr_t) _pthread_invoke_cancel; +#elif defined(_M_IX86) + ctxt.Eip = (uintptr_t) _pthread_invoke_cancel; +#elif defined(_M_ARM) || defined(_M_ARM64) + ctxt.Pc = (uintptr_t) _pthread_invoke_cancel; +#else +#error Unsupported architecture +#endif +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) + SetThreadContext (tv->h, &ctxt); +#endif + + /* Also try deferred Cancelling */ + tv->cancelled = 1; + tv->p_state &= ~PTHREAD_CANCEL_ENABLE; + tv->in_cancel = 1; + + /* Notify everyone to look */ + InterlockedIncrement (&_pthread_cancelling); + if (tv->evStart) + SetEvent (tv->evStart); + pthread_mutex_unlock (&tv->p_clock); + + ResumeThread (tv->h); + } + } + else + { + if (tv->cancelled == 0) + { + /* Safe deferred Cancelling */ + tv->cancelled = 1; + + /* Notify everyone to look */ + InterlockedIncrement (&_pthread_cancelling); + if (tv->evStart) + SetEvent (tv->evStart); + } + else + { + pthread_mutex_unlock (&tv->p_clock); + return (tv->in_cancel ? ESRCH : 0); + } + } + pthread_mutex_unlock (&tv->p_clock); + return 0; +} + +/* half-stubbed version as we don't really well support signals */ +int +pthread_kill (pthread_t t, int sig) +{ + struct _pthread_v *tv; + + pthread_mutex_lock (&mtx_pthr_locked); + tv = __pthread_get_pointer (t); + if (!tv || t != tv->x || tv->in_cancel || tv->ended || tv->h == NULL + || tv->h == INVALID_HANDLE_VALUE) + { + pthread_mutex_unlock (&mtx_pthr_locked); + return ESRCH; + } + pthread_mutex_unlock (&mtx_pthr_locked); + if (!sig) + return 0; + if (sig < SIGINT || sig > NSIG) + return EINVAL; + return pthread_cancel(t); +} + +unsigned +_pthread_get_state (const pthread_attr_t *attr, unsigned flag) +{ + return (attr->p_state & flag); +} + +int +_pthread_set_state (pthread_attr_t *attr, unsigned flag, unsigned val) +{ + if (~flag & val) + return EINVAL; + attr->p_state &= ~flag; + attr->p_state |= val; + + return 0; +} + +int +pthread_attr_init (pthread_attr_t *attr) +{ + memset (attr, 0, sizeof (pthread_attr_t)); + attr->p_state = PTHREAD_DEFAULT_ATTR; + attr->stack = NULL; + attr->s_size = 0; + return 0; +} + +int +pthread_attr_destroy (pthread_attr_t *attr) +{ + /* No need to do anything */ + memset (attr, 0, sizeof(pthread_attr_t)); + return 0; +} + +int +pthread_attr_setdetachstate (pthread_attr_t *a, int flag) +{ + return _pthread_set_state(a, PTHREAD_CREATE_DETACHED, flag); +} + +int +pthread_attr_getdetachstate (const pthread_attr_t *a, int *flag) +{ + *flag = _pthread_get_state(a, PTHREAD_CREATE_DETACHED); + return 0; +} + +int +pthread_attr_setinheritsched (pthread_attr_t *a, int flag) +{ + if (!a || (flag != PTHREAD_INHERIT_SCHED && flag != PTHREAD_EXPLICIT_SCHED)) + return EINVAL; + return _pthread_set_state(a, PTHREAD_INHERIT_SCHED, flag); +} + +int +pthread_attr_getinheritsched (const pthread_attr_t *a, int *flag) +{ + *flag = _pthread_get_state(a, PTHREAD_INHERIT_SCHED); + return 0; +} + +int +pthread_attr_setscope (pthread_attr_t *a, int flag) +{ + return _pthread_set_state(a, PTHREAD_SCOPE_SYSTEM, flag); +} + +int +pthread_attr_getscope (const pthread_attr_t *a, int *flag) +{ + *flag = _pthread_get_state(a, PTHREAD_SCOPE_SYSTEM); + return 0; +} + +int +pthread_attr_getstack (const pthread_attr_t *attr, void **stack, size_t *size) +{ + *stack = (char *) attr->stack - attr->s_size; + *size = attr->s_size; + return 0; +} + +int +pthread_attr_setstack (pthread_attr_t *attr, void *stack, size_t size) +{ + attr->s_size = size; + attr->stack = (char *) stack + size; + return 0; +} + +int +pthread_attr_getstackaddr (const pthread_attr_t *attr, void **stack) +{ + *stack = attr->stack; + return 0; +} + +int +pthread_attr_setstackaddr (pthread_attr_t *attr, void *stack) +{ + attr->stack = stack; + return 0; +} + +int +pthread_attr_getstacksize (const pthread_attr_t *attr, size_t *size) +{ + *size = attr->s_size; + return 0; +} + +int +pthread_attr_setstacksize (pthread_attr_t *attr, size_t size) +{ + attr->s_size = size; + return 0; +} + +static void +test_cancel_locked (pthread_t t) +{ + struct _pthread_v *tv = __pth_gpointer_locked (t); + + if (!tv || tv->in_cancel || tv->ended != 0 || (tv->p_state & PTHREAD_CANCEL_ENABLE) == 0) + return; + if ((tv->p_state & PTHREAD_CANCEL_ASYNCHRONOUS) == 0) + return; + if (WaitForSingleObject(tv->evStart, 0) != WAIT_OBJECT_0) + return; + pthread_mutex_unlock (&tv->p_clock); + _pthread_invoke_cancel(); +} + +int +pthread_setcancelstate (int state, int *oldstate) +{ + _pthread_v *t = __pthread_self_lite (); + + if (!t || (state & PTHREAD_CANCEL_ENABLE) != state) + return EINVAL; + + pthread_mutex_lock (&t->p_clock); + if (oldstate) + *oldstate = t->p_state & PTHREAD_CANCEL_ENABLE; + t->p_state &= ~PTHREAD_CANCEL_ENABLE; + t->p_state |= state; + test_cancel_locked (t->x); + pthread_mutex_unlock (&t->p_clock); + + return 0; +} + +int +pthread_setcanceltype (int type, int *oldtype) +{ + _pthread_v *t = __pthread_self_lite (); + + if (!t || (type & PTHREAD_CANCEL_ASYNCHRONOUS) != type) + return EINVAL; + + pthread_mutex_lock (&t->p_clock); + if (oldtype) + *oldtype = t->p_state & PTHREAD_CANCEL_ASYNCHRONOUS; + t->p_state &= ~PTHREAD_CANCEL_ASYNCHRONOUS; + t->p_state |= type; + test_cancel_locked (t->x); + pthread_mutex_unlock (&t->p_clock); + + return 0; +} + +void _fpreset (void); + +#if defined(__i386__) +/* Align ESP on 16-byte boundaries. */ +# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2) +__attribute__((force_align_arg_pointer)) +# endif +#endif +unsigned __stdcall +pthread_create_wrapper (void *args) +{ + unsigned rslt = 0; + struct _pthread_v *tv = (struct _pthread_v *)args; + + _fpreset(); + + pthread_mutex_lock (&mtx_pthr_locked); + pthread_mutex_lock (&tv->p_clock); + _pthread_once_raw(&_pthread_tls_once, pthread_tls_init); + TlsSetValue(_pthread_tls, tv); + tv->tid = GetCurrentThreadId(); + pthread_mutex_unlock (&tv->p_clock); + + + if (!setjmp(tv->jb)) + { + intptr_t trslt = (intptr_t) 128; + /* Provide to this thread a default exception handler. */ + #ifdef __SEH__ + asm ("\t.tl_start:\n"); + #endif /* Call function and save return value */ + pthread_mutex_unlock (&mtx_pthr_locked); + if (tv->func) + trslt = (intptr_t) tv->func(tv->ret_arg); + #ifdef __SEH__ + asm ("\tnop\n\t.tl_end: nop\n" +#ifdef __arm__ + "\t.seh_handler __C_specific_handler, %except\n" +#else + "\t.seh_handler __C_specific_handler, @except\n" +#endif + "\t.seh_handlerdata\n" + "\t.long 1\n" + "\t.rva .tl_start, .tl_end, _gnu_exception_handler ,.tl_end\n" + "\t.text" + ); + #endif + pthread_mutex_lock (&mtx_pthr_locked); + tv->ret_arg = (void*) trslt; + /* Clean up destructors */ + _pthread_cleanup_dest(tv->x); + } + else + pthread_mutex_lock (&mtx_pthr_locked); + + pthread_mutex_lock (&tv->p_clock); + rslt = (unsigned) (size_t) tv->ret_arg; + /* Make sure we free ourselves if we are detached */ + if (tv->evStart) + CloseHandle (tv->evStart); + tv->evStart = NULL; + if (!tv->h) + { + tv->valid = DEAD_THREAD; + pthread_mutex_unlock (&tv->p_clock); + pthread_mutex_destroy (&tv->p_clock); + push_pthread_mem (tv); + tv = NULL; + TlsSetValue (_pthread_tls, tv); + } + else + { + pthread_mutex_unlock (&tv->p_clock); + pthread_mutex_destroy (&tv->p_clock); + /* Reinitialise p_clock, since there may be attempts at + destroying it again in __dyn_tls_thread later on. */ + tv->p_clock = PTHREAD_MUTEX_INITIALIZER; + tv->ended = 1; + } + while (pthread_mutex_unlock (&mtx_pthr_locked) == 0) + Sleep (0); + _endthreadex (rslt); + return rslt; +} + +int +pthread_create (pthread_t *th, const pthread_attr_t *attr, void *(* func)(void *), void *arg) +{ + HANDLE thrd = NULL; + int redo = 0; + struct _pthread_v *tv; + unsigned int ssize = 0; + pthread_spinlock_t new_spin_keys = PTHREAD_SPINLOCK_INITIALIZER; + + if (attr && attr->s_size > UINT_MAX) + return EINVAL; + + if ((tv = pop_pthread_mem ()) == NULL) + return EAGAIN; + + if (th) + *th = tv->x; + + /* Save data in pthread_t */ + tv->ended = 0; + tv->ret_arg = arg; + tv->func = func; + tv->p_state = PTHREAD_DEFAULT_ATTR; + tv->h = INVALID_HANDLE_VALUE; + /* We retry it here a few times, as events are a limited resource ... */ + do + { + tv->evStart = CreateEvent (NULL, 1, 0, NULL); + if (tv->evStart != NULL) + break; + Sleep ((!redo ? 0 : 20)); + } + while (++redo <= 4); + + tv->p_clock = PTHREAD_MUTEX_INITIALIZER; + replace_spin_keys (&tv->spin_keys, new_spin_keys); + tv->valid = LIFE_THREAD; + tv->sched.sched_priority = THREAD_PRIORITY_NORMAL; + tv->sched_pol = SCHED_OTHER; + if (tv->evStart == NULL) + { + if (th) + memset (th, 0, sizeof (pthread_t)); + push_pthread_mem (tv); + return EAGAIN; + } + + if (attr) + { + int inh = 0; + tv->p_state = attr->p_state; + ssize = (unsigned int)attr->s_size; + pthread_attr_getinheritsched (attr, &inh); + if (inh) + { + tv->sched.sched_priority = __pthread_self_lite ()->sched.sched_priority; + } + else + tv->sched.sched_priority = attr->param.sched_priority; + } + + /* Make sure tv->h has value of INVALID_HANDLE_VALUE */ + _ReadWriteBarrier(); + + thrd = (HANDLE) _beginthreadex(NULL, ssize, pthread_create_wrapper, tv, 0x4/*CREATE_SUSPEND*/, NULL); + if (thrd == INVALID_HANDLE_VALUE) + thrd = 0; + /* Failed */ + if (!thrd) + { + if (tv->evStart) + CloseHandle (tv->evStart); + pthread_mutex_destroy (&tv->p_clock); + replace_spin_keys (&tv->spin_keys, new_spin_keys); + tv->evStart = NULL; + tv->h = 0; + if (th) + memset (th, 0, sizeof (pthread_t)); + push_pthread_mem (tv); + return EAGAIN; + } + { + int pr = tv->sched.sched_priority; + if (pr <= THREAD_PRIORITY_IDLE) { + pr = THREAD_PRIORITY_IDLE; + } else if (pr <= THREAD_PRIORITY_LOWEST) { + pr = THREAD_PRIORITY_LOWEST; + } else if (pr >= THREAD_PRIORITY_TIME_CRITICAL) { + pr = THREAD_PRIORITY_TIME_CRITICAL; + } else if (pr >= THREAD_PRIORITY_HIGHEST) { + pr = THREAD_PRIORITY_HIGHEST; + } + SetThreadPriority (thrd, pr); + } + ResetEvent (tv->evStart); + if ((tv->p_state & PTHREAD_CREATE_DETACHED) != 0) + { + tv->h = 0; + ResumeThread (thrd); + CloseHandle (thrd); + } + else + { + tv->h = thrd; + ResumeThread (thrd); + } + Sleep (0); + return 0; +} + +int +pthread_join (pthread_t t, void **res) +{ + DWORD dwFlags; + struct _pthread_v *tv = __pth_gpointer_locked (t); + pthread_spinlock_t new_spin_keys = PTHREAD_SPINLOCK_INITIALIZER; + + if (!tv || tv->h == NULL || !GetHandleInformation(tv->h, &dwFlags)) + return ESRCH; + if ((tv->p_state & PTHREAD_CREATE_DETACHED) != 0) + return EINVAL; + if (pthread_equal(pthread_self(), t)) + return EDEADLK; + + /* pthread_testcancel (); */ + if (tv->ended == 0 || (tv->h != NULL && tv->h != INVALID_HANDLE_VALUE)) + WaitForSingleObject (tv->h, INFINITE); + CloseHandle (tv->h); + if (tv->evStart) + CloseHandle (tv->evStart); + tv->evStart = NULL; + /* Obtain return value */ + if (res) + *res = tv->ret_arg; + pthread_mutex_destroy (&tv->p_clock); + replace_spin_keys (&tv->spin_keys, new_spin_keys); + push_pthread_mem (tv); + + return 0; +} + +int +_pthread_tryjoin (pthread_t t, void **res) +{ + DWORD dwFlags; + struct _pthread_v *tv; + pthread_spinlock_t new_spin_keys = PTHREAD_SPINLOCK_INITIALIZER; + + pthread_mutex_lock (&mtx_pthr_locked); + tv = __pthread_get_pointer (t); + + if (!tv || tv->h == NULL || !GetHandleInformation(tv->h, &dwFlags)) + { + pthread_mutex_unlock (&mtx_pthr_locked); + return ESRCH; + } + + if ((tv->p_state & PTHREAD_CREATE_DETACHED) != 0) + { + pthread_mutex_unlock (&mtx_pthr_locked); + return EINVAL; + } + if (pthread_equal(pthread_self(), t)) + { + pthread_mutex_unlock (&mtx_pthr_locked); + return EDEADLK; + } + if(tv->ended == 0 && WaitForSingleObject(tv->h, 0)) + { + if (tv->ended == 0) + { + pthread_mutex_unlock (&mtx_pthr_locked); + /* pthread_testcancel (); */ + return EBUSY; + } + } + CloseHandle (tv->h); + if (tv->evStart) + CloseHandle (tv->evStart); + tv->evStart = NULL; + + /* Obtain return value */ + if (res) + *res = tv->ret_arg; + pthread_mutex_destroy (&tv->p_clock); + replace_spin_keys (&tv->spin_keys, new_spin_keys); + + push_pthread_mem (tv); + + pthread_mutex_unlock (&mtx_pthr_locked); + /* pthread_testcancel (); */ + return 0; +} + +int +pthread_detach (pthread_t t) +{ + int r = 0; + DWORD dwFlags; + struct _pthread_v *tv = __pth_gpointer_locked (t); + HANDLE dw; + pthread_spinlock_t new_spin_keys = PTHREAD_SPINLOCK_INITIALIZER; + + pthread_mutex_lock (&mtx_pthr_locked); + if (!tv || tv->h == NULL || !GetHandleInformation(tv->h, &dwFlags)) + { + pthread_mutex_unlock (&mtx_pthr_locked); + return ESRCH; + } + if ((tv->p_state & PTHREAD_CREATE_DETACHED) != 0) + { + pthread_mutex_unlock (&mtx_pthr_locked); + return EINVAL; + } + /* if (tv->ended) r = ESRCH; */ + dw = tv->h; + tv->h = 0; + tv->p_state |= PTHREAD_CREATE_DETACHED; + _ReadWriteBarrier(); + if (dw) + { + CloseHandle (dw); + if (tv->ended) + { + if (tv->evStart) + CloseHandle (tv->evStart); + tv->evStart = NULL; + pthread_mutex_destroy (&tv->p_clock); + replace_spin_keys (&tv->spin_keys, new_spin_keys); + push_pthread_mem (tv); + } + } + pthread_mutex_unlock (&mtx_pthr_locked); + + return r; +} + +static int dummy_concurrency_level = 0; + +int +pthread_getconcurrency (void) +{ + return dummy_concurrency_level; +} + +int +pthread_setconcurrency (int new_level) +{ + dummy_concurrency_level = new_level; + return 0; +} + +int +pthread_setname_np (pthread_t thread, const char *name) +{ + struct _pthread_v *tv; + char *stored_name; + + if (name == NULL) + return EINVAL; + + tv = __pth_gpointer_locked (thread); + if (!tv || thread != tv->x || tv->in_cancel || tv->ended || tv->h == NULL + || tv->h == INVALID_HANDLE_VALUE) + return ESRCH; + + stored_name = strdup (name); + if (stored_name == NULL) + return ENOMEM; + + if (tv->thread_name != NULL) + free (tv->thread_name); + + tv->thread_name = stored_name; + SetThreadName (tv->tid, name); + + if (_pthread_set_thread_description != NULL) + { + size_t required_size = mbstowcs(NULL, name, 0); + if (required_size != (size_t)-1) + { + wchar_t *wname = malloc((required_size + 1) * sizeof(wchar_t)); + if (wname != NULL) + { + mbstowcs(wname, name, required_size + 1); + _pthread_set_thread_description(tv->h, wname); + free(wname); + } + } + } + return 0; +} + +int +pthread_getname_np (pthread_t thread, char *name, size_t len) +{ + HRESULT result; + struct _pthread_v *tv; + + if (name == NULL) + return EINVAL; + + tv = __pth_gpointer_locked (thread); + if (!tv || thread != tv->x || tv->in_cancel || tv->ended || tv->h == NULL + || tv->h == INVALID_HANDLE_VALUE) + return ESRCH; + + if (len < 1) + return ERANGE; + + if (tv->thread_name == NULL) + { + name[0] = '\0'; + return 0; + } + + if (strlen (tv->thread_name) >= len) + return ERANGE; + + result = StringCchCopyNA (name, len, tv->thread_name, len - 1); + if (SUCCEEDED (result)) + return 0; + + return ERANGE; +} diff --git a/lib/libc/mingw/winpthreads/thread.h b/lib/libc/mingw/winpthreads/thread.h @@ -0,0 +1,79 @@ +/* + Copyright (c) 2011-2016 mingw-w64 project + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#ifndef WIN_PTHREAD_H +#define WIN_PTHREAD_H + +#include <windows.h> +#include <setjmp.h> +#include "rwlock.h" + +#define LIFE_THREAD 0xBAB1F00D +#define DEAD_THREAD 0xDEADBEEF +#define EXCEPTION_SET_THREAD_NAME ((DWORD) 0x406D1388) + +typedef struct _pthread_v _pthread_v; +struct _pthread_v +{ + unsigned int valid; + void *ret_arg; + void *(* func)(void *); + _pthread_cleanup *clean; + int nobreak; + HANDLE h; + HANDLE evStart; + pthread_mutex_t p_clock; + int cancelled : 2; + int in_cancel : 2; + int thread_noposix : 2; + unsigned int p_state; + unsigned int keymax; + void **keyval; + unsigned char *keyval_set; + char *thread_name; + pthread_spinlock_t spin_keys; + DWORD tid; + int rwlc; + pthread_rwlock_t rwlq[RWLS_PER_THREAD]; + int sched_pol; + int ended; + struct sched_param sched; + jmp_buf jb; + struct _pthread_v *next; + pthread_t x; /* Internal posix handle. */ +}; + +typedef struct __pthread_idlist { + struct _pthread_v *ptr; + pthread_t id; +} __pthread_idlist; + +int _pthread_tryjoin(pthread_t t, void **res); +void _pthread_setnobreak(int); +#ifdef WINPTHREAD_DBG +void thread_print_set(int state); +void thread_print(volatile pthread_t t, char *txt); +#endif +int __pthread_shallcancel(void); +struct _pthread_v *WINPTHREAD_API __pth_gpointer_locked (pthread_t id); + +#endif diff --git a/lib/libc/mingw/winpthreads/winpthread_internal.h b/lib/libc/mingw/winpthreads/winpthread_internal.h @@ -0,0 +1,27 @@ +/* + Copyright (c) 2011-2016 mingw-w64 project + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#ifndef WINPTHREAD_INTERNAL_H +#define WINPTHREAD_INTERNAL_H +WINPTHREAD_API struct _pthread_v * __pth_gpointer_locked (pthread_t id); +int pthread_delay_np_ms (DWORD to); +#endif /*WINPTHREAD_INTERNAL_H*/ diff --git a/lib/libc/mingw/winpthreads/wpth_ver.h b/lib/libc/mingw/winpthreads/wpth_ver.h @@ -0,0 +1,29 @@ +/* + Copyright (c) 2011-2016 mingw-w64 project + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#ifndef __WPTHREADS_VERSION__ +#define __WPTHREADS_VERSION__ + +#define WPTH_VERSION 1,0,0,0 +#define WPTH_VERSION_STRING "1, 0, 0, 0\0" + +#endif