![]() |
LINE Solver (C++)
Templated C++ port of the LINE queueing solver
|
The Windows (mingw-w64, UCRT) definitions behind include/line/util/platform.h and the two subprocess runners of include/line/util/subprocess.h. More...
#include <winsock2.h>#include <ws2tcpip.h>#include <windows.h>#include <direct.h>#include <fcntl.h>#include <io.h>#include <sys/stat.h>#include <sys/types.h>#include <cerrno>#include <cstdio>#include <cstdlib>#include <cstring>#include <string>#include <vector>#include "line/util/platform.h"#include "line/util/subprocess.h"Go to the source code of this file.
Namespaces | |
| namespace | line |
| Conservation laws of a layered queueing network, enumerated from its structure. | |
| namespace | line::platform |
| namespace | line::util |
Macros | |
| #define | _WIN32_WINNT 0x0A00 |
| #define | WIN32_LEAN_AND_MEAN |
| #define | NOMINMAX |
Functions | |
| char | line::platform::path_list_separator () |
| const char * | line::platform::null_device () |
| const char * | line::platform::exe_suffix () |
| std::string | line::platform::temp_root () |
| TMPDIR, else /tmp. | |
| std::string | line::platform::home_dir () |
| HOME, or empty. | |
| bool | line::platform::is_regular_file (const std::string &p) |
| bool | line::platform::is_directory (const std::string &p) |
| bool | line::platform::is_executable (const std::string &p) |
| Exists and the caller may execute it (a directory with +x included, as access() says). | |
| bool | line::platform::is_writable (const std::string &p) |
| bool | line::platform::stat_file (const std::string &p, FileStat &out) |
| std::string | line::platform::find_on_path (const std::string &name) |
| The first dir/name on PATH that is a regular executable file, or empty. | |
| std::string | line::platform::self_exe_path () |
| This executable's path, or empty when it cannot be read. | |
| std::string | line::platform::current_dir () |
| std::string | line::platform::host_sysname () |
| uname -s, or empty. | |
| std::string | line::platform::host_machine () |
| uname -m, or empty. | |
| bool | line::platform::make_dir_or_exists (const std::string &path) |
| mkdir 0700; an existing entry is success. | |
| std::string | line::platform::make_temp_dir (const std::string &tmpl) |
| mkdtemp on a template ending in XXXXXX; empty on failure. | |
| int | line::platform::make_temp_file (std::string &tmpl) |
| mkstemp: replaces the XXXXXX in tmpl and returns an open descriptor, or -1. | |
| int | line::platform::dup_fd (int fd) |
| int | line::platform::dup2_fd (int from, int to) |
| POSIX dup2 returns the new descriptor; the CRT's _dup2 returns 0. | |
| int | line::platform::close_fd (int fd) |
| bool | line::platform::remove_file (const std::string &p) |
| bool | line::platform::rename_replace (const std::string &from, const std::string &to) |
| void | line::platform::remove_tree (const std::string &dir) |
| Remove a directory and everything under it, not following symlinks. | |
| long | line::platform::process_id () |
| long long | line::platform::free_disk_bytes (const std::string &path) |
| Bytes available to this user on the filesystem holding path; -1 if unknown. | |
| double | line::platform::available_memory_bytes () |
| Available physical memory in bytes; negative when the host cannot say. | |
| long long | line::platform::monotonic_millis () |
| Milliseconds on the monotonic clock, for deadlines that survive a clock step. | |
| void | line::platform::sleep_millis (long millis) |
| bool | line::platform::docker_user_spec (std::string &out) |
| "uid:gid" for docker run --user; false where the notion does not apply. | |
| ProcResult | line::util::capture (const std::vector< std::string > &argv, int timeoutSeconds, bool mergeStderr=false) |
| Runs a command, capturing stdout and discarding stderr. | |
| int | line::util::run_inherit (const std::vector< std::string > &argv) |
| Runs a command with the parent's stdout and stderr, e.g. | |
| bool | line::platform::spawn_detached (const std::vector< std::string > &argv) |
| Start argv detached (own session, std streams on /dev/null, double fork so no zombie). | |
| socket_t | line::platform::tcp_connect (const std::string &host, int port, int connectMillis, ConnectFailure &why, std::string &lastError) |
| Connect with a deadline on the connect itself: each resolved address is tried non-blocking, then polled for writability, and SO_ERROR read back. | |
| void | line::platform::set_io_timeout (socket_t s, int millis) |
| Set the receive and send timeouts; not positive leaves them as they are. | |
| socket_t | line::platform::tcp_connect_blocking (const std::string &host, const std::string &port, double ioSeconds, ConnectFailure &why) |
| Connect with the I/O timeouts set BEFORE a blocking connect, so they bound the connect as well (Linux honours SO_SNDTIMEO there). | |
| socket_t | line::platform::tcp_listen_any (int port, int backlog, std::string &stage) |
| An IPv4 listener on every interface with SO_REUSEADDR. | |
| socket_t | line::platform::tcp_accept (socket_t listener) |
| int | line::platform::free_loopback_port (std::string &stage) |
| A loopback port the kernel reports free (bind port 0, read it back), or -1 with the failing step in stage ("socket", "bind" or "getsockname"). | |
| long | line::platform::send_some (socket_t s, const char *p, std::size_t n) |
| send() without SIGPIPE; bytes sent or -1. | |
| long | line::platform::recv_some (socket_t s, char *p, std::size_t n) |
| void | line::platform::close_socket (socket_t s) |
| int | line::platform::last_socket_error () |
| bool | line::platform::err_interrupted (int e) |
| bool | line::platform::err_timed_out (int e) |
| A Winsock receive timeout reports WSAETIMEDOUT where POSIX reports EAGAIN. | |
| std::string | line::platform::socket_error_text (int e) |
The Windows (mingw-w64, UCRT) definitions behind include/line/util/platform.h and the two subprocess runners of include/line/util/subprocess.h.
Built only on WIN32, as the line_mp_platform archive. It is the ONE translation unit that includes <windows.h> and <winsock2.h>, so their macros never reach the engine's headers. Each function mirrors the POSIX inline of the same name; where Windows has no equivalent notion (a uid for docker run --user) the function says so through its return value, exactly as the header documents.
Paths are handled in the ANSI code page throughout (the A entry points and the CRT), the same encoding the rest of the engine's narrow strings carry, and every path this file RETURNS uses '/' separators so call sites that join with "/" stay consistent.
Definition in file platform_win.cpp.
| #define _WIN32_WINNT 0x0A00 |
Definition at line 29 of file platform_win.cpp.
| #define NOMINMAX |
Definition at line 35 of file platform_win.cpp.
| #define WIN32_LEAN_AND_MEAN |
Definition at line 32 of file platform_win.cpp.