diff --git a/src/core/lib/event_engine/extensions/system_api.h b/src/core/lib/event_engine/extensions/system_api.h index a799f940f8771..c0e9dcd3be691 100644 --- a/src/core/lib/event_engine/extensions/system_api.h +++ b/src/core/lib/event_engine/extensions/system_api.h @@ -15,7 +15,6 @@ #ifndef GRPC_SRC_CORE_LIB_EVENT_ENGINE_EXTENSIONS_SYSTEM_API_H #define GRPC_SRC_CORE_LIB_EVENT_ENGINE_EXTENSIONS_SYSTEM_API_H -#include #include namespace grpc_event_engine { @@ -34,8 +33,6 @@ class FileDescriptor { int fd_; }; -using EpollEvent = epoll_event; - class SystemApi { public: virtual ~SystemApi() = default; diff --git a/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc b/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc index 52e96b93190f3..aad6eabf66f12 100644 --- a/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc +++ b/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc @@ -591,7 +591,8 @@ namespace experimental { using ::grpc_event_engine::experimental::EventEngine; using ::grpc_event_engine::experimental::Poller; -Epoll1Poller::Epoll1Poller(Scheduler* /* engine */) { +Epoll1Poller::Epoll1Poller(Scheduler* /* engine */, + SystemApi* /* system_api */) { grpc_core::Crash("unimplemented"); } @@ -623,7 +624,8 @@ void Epoll1Poller::Kick() { grpc_core::Crash("unimplemented"); } // If GRPC_LINUX_EPOLL is not defined, it means epoll is not available. Return // nullptr. -std::shared_ptr MakeEpoll1Poller(Scheduler* /*scheduler*/) { +std::shared_ptr MakeEpoll1Poller(Scheduler* /*scheduler*/, + SystemApi* system_api) { return nullptr; } diff --git a/src/core/lib/event_engine/posix_engine/posix_engine_listener.cc b/src/core/lib/event_engine/posix_engine/posix_engine_listener.cc index 2e5cec97ce22d..118765e2f2a8c 100644 --- a/src/core/lib/event_engine/posix_engine/posix_engine_listener.cc +++ b/src/core/lib/event_engine/posix_engine/posix_engine_listener.cc @@ -203,7 +203,7 @@ void PosixEngineListenerImpl::AsyncConnectionAcceptor::NotifyOnAccept( } SystemApi* system_api = handle_->Poller()->GetSystemApi(); PosixSocketWrapper sock(system_api->AdoptExternalFd(fd)); - (void)sock.SetSocketNoSigpipeIfPossible(); + (void)sock.SetSocketNoSigpipeIfPossible(*system_api); auto result = sock.ApplySocketMutatorInOptions( GRPC_FD_SERVER_CONNECTION_USAGE, listener_->options_); if (!result.ok()) { @@ -262,7 +262,7 @@ absl::Status PosixEngineListenerImpl::HandleExternalConnection( } SystemApi* system_api = poller_->GetSystemApi(); PosixSocketWrapper sock(system_api->AdoptExternalFd(fd)); - (void)sock.SetSocketNoSigpipeIfPossible(); + (void)sock.SetSocketNoSigpipeIfPossible(*system_api); auto peer_name = sock.PeerAddressString(*system_api); if (!peer_name.ok()) { return absl::UnknownError( diff --git a/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.cc b/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.cc index 65f8a5f04277b..85cd51d3a96e1 100644 --- a/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.cc +++ b/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.cc @@ -169,7 +169,7 @@ absl::Status PrepareSocket(const SystemApi& system_api, GRPC_RETURN_IF_ERROR(socket.sock.SetSocketDscp(system_api, options.dscp)); socket.sock.TrySetSocketTcpUserTimeout(system_api, options, false); } - GRPC_RETURN_IF_ERROR(socket.sock.SetSocketNoSigpipeIfPossible()); + GRPC_RETURN_IF_ERROR(socket.sock.SetSocketNoSigpipeIfPossible(system_api)); GRPC_RETURN_IF_ERROR(socket.sock.ApplySocketMutatorInOptions( GRPC_FD_SERVER_LISTENER_USAGE, options)); diff --git a/src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc b/src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc index 17d9c3b711c22..9561ad68db34a 100644 --- a/src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc +++ b/src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc @@ -144,7 +144,7 @@ absl::Status PrepareTcpClientSocket(const SystemApi& system_api, GRPC_RETURN_IF_ERROR(sock.SetSocketDscp(system_api, options.dscp)); sock.TrySetSocketTcpUserTimeout(system_api, options, true); } - GRPC_RETURN_IF_ERROR(sock.SetSocketNoSigpipeIfPossible()); + GRPC_RETURN_IF_ERROR(sock.SetSocketNoSigpipeIfPossible(system_api)); GRPC_RETURN_IF_ERROR(sock.ApplySocketMutatorInOptions( GRPC_FD_CLIENT_CONNECTION_USAGE, options)); // No errors. Set close_fd to false to ensure the socket is not closed. @@ -366,7 +366,8 @@ absl::Status PosixSocketWrapper::SetSocketNonBlocking( return absl::OkStatus(); } -absl::Status PosixSocketWrapper::SetSocketNoSigpipeIfPossible() { +absl::Status PosixSocketWrapper::SetSocketNoSigpipeIfPossible( + const SystemApi& system_api) { #ifdef GRPC_HAVE_SO_NOSIGPIPE int val = 1; int newval; diff --git a/src/core/lib/event_engine/posix_engine/tcp_socket_utils.h b/src/core/lib/event_engine/posix_engine/tcp_socket_utils.h index 60a542cbd7fc6..6be2ec1d41766 100644 --- a/src/core/lib/event_engine/posix_engine/tcp_socket_utils.h +++ b/src/core/lib/event_engine/posix_engine/tcp_socket_utils.h @@ -205,7 +205,7 @@ class PosixSocketWrapper { // Tries to set SO_NOSIGPIPE if available on this platform. // If SO_NO_SIGPIPE is not available, returns not OK status. - absl::Status SetSocketNoSigpipeIfPossible(); + absl::Status SetSocketNoSigpipeIfPossible(const SystemApi& system_api); // Tries to set IP_PKTINFO if available on this platform. If IP_PKTINFO is not // available, returns not OK status.