cygwin: disable non-functional ipc handle send
On Cygwin `recvmsg` always sets `msg_controllen` to zero on a message received from a named pipe. Therefore we cannot use `sendmsg` to send handles for ipc. Return failure early from this code path as `ENOSYS`. Skip tests requiring this feature since it is not available. PR-URL: https://github.com/libuv/libuv/pull/1312 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
This commit is contained in:
parent
317fc756a5
commit
580f032737
@ -1410,6 +1410,12 @@ int uv_write2(uv_write_t* req,
|
||||
*/
|
||||
if (uv__handle_fd((uv_handle_t*) send_handle) < 0)
|
||||
return -EBADF;
|
||||
|
||||
#if defined(__CYGWIN__) || defined(__MSYS__)
|
||||
/* Cygwin recvmsg always sets msg_controllen to zero, so we cannot send it.
|
||||
See https://github.com/mirror/newlib-cygwin/blob/86fc4bf0/winsup/cygwin/fhandler_socket.cc#L1736-L1743 */
|
||||
return -ENOSYS;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* It's legal for write_queue_size > 0 even when the write_queue is empty;
|
||||
|
||||
@ -213,4 +213,12 @@ UNUSED static int can_ipv6(void) {
|
||||
# define NO_FS_EVENTS "Filesystem watching not supported on this platform."
|
||||
#endif
|
||||
|
||||
#if defined(__MSYS__)
|
||||
# define NO_SEND_HANDLE_ON_PIPE \
|
||||
"MSYS2 runtime does not support sending handles on pipes."
|
||||
#elif defined(__CYGWIN__)
|
||||
# define NO_SEND_HANDLE_ON_PIPE \
|
||||
"Cygwin runtime does not support sending handles on pipes."
|
||||
#endif
|
||||
|
||||
#endif /* TASK_H_ */
|
||||
|
||||
@ -224,10 +224,16 @@ static int run_ipc_send_recv_pipe(int inprocess) {
|
||||
}
|
||||
|
||||
TEST_IMPL(ipc_send_recv_pipe) {
|
||||
#if defined(NO_SEND_HANDLE_ON_PIPE)
|
||||
RETURN_SKIP(NO_SEND_HANDLE_ON_PIPE);
|
||||
#endif
|
||||
return run_ipc_send_recv_pipe(0);
|
||||
}
|
||||
|
||||
TEST_IMPL(ipc_send_recv_pipe_inprocess) {
|
||||
#if defined(NO_SEND_HANDLE_ON_PIPE)
|
||||
RETURN_SKIP(NO_SEND_HANDLE_ON_PIPE);
|
||||
#endif
|
||||
return run_ipc_send_recv_pipe(1);
|
||||
}
|
||||
|
||||
@ -259,10 +265,16 @@ static int run_ipc_send_recv_tcp(int inprocess) {
|
||||
}
|
||||
|
||||
TEST_IMPL(ipc_send_recv_tcp) {
|
||||
#if defined(NO_SEND_HANDLE_ON_PIPE)
|
||||
RETURN_SKIP(NO_SEND_HANDLE_ON_PIPE);
|
||||
#endif
|
||||
return run_ipc_send_recv_tcp(0);
|
||||
}
|
||||
|
||||
TEST_IMPL(ipc_send_recv_tcp_inprocess) {
|
||||
#if defined(NO_SEND_HANDLE_ON_PIPE)
|
||||
RETURN_SKIP(NO_SEND_HANDLE_ON_PIPE);
|
||||
#endif
|
||||
return run_ipc_send_recv_tcp(1);
|
||||
}
|
||||
|
||||
|
||||
@ -411,6 +411,9 @@ static int run_ipc_test(const char* helper, uv_read_cb read_cb) {
|
||||
|
||||
|
||||
TEST_IMPL(ipc_listen_before_write) {
|
||||
#if defined(NO_SEND_HANDLE_ON_PIPE)
|
||||
RETURN_SKIP(NO_SEND_HANDLE_ON_PIPE);
|
||||
#endif
|
||||
int r = run_ipc_test("ipc_helper_listen_before_write", on_read);
|
||||
ASSERT(local_conn_accepted == 1);
|
||||
ASSERT(remote_conn_accepted == 1);
|
||||
@ -421,6 +424,9 @@ TEST_IMPL(ipc_listen_before_write) {
|
||||
|
||||
|
||||
TEST_IMPL(ipc_listen_after_write) {
|
||||
#if defined(NO_SEND_HANDLE_ON_PIPE)
|
||||
RETURN_SKIP(NO_SEND_HANDLE_ON_PIPE);
|
||||
#endif
|
||||
int r = run_ipc_test("ipc_helper_listen_after_write", on_read);
|
||||
ASSERT(local_conn_accepted == 1);
|
||||
ASSERT(remote_conn_accepted == 1);
|
||||
@ -431,6 +437,9 @@ TEST_IMPL(ipc_listen_after_write) {
|
||||
|
||||
|
||||
TEST_IMPL(ipc_tcp_connection) {
|
||||
#if defined(NO_SEND_HANDLE_ON_PIPE)
|
||||
RETURN_SKIP(NO_SEND_HANDLE_ON_PIPE);
|
||||
#endif
|
||||
int r = run_ipc_test("ipc_helper_tcp_connection", on_read_connection);
|
||||
ASSERT(read_cb_called == 1);
|
||||
ASSERT(tcp_write_cb_called == 1);
|
||||
@ -491,6 +500,9 @@ TEST_IMPL(listen_no_simultaneous_accepts) {
|
||||
}
|
||||
|
||||
TEST_IMPL(ipc_listen_after_bind_twice) {
|
||||
#if defined(NO_SEND_HANDLE_ON_PIPE)
|
||||
RETURN_SKIP(NO_SEND_HANDLE_ON_PIPE);
|
||||
#endif
|
||||
int r = run_ipc_test("ipc_helper_bind_twice", on_read_listen_after_bound_twice);
|
||||
ASSERT(read_cb_called == 2);
|
||||
ASSERT(exit_cb_called == 1);
|
||||
|
||||
@ -102,6 +102,9 @@ static void read_cb(uv_stream_t* handle,
|
||||
|
||||
|
||||
TEST_IMPL(pipe_sendmsg) {
|
||||
#if defined(NO_SEND_HANDLE_ON_PIPE)
|
||||
RETURN_SKIP(NO_SEND_HANDLE_ON_PIPE);
|
||||
#endif
|
||||
uv_pipe_t p;
|
||||
int r;
|
||||
int fds[2];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user