Lines Matching refs:descriptors
670 static void init_startup_info(STARTUPINFOW *si, descriptorspec_item *descriptors, int ndesc) in init_startup_info() argument
682 switch (descriptors[i].index) { in init_startup_info()
684 si->hStdInput = descriptors[i].childend; in init_startup_info()
687 si->hStdOutput = descriptors[i].childend; in init_startup_info()
690 si->hStdError = descriptors[i].childend; in init_startup_info()
941 descriptorspec_item *descriptors, int ndesc, int nindex) in redirect_proc_descriptor() argument
946 if (descriptors[i].index == target) { in redirect_proc_descriptor()
947 redirect_to = descriptors[i].childend; in redirect_proc_descriptor()
976 static zend_result set_proc_descriptor_from_array(zval *descitem, descriptorspec_item *descriptors, in set_proc_descriptor_from_array() argument
992 retval = set_proc_descriptor_to_pipe(&descriptors[ndesc], zmode); in set_proc_descriptor_from_array()
995 retval = set_proc_descriptor_to_socket(&descriptors[ndesc]); in set_proc_descriptor_from_array()
1004 retval = set_proc_descriptor_to_file(&descriptors[ndesc], zfile, zmode); in set_proc_descriptor_from_array()
1018 &descriptors[ndesc], (int)Z_LVAL_P(ztarget), descriptors, ndesc, nindex); in set_proc_descriptor_from_array()
1021 retval = set_proc_descriptor_to_blackhole(&descriptors[ndesc]); in set_proc_descriptor_from_array()
1024 retval = set_proc_descriptor_to_pty(&descriptors[ndesc], pty_master_fd, pty_slave_fd); in set_proc_descriptor_from_array()
1062 …entends_of_pipes(posix_spawn_file_actions_t * actions, descriptorspec_item *descriptors, int ndesc) in close_parentends_of_pipes() argument
1066 if (descriptors[i].type != DESCRIPTOR_TYPE_STD) { in close_parentends_of_pipes()
1067 r = posix_spawn_file_actions_addclose(actions, descriptors[i].parentend); in close_parentends_of_pipes()
1069 …php_error_docref(NULL, E_WARNING, "Cannot close file descriptor %d: %s", descriptors[i].parentend,… in close_parentends_of_pipes()
1073 if (descriptors[i].childend != descriptors[i].index) { in close_parentends_of_pipes()
1074 r = posix_spawn_file_actions_adddup2(actions, descriptors[i].childend, descriptors[i].index); in close_parentends_of_pipes()
1077 "file descriptor %d: %s", descriptors[i].childend, descriptors[i].index, strerror(r)); in close_parentends_of_pipes()
1080 r = posix_spawn_file_actions_addclose(actions, descriptors[i].childend); in close_parentends_of_pipes()
1082 …php_error_docref(NULL, E_WARNING, "Cannot close file descriptor %d: %s", descriptors[i].childend, … in close_parentends_of_pipes()
1091 static zend_result close_parentends_of_pipes(descriptorspec_item *descriptors, int ndesc) in close_parentends_of_pipes() argument
1098 if (descriptors[i].type != DESCRIPTOR_TYPE_STD) { in close_parentends_of_pipes()
1099 close(descriptors[i].parentend); in close_parentends_of_pipes()
1101 if (descriptors[i].childend != descriptors[i].index) { in close_parentends_of_pipes()
1102 if (dup2(descriptors[i].childend, descriptors[i].index) < 0) { in close_parentends_of_pipes()
1104 "file descriptor %d: %s", descriptors[i].childend, descriptors[i].index, strerror(errno)); in close_parentends_of_pipes()
1107 close(descriptors[i].childend); in close_parentends_of_pipes()
1116 static void close_all_descriptors(descriptorspec_item *descriptors, int ndesc) in close_all_descriptors() argument
1119 close_descriptor(descriptors[i].childend); in close_all_descriptors()
1120 if (descriptors[i].parentend) in close_all_descriptors()
1121 close_descriptor(descriptors[i].parentend); in close_all_descriptors()
1154 descriptorspec_item *descriptors = NULL; in PHP_FUNCTION() local
1229 descriptors = alloc_descriptor_array(descriptorspec); in PHP_FUNCTION()
1238 descriptors[ndesc].index = (int)nindex; in PHP_FUNCTION()
1242 if (set_proc_descriptor_from_resource(descitem, &descriptors[ndesc], ndesc) == FAILURE) { in PHP_FUNCTION()
1246 if (set_proc_descriptor_from_array(descitem, descriptors, ndesc, (int)nindex, in PHP_FUNCTION()
1272 init_startup_info(&si, descriptors, ndesc); in PHP_FUNCTION()
1319 close_all_descriptors(descriptors, ndesc); in PHP_FUNCTION()
1334 if (close_parentends_of_pipes(&factions, descriptors, ndesc) == FAILURE) { in PHP_FUNCTION()
1336 close_all_descriptors(descriptors, ndesc); in PHP_FUNCTION()
1356 close_all_descriptors(descriptors, ndesc); in PHP_FUNCTION()
1367 if (close_parentends_of_pipes(descriptors, ndesc) == FAILURE) { in PHP_FUNCTION()
1398 close_all_descriptors(descriptors, ndesc); in PHP_FUNCTION()
1431 close_descriptor(descriptors[i].childend); in PHP_FUNCTION()
1433 if (descriptors[i].type == DESCRIPTOR_TYPE_PIPE) { in PHP_FUNCTION()
1436 switch (descriptors[i].mode_flags) { in PHP_FUNCTION()
1457 stream = php_stream_fopen_from_fd(_open_osfhandle((intptr_t)descriptors[i].parentend, in PHP_FUNCTION()
1458 descriptors[i].mode_flags), mode_string, NULL); in PHP_FUNCTION()
1461 stream = php_stream_fopen_from_fd(descriptors[i].parentend, mode_string, NULL); in PHP_FUNCTION()
1463 } else if (descriptors[i].type == DESCRIPTOR_TYPE_SOCKET) { in PHP_FUNCTION()
1464 stream = php_stream_sock_open_from_socket((php_socket_t) descriptors[i].parentend, NULL); in PHP_FUNCTION()
1476 add_index_zval(pipes, descriptors[i].index, &retfp); in PHP_FUNCTION()
1507 if (descriptors) { in PHP_FUNCTION()
1508 efree(descriptors); in PHP_FUNCTION()