Skip to content

Commit

Permalink
Fix setting the default value of USE_POLL
Browse files Browse the repository at this point in the history
  • Loading branch information
saleyn committed Dec 22, 2023
1 parent a2b13ff commit 09a30ea
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions c_src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ ERL_CXXFLAGS ?= $(shell erl -noshell -noinput -eval "io:format(\"-I~ts/erts-~ts/
ERL_LDFLAGS ?= $(shell erl -noshell -noinput -eval "io:format(\"-L~ts\", [code:lib_dir(erl_interface, lib)]), halt(0).")

CXXFLAGS += -g -std=c++11 -finline-functions -Wall -DHAVE_PTRACE -MMD
USE_POLL ?= 1

UNAME_SYS := $(shell uname -s | tr 'A-Z' 'a-z')

Expand All @@ -26,8 +27,8 @@ endif


# By default use poll(2). If USE_POLL=0 is defined, use select(2):
ifneq ($(filter $(USE_POLL),1 true),)
CXXFLAGS += -DUSE_POLL=1
ifneq ($(filter $(USE_POLL),0 1 true),)
CXXFLAGS += -DUSE_POLL=$(USE_POLL)
endif

ifeq ($(findstring $(TARGET),linux),)
Expand Down
4 changes: 2 additions & 2 deletions c_src/exec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
*/

#include "exec.hpp"
#if defined(USE_POLL) && USE_POLL > 0
#if defined(USE_POLL) && USE_POLL
# include <sys/poll.h>
#endif

Expand Down Expand Up @@ -618,7 +618,7 @@ void initialize(int userid, bool use_alt_fds, bool is_root, bool requested_root)
DEBUG(debug, "Initializing: uid=%d, userid=%d%s%s%s",
getuid(), userid, is_root ? " is-root":"",
requested_root ? " requested-root":"",
#if defined(USE_POLL) && USE_POLL > 0
#if defined(USE_POLL) && USE_POLL
", use-poll=1"
#else
""
Expand Down
4 changes: 2 additions & 2 deletions c_src/exec_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ int ptsname_r(int fd, char* buf, size_t buflen) {
//------------------------------------------------------------------------------
// CmdInfo
//------------------------------------------------------------------------------
#if !defined(USE_POLL) || (USE_POLL == 0)
#if !defined(USE_POLL) || !USE_POLL
void CmdInfo::include_stream_fd(FdHandler &fdhandler)
{
for (int i=STDIN_FILENO; i <= STDERR_FILENO; i++) {
Expand Down Expand Up @@ -59,7 +59,7 @@ void CmdInfo::process_stream_data(FdHandler &fdhandler)
}
#endif /* !defined(USE_POLL) */

#if defined(USE_POLL) && USE_POLL > 0
#if defined(USE_POLL) && USE_POLL
void CmdInfo::include_stream_fd(FdHandler &fdhandler)
{
for (int i=STDIN_FILENO; i <= STDERR_FILENO; i++) {
Expand Down

0 comments on commit 09a30ea

Please sign in to comment.