Skip to content

Commit

Permalink
THRIFT-5666: lib: cpp: prefer poll.h over sys/poll.h
Browse files Browse the repository at this point in the history
The `<sys/poll.h>` header is not actually where `poll(2)` must be
defined according to the spec. However, it may be the case that
some random UNIX-like OS uses `<sys/poll.h>` instead.

Both use cases can be supported simply by including the proper
header, if it exists.

Signed-off-by: Chris Friedt <[email protected]>
  • Loading branch information
cfriedt authored and Jens-G committed Nov 20, 2022
1 parent 8f83e46 commit f525e4c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/cpp/src/thrift/transport/TNonblockingServerSocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
#ifdef HAVE_SYS_UN_H
#include <sys/un.h>
#endif
#ifdef HAVE_POLL_H
#include <poll.h>
#endif
#ifdef HAVE_SYS_POLL_H
#include <sys/poll.h>
#endif
Expand Down
3 changes: 3 additions & 0 deletions lib/cpp/src/thrift/transport/TSSLSocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_POLL_H
#include <poll.h>
#endif
#ifdef HAVE_SYS_POLL_H
#include <sys/poll.h>
#endif
Expand Down
3 changes: 3 additions & 0 deletions lib/cpp/src/thrift/transport/TServerSocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
#ifdef HAVE_SYS_UN_H
#include <sys/un.h>
#endif
#ifdef HAVE_POLL_H
#include <poll.h>
#endif
#ifdef HAVE_SYS_POLL_H
#include <sys/poll.h>
#endif
Expand Down
3 changes: 3 additions & 0 deletions lib/cpp/src/thrift/transport/TSocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
#ifdef HAVE_SYS_UN_H
#include <sys/un.h>
#endif
#ifdef HAVE_POLL_H
#include <poll.h>
#endif
#ifdef HAVE_SYS_POLL_H
#include <sys/poll.h>
#endif
Expand Down

0 comments on commit f525e4c

Please sign in to comment.