38 #define CHILD_STDIO_SIZE(count) \
40 sizeof(unsigned char) * (count) + \
41 sizeof(uintptr_t) * (count))
43 #define CHILD_STDIO_COUNT(buffer) \
44 *((unsigned int*) (buffer))
46 #define CHILD_STDIO_CRT_FLAGS(buffer, fd) \
47 *((unsigned char*) (buffer) + sizeof(int) + fd)
49 #define CHILD_STDIO_HANDLE(buffer, fd) \
50 *((HANDLE*) ((unsigned char*) (buffer) + \
52 sizeof(unsigned char) * \
53 CHILD_STDIO_COUNT((buffer)) + \
54 sizeof(HANDLE) * (fd)))
62 #define FNOINHERIT 0x10
79 handle = GetStdHandle(STD_INPUT_HANDLE);
81 SetHandleInformation(
handle, HANDLE_FLAG_INHERIT, 0);
83 handle = GetStdHandle(STD_OUTPUT_HANDLE);
85 SetHandleInformation(
handle, HANDLE_FLAG_INHERIT, 0);
87 handle = GetStdHandle(STD_ERROR_HANDLE);
89 SetHandleInformation(
handle, HANDLE_FLAG_INHERIT, 0);
101 SECURITY_ATTRIBUTES sa;
102 DWORD server_access = 0;
103 DWORD client_access = 0;
112 server_access |= PIPE_ACCESS_OUTBOUND | PIPE_ACCESS_INBOUND;
113 client_access |= GENERIC_READ | FILE_WRITE_ATTRIBUTES;
116 server_access |= PIPE_ACCESS_INBOUND;
117 client_access |= GENERIC_WRITE | FILE_READ_ATTRIBUTES;
130 sa.nLength =
sizeof sa;
131 sa.lpSecurityDescriptor =
NULL;
132 sa.bInheritHandle =
TRUE;
135 child_pipe = CreateFileA(pipe_name,
140 overlap ? FILE_FLAG_OVERLAPPED : 0,
143 err = GetLastError();
151 BOOL
r = GetNamedPipeHandleState(child_pipe,
159 assert(
mode == (PIPE_READMODE_BYTE | PIPE_WAIT));
165 if (!ConnectNamedPipe(server_pipe->handle,
NULL)) {
166 if (GetLastError() != ERROR_PIPE_CONNECTED) {
167 err = GetLastError();
178 *child_pipe_ptr = child_pipe;
187 CloseHandle(child_pipe);
207 return ERROR_INVALID_HANDLE;
210 current_process = GetCurrentProcess();
212 if (!DuplicateHandle(current_process,
218 DUPLICATE_SAME_ACCESS)) {
220 return GetLastError();
232 return ERROR_INVALID_HANDLE;
243 SECURITY_ATTRIBUTES sa;
245 sa.nLength =
sizeof sa;
246 sa.lpSecurityDescriptor =
NULL;
247 sa.bInheritHandle =
TRUE;
251 FILE_SHARE_READ | FILE_SHARE_WRITE,
257 return GetLastError();
274 if (count < 0 || count > 255) {
276 return ERROR_NOT_SUPPORTED;
277 }
else if (
count < 3) {
285 return ERROR_OUTOFMEMORY;
298 if (i < options->stdio_count) {
315 FILE_GENERIC_WRITE | FILE_READ_ATTRIBUTES;
360 if (fdopt.
data.
fd <= 2 &&
err == ERROR_INVALID_HANDLE) {
369 switch (GetFileType(child_handle)) {
379 case FILE_TYPE_REMOTE:
383 case FILE_TYPE_UNKNOWN:
384 if (GetLastError() != 0) {
385 err = GetLastError();
386 CloseHandle(child_handle);
403 HANDLE stream_handle, child_handle;
404 unsigned char crt_flags;
408 if (
stream->type == UV_TTY) {
411 }
else if (
stream->type == UV_NAMED_PIPE &&
420 if (stream_handle ==
NULL ||
424 err = ERROR_NOT_SUPPORTED;
475 SetHandleInformation(
handle, HANDLE_FLAG_INHERIT, 0);
static mcore_handle handle
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void count
static INLINE HANDLE uv__get_osfhandle(int fd)
#define INVALID_HANDLE_VALUE
static static fork const void static count static fd const char const char static newpath char char char static envp time_t static t const char static mode static whence const char static dir time_t static t unsigned static seconds const char struct utimbuf static buf static inc static sig const char static mode dup
static static fork const void static count static fd const char static mode const char static pathname const char static path const char static dev const char static group static getpid static getuid void void static data static pause access
static const char struct stat static buf struct stat static buf static vhangup int options
assert(limit<=UINT32_MAX/2)
static int uv__create_stdio_pipe_pair(uv_loop_t *loop, uv_pipe_t *server_pipe, HANDLE *child_pipe_ptr, unsigned int flags)
#define CHILD_STDIO_CRT_FLAGS(buffer, fd)
static int uv__duplicate_handle(uv_loop_t *loop, HANDLE handle, HANDLE *dup)
void uv__stdio_noinherit(BYTE *buffer)
void uv__stdio_destroy(BYTE *buffer)
void uv_disable_stdio_inheritance(void)
static int uv__duplicate_fd(uv_loop_t *loop, int fd, HANDLE *dup)
WORD uv__stdio_size(BYTE *buffer)
int uv__stdio_create(uv_loop_t *loop, const uv_process_options_t *options, BYTE **buffer_ptr)
int uv__create_nul_handle(HANDLE *handle_ptr, DWORD access)
#define CHILD_STDIO_COUNT(buffer)
int uv__stdio_verify(BYTE *buffer, WORD size)
#define CHILD_STDIO_HANDLE(buffer, fd)
HANDLE uv__stdio_handle(BYTE *buffer, int fd)
#define CHILD_STDIO_SIZE(count)
static struct sockaddr static addrlen static backlog const void static flags void flags
UV_HANDLE_FIELDS UV_STREAM_FIELDS int ipc
union uv_stdio_container_s::@397 data
int uv_stdio_pipe_server(uv_loop_t *loop, uv_pipe_t *handle, DWORD access, char *name, size_t nameSize)
void uv_pipe_cleanup(uv_loop_t *loop, uv_pipe_t *handle)
void error(const char *msg)
void * uv__malloc(size_t size)
static const z80_opcode fd[]