Skip to content

Commit

Permalink
fixup: Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
eugeneo committed Nov 12, 2024
1 parent ac3b0eb commit 1f3c572
Showing 1 changed file with 67 additions and 16 deletions.
83 changes: 67 additions & 16 deletions src/core/lib/event_engine/posix_engine/posix_system_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,6 @@

#ifdef GRPC_POSIX_SOCKET
#include <fcntl.h>
#endif // GRPC_POSIX_SOCKET

#ifdef GRPC_HAVE_UNIX_SOCKET
#ifdef GPR_WINDOWS
// clang-format off
#include <ws2def.h>
#include <afunix.h>
// clang-format on
#else
#include <sys/stat.h> // IWYU pragma: keep
#include <sys/un.h>
#endif // GPR_WINDOWS
#endif

namespace grpc_event_engine {
namespace experimental {
Expand All @@ -54,9 +41,7 @@ int PosixSystemApi::Bind(FileDescriptor fd, const struct sockaddr* addr,
void PosixSystemApi::Close(FileDescriptor fd) const { close(fd.fd()); }

int PosixSystemApi::Fcntl(FileDescriptor fd, int op, int args) const {
#ifdef GRPC_POSIX_SOCKET
return fcntl(fd.fd(), op, args);
#endif
}

int PosixSystemApi::GetSockOpt(FileDescriptor fd, int level, int optname,
Expand Down Expand Up @@ -94,4 +79,70 @@ int PosixSystemApi::SetSockOpt(FileDescriptor fd, int level, int optname,
}

} // namespace experimental
} // namespace grpc_event_engine
} // namespace grpc_event_engine

#else // GRPC_POSIX_SOCKET

namespace grpc_event_engine {
namespace experimental {

FileDescriptor PosixSystemApi::AdoptExternalFd(int fd) const {
grpc_core::Crash("unimplemented");
}

FileDescriptor PosixSystemApi::Socket(int domain, int type,
int protocol) const {
grpc_core::Crash("unimplemented");
}

int PosixSystemApi::Bind(FileDescriptor fd, const struct sockaddr* addr,
socklen_t addrlen) const {
grpc_core::Crash("unimplemented");
}

void PosixSystemApi::Close(FileDescriptor fd) const {
grpc_core::Crash("unimplemented");
}

int PosixSystemApi::Fcntl(FileDescriptor fd, int op, int args) const {
grpc_core::Crash("unimplemented");
}

int PosixSystemApi::GetSockOpt(FileDescriptor fd, int level, int optname,
void* optval, socklen_t* optlen) const {
grpc_core::Crash("unimplemented");
}

int PosixSystemApi::GetSockName(FileDescriptor fd, struct sockaddr* addr,
socklen_t* addrlen) const {
grpc_core::Crash("unimplemented");
}

int PosixSystemApi::GetPeerName(FileDescriptor fd, struct sockaddr* addr,
socklen_t* addrlen) const {
grpc_core::Crash("unimplemented");
}

int PosixSystemApi::Listen(FileDescriptor fd, int backlog) const {
grpc_core::Crash("unimplemented");
}

long PosixSystemApi::RecvMsg(FileDescriptor fd, struct msghdr* msg,
int flags) const {
grpc_core::Crash("unimplemented");
}

long PosixSystemApi::SendMsg(FileDescriptor fd, const struct msghdr* message,
int flags) const {
grpc_core::Crash("unimplemented");
}

int PosixSystemApi::SetSockOpt(FileDescriptor fd, int level, int optname,
const void* optval, socklen_t optlen) const {
grpc_core::Crash("unimplemented");
}

} // namespace experimental
} // namespace grpc_event_engine

#endif // GRPC_POSIX_SOCKET

0 comments on commit 1f3c572

Please sign in to comment.