-
Notifications
You must be signed in to change notification settings - Fork 69
Next #1217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: next
Are you sure you want to change the base?
Next #1217
Conversation
- Updated `get` function signatures in `tuple.h` to return `decltype(auto)` for improved type deduction. - Enhanced consistency by ensuring `[[nodiscard]]` attribute is applied uniformly across all overloads of `get`. - Added new overloads for `get` to support retrieval by type, improving usability and flexibility. - Minor formatting adjustments for better readability in the `forward_as_tuple` function.
- Introduced `apply` function to facilitate the application of a callable to elements of a tuple. - Added `tuple_size` function to retrieve the size of a `fast_io::containers::tuple`. - Implemented helper functions in the `details` namespace for improved code organization and clarity.
…rm headers - Updated error handling in various platform headers to consistently use `throw_posix_error()` with appropriate error codes. - Enhanced function signatures in POSIX and platform-specific implementations for clarity and consistency. - Replaced direct calls to system functions with `noexcept_call` for safer error management. - Improved readability and maintainability of the code by standardizing error checks and function calls.
…in POSIX headers - Updated `thread_start_routine` in both NT and Win32 headers to include `FAST_IO_WINSTDCALL` for better calling convention compatibility. - Enhanced error handling in `get_module_install_path_from_argv0` by checking for a null environment path and throwing an appropriate error. - Improved readability by initializing pointers to empty and using consistent formatting in the `argv0.h` file. - Adjusted conditional compilation checks in `posix.h` for clearer handling of open mode flags.
…tion - Updated `get` function signatures to return `auto&&` instead of `decltype(auto)` for better type handling. - Enhanced consistency across all overloads of `get` by applying uniform return types. - Minor adjustments made to improve readability and maintainability of the code.
…tion functions - Added error checks for null pointers and buffer overflows in `get_module_install_path_from_argv0` to ensure robust path resolution. - Updated `get_module_install_path` to handle `sysctl` errors more accurately. - Replaced direct system calls with `noexcept_call` for safer error management across various platform headers. - Improved readability and maintainability by standardizing error handling and function calls.
- Updated function signatures in `android.h` to include `noexcept` for improved safety and performance. - Refactored operator overloads and logging implementations to ensure exception safety during logging operations. - Improved code clarity and maintainability by standardizing function signatures across the Android logging interface.
…m headers - Added null pointer check in `is_invalid_dos_filename_with_size` to prevent crashes. - Refactored `zero_copy_transmit64_define` to streamline character transmission logic and improve performance. - Updated `try_lock` method in `posix_file_lock` to return a boolean indicating lock success. - Adjusted function signatures in various headers for consistency and clarity, including changes to `NtSetSystemTime` and `RtlAcquirePebLock`. - Improved error handling in `posix_seek_impl` to throw appropriate errors for overflow conditions.
… and function signatures - Updated `sys_mmap` to use `long` for return type and improved error handling for memory mapping. - Refactored `open_socket_impl` to include checks for socket open modes and set appropriate flags for non-blocking and close-on-exec behavior. - Introduced `to_win32_page_protect` function for better handling of file map attributes in Win32. - Enhanced error handling in `create_file_mapping_impl` and random number generation functions to account for API behavior as per MSDN documentation.
…ype safety - Changed the type of `tms` from `uint_least64_t` to `int_least64_t` to ensure proper handling of negative values. - Updated calculations for `tms` to maintain consistency and prevent potential overflow issues.
…e consistency - Adjusted function signatures in `msvc_linker_32_i686.h`, `msvc_linker_32.h`, `msvc_linker_64.h`, and `msvc_linker_arm64ec.h` to ensure proper handling of parameters and return types. - Enhanced consistency across linker headers by standardizing the naming conventions for function aliases. - Improved clarity and maintainability of the code by ensuring uniformity in the handling of alternate names for Windows API functions.
…s to return references - Updated `append` methods in `basic_win32_process_args`, `basic_win32_process_envs`, and `posix_process_args` to return a reference to the current object, enhancing method chaining capabilities. - Improved code clarity and consistency across process argument and environment handling.
…ength calculation - Updated the resizing logic in `posix.h` to correctly account for the null terminator when determining the length of the string. - Added a trailing slash to the returned path string to ensure proper formatting when appending filenames.
- Introduced a new `posix_vfork` option in `option.h` to support process creation using vfork, which has specific limitations on parameter modifications. - Refactored process execution methods in `posix.h` to utilize a common `fork_execveat_impl` function, streamlining the handling of process creation based on the selected mode. - Enhanced clarity and maintainability of the code by consolidating vfork and pipefork logic into unified implementations.
…intainability - Added conditional compilation for session management in the vfork_and_execveat function, enhancing the handling of process creation modes. - Improved code organization by encapsulating session management logic within preprocessor directives, allowing for easier modifications in the future.
…ocess mode - Modified the vfork_and_execveat function signature to add [[maybe_unused]] for the process_mode parameter, improving code clarity and indicating that the parameter may not be utilized in all contexts.
- Changed the process_mode enumeration to a scoped enum class for better type safety and clarity. - Added a new 'follow' option to the process_mode enum to allow symbolic links to be followed during process execution. - Updated the posix_execveat function to accept the process_mode parameter, modifying behavior based on the follow option. - Refactored flags handling in posix_execveat and vfork_and_execveat functions to improve clarity and maintainability.
- Introduced a new flag in process_mode to control the appending of paths to argv0, enhancing process creation flexibility. - Updated the nt_6x_process_create_impl and nt_create_process_overloads functions to utilize the new argv0_no_path_append flag for improved argument handling. - Refactored open_mode handling in process creation functions to accommodate the follow option, ensuring consistent behavior across different modes. - Enhanced clarity and maintainability of the code by organizing process parameter initialization and handling logic.
…ation marks around paths - Updated the process creation logic to include double quotation marks around the image path and process parameters when appending to argv0. - Improved clarity in the handling of DOS and NT paths by ensuring proper formatting during argument construction.
- Updated the `cstr_guard` return logic to enhance readability by removing unnecessary return statements. - Introduced a new namespace `posix` to encapsulate platform-specific environment variable handling, including `_NSGetEnviron` for Darwin and `environ` for other platforms. - Streamlined the `get_envs` function to utilize the new `posix` namespace, improving code organization and maintainability.
…ent structure - Changed the initialization of process arguments from a string to a native__process_args structure for improved clarity and consistency in argument handling. - This update enhances the readability of the code and aligns with recent refactoring efforts in process management.
… handling - Moved platform-specific environment variable declarations into the posix namespace for better organization and clarity. - Updated references in the get_envs function to utilize the new namespace, enhancing code maintainability and readability. - Removed redundant declarations to streamline the code structure.
- Changed the initialization of process arguments in process.cc to use native_process_args for improved clarity. - Updated constructor signatures in nt.h to remove default arguments for process_args_with_argv0, enhancing consistency and readability across process creation functions.
- Introduced a new `args_with_argv0_t` structure to encapsulate argument handling with `argv0`. - Updated constructors in `nt.h` and `posix.h` to accept `args_with_argv0_t`, enhancing consistency in process creation across platforms. - Improved clarity in argument handling by ensuring all relevant constructors utilize the new structure, streamlining the process initialization logic.
…rdize argument handling - Updated constructors across nt.h, posix.h, and win32.h to use a consistent default for `process_mode`, specifically `argv0_no_path_append`. - Enhanced clarity in argument handling by ensuring all relevant constructors utilize the new default, streamlining process initialization logic. - Improved maintainability and readability of the code by aligning constructor signatures across different platforms.
- Standardized the usage of `char_literal_v` in the argument construction process by removing unnecessary spaces in template syntax. - Enhanced readability and maintainability of the code by ensuring consistent formatting across argument handling in the `win32_winnt_process_create_from_handle_imp` function.
- Updated the `throw_win32_error` function call to remove the status argument for improved clarity in error handling. - Modified the `win32_duplicate_object_std` function to use a boolean for the `inherit` parameter, enhancing readability and consistency in handle duplication logic.
|
我先在代码库里定位并理解 [1 tool called] 结论
与 MSDN 对照的关键点(节选)
inline ::std::uint_least32_t win32_wait_user_process_or_thread(void *hprocess_thread) noexcept
{
return ::fast_io::win32::WaitForSingleObject(hprocess_thread, 0xFFFFFFFF);
}auto const status{win32::details::win32_wait_user_process_or_thread(ppob.hnt_user_process_info.hprocess)};
if (status == 0xFFFFFFFF) [[unlikely]]
{
if constexpr (throw_eh)
{
throw_win32_error();
}
else
{
return {static_cast<::std::uint_least32_t>(-1)};
}
}
// get exit code
::std::uint_least32_t exit_code{};
if (!::fast_io::win32::GetExitCodeProcess(ppob.hnt_user_process_info.hprocess, __builtin_addressof(exit_code)))
{
throw_win32_error();
}
::fast_io::win32::startupinfow si{};
si.cb = sizeof(si);
// ... 省略:为 si.hStdInput/Output/Error 赋值 ...
si.dwFlags = 0x00000100;
::std::uint_least32_t dwCreationFlags{0x00000400 /*CREATE_UNICODE_ENVIRONMENT*/};
// ... 省略:按需要 OR 上 CREATE_NEW_PROCESS_GROUP / CREATE_NEW_CONSOLE ...::fast_io::win32::process_information pi{};
if (!::fast_io::win32::CreateProcessW(address_begin, const_cast<char16_t *>(actrual_args), nullptr, nullptr, 1,
dwCreationFlags, (void *)envs, nullptr, __builtin_addressof(si), __builtin_addressof(pi)))
{
throw_win32_error();
}
#if !defined(_WIN32_WINNT) || _WIN32_WINNT >= 0x601
::fast_io::win32::K32GetMappedFileNameW
#else
::fast_io::win32::GetMappedFileNameW
#endif
(reinterpret_cast<void *>(static_cast<::std::ptrdiff_t>(-1)),
pMem,
pszFilename,
0x2000)) [[unlikely]]char16_t DosDevice[4]{0, u':', 0, 0};
char16_t NtPath[1025];
// ... 遍历 A:..Z: 并用 QueryDosDeviceW 比较前缀,命中则替换为盘符 ...建议与潜在风险(基于 MSDN)
if (processio.in.win32_pipe_in_handle)
{
si.hStdInput = processio.in.win32_pipe_in_handle;
if (!::fast_io::win32::SetHandleInformation(processio.in.win32_pipe_out_handle, 0x00000001 /*HANDLE_FLAG_INHERIT*/, 0)) [[unlikely]]
{
throw_win32_error();
}
}
// 在设置 si.hStdInput/Output/Error 之后追加(示例以 hStdInput 为例)
if (si.hStdInput) {
if (!::fast_io::win32::SetHandleInformation(si.hStdInput, 0x00000001 /*HANDLE_FLAG_INHERIT*/, 0x00000001 /*HANDLE_FLAG_INHERIT*/)) {
throw_win32_error();
}
}
总体评价
|
|
乱改一通 |
|
fast_io不允许使用int long之类 |
|
@trcrsired fixed |
…sistency - Simplified the namespace structure for `fast_io::win32::nt`, improving organization. - Updated thread-related functions and constructors to use `inline constexpr` for better performance and clarity. - Enhanced error handling in sleep functions to ensure proper validation of input parameters. - Streamlined the usage of `nt_thread` and `this_thread` to improve readability and maintainability across the codebase.
- Updated `RtlCreateUserThread` signature to accept a function pointer for improved flexibility. - Refined error handling in thread creation and management functions to ensure proper resource cleanup on failure. - Standardized the use of `inline constexpr` for thread-related functions to enhance performance and clarity. - Improved sleep functions to validate input parameters and handle edge cases more effectively. - Streamlined namespace usage and organization for better code maintainability.
|
CI failed. |
No description provided.