diff --git a/examples/poll/Makefile.host b/examples/poll/Makefile.host index 90a448e929..151400efcd 100644 --- a/examples/poll/Makefile.host +++ b/examples/poll/Makefile.host @@ -1,7 +1,7 @@ ############################################################################ # examples/poll/Makefile.host # -# Copyright (C) 2008 Gregory Nutt. All rights reserved. +# Copyright (C) 2008, 2009 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -41,9 +41,9 @@ BIN = host DEFINES = -DTARGETIP=\"$(TARGETIP)\" -all: $(BIN)$(EXEEXT) +all: $(BIN) -$(BIN)$(EXEEXT): $(SRC) +$(BIN): $(SRC) $(HOSTCC) $(HOSTCFLAGS) $(DEFINES) $^ -o $@ clean: diff --git a/examples/poll/net_listener.c b/examples/poll/net_listener.c index 957f48fc06..fbb70f4bd4 100644 --- a/examples/poll/net_listener.c +++ b/examples/poll/net_listener.c @@ -1,7 +1,7 @@ /**************************************************************************** * examples/poll/net_listener.c * - * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Copyright (C) 2008, 2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -52,7 +52,9 @@ #include #include +#include #include + #include "poll_internal.h" /**************************************************************************** @@ -165,6 +167,7 @@ static inline boolean net_incomingdata(struct net_listener_s *nls, int sd) } } } + return 0; } /**************************************************************************** @@ -207,6 +210,7 @@ static inline boolean net_connection(struct net_listener_s *nls) return TRUE; } } + return FALSE; } /**************************************************************************** @@ -367,7 +371,7 @@ void *net_listener(pthread_addr_t pvarg) message("net_listener: Calling select(), listener sd=%d\n", nls.listensd); memcpy(&nls.working, &nls.master, sizeof(fd_set)); - ret = select(nls.mxsd + 1, &nls.working, NULL, NULL, &timeout); + ret = select(nls.mxsd + 1, (FAR fd_set*)&nls.working, (FAR fd_set*)NULL, (FAR fd_set*)NULL, &timeout); if (ret < 0) { message("net_listener: select failed: %d\n", errno); diff --git a/examples/poll/net_reader.c b/examples/poll/net_reader.c index cdddca7901..ca1fa4bb0c 100644 --- a/examples/poll/net_reader.c +++ b/examples/poll/net_reader.c @@ -1,7 +1,7 @@ /**************************************************************************** * examples/poll/net_reader.c * - * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Copyright (C) 2008, 2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -52,7 +52,9 @@ #include #include +#include #include + #include "poll_internal.h" /**************************************************************************** @@ -141,7 +143,7 @@ static void net_receive(int sd) { FD_ZERO(&readset); FD_SET(sd, &readset); - ret = select(sd + 1, &readset, NULL, NULL, &timeout); + ret = select(sd + 1, (FAR fd_set*)&readset, (FAR fd_set*)NULL, (FAR fd_set*)NULL, &timeout); } while (ret < 0 && errno == EINTR); diff --git a/examples/poll/poll_internal.h b/examples/poll/poll_internal.h index 38a5e0f7e5..cbf42ac566 100644 --- a/examples/poll/poll_internal.h +++ b/examples/poll/poll_internal.h @@ -1,7 +1,7 @@ /**************************************************************************** * examples/poll/poll_internal.h * - * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Copyright (C) 2008, 2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -73,14 +73,27 @@ /* If debug is enabled, then use lib_rawprintf so that OS debug output and * the test output are synchronized. + * + * These macros will differ depending upon if the toolchain supports + * macros with a variable number of arguments or not. */ -#ifdef CONFIG_DEBUG -# define message(...) lib_rawprintf(__VA_ARGS__) -# define msgflush() +#ifdef CONFIG_CPP_HAVE_VARARGS +# ifdef CONFIG_DEBUG +# define message(...) lib_rawprintf(__VA_ARGS__) +# define msgflush() +# else +# define message(...) printf(__VA_ARGS__) +# define msgflush() fflush(stdout) +# endif #else -# define message(...) printf(__VA_ARGS__) -# define msgflush() fflush(stdout) +# ifdef CONFIG_DEBUG +# define message lib_rawprintf +# define msgflush() +# else +# define message printf +# define msgflush() fflush(stdout) +# endif #endif #define FIFO_PATH1 "/dev/fifo0" diff --git a/examples/poll/select_listener.c b/examples/poll/select_listener.c index a9b31465cb..85ff57a5ef 100644 --- a/examples/poll/select_listener.c +++ b/examples/poll/select_listener.c @@ -1,7 +1,7 @@ /**************************************************************************** * examples/poll/select_listener.c * - * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Copyright (C) 2008, 2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -115,7 +115,7 @@ void *select_listener(pthread_addr_t pvarg) timeout = FALSE; ready = FALSE; - ret = select(fd+1, &rfds, NULL, NULL, &tv); + ret = select(fd+1, (FAR fd_set*)&rfds, (FAR fd_set*)NULL, (FAR fd_set*)NULL, &tv); message("\nselect_listener: select returned: %d\n", ret); if (ret < 0)