From: Roy Marples Date: Mon, 18 Feb 2013 21:25:07 +0000 (+0000) Subject: Change from ppoll(2) to pollts(2). X-Git-Tag: v5.99.6~58 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=237e8234a7e576a62d80271459d1bb5914692ceb;p=thirdparty%2Fdhcpcd.git Change from ppoll(2) to pollts(2). I was going to go with ppoll(2) because I would guess the Open Group would prefer the name of it over pollts(2) if they ever standardised it. However that causes a problem with _GNU_SOURCE and my code base so I've gone to pollts(2) and suck in the compat header for Linux users to avoid that sillyness. --- diff --git a/common.h b/common.h index b03f8eee..e6976165 100644 --- a/common.h +++ b/common.h @@ -1,6 +1,6 @@ /* * dhcpcd - DHCP client daemon - * Copyright (c) 2006-2011 Roy Marples + * Copyright (c) 2006-2013 Roy Marples * All rights reserved * Redistribution and use in source and binary forms, with or without @@ -31,7 +31,6 @@ #include #include -#include "config.h" #include "defs.h" #define UNCONST(a) ((void *)(unsigned long)(const void *)(a)) diff --git a/configure b/configure index b2b5ddce..9180c423 100755 --- a/configure +++ b/configure @@ -57,7 +57,8 @@ for x do --without-getline) GETLINE=no;; --without-strlcpy) STRLCPY=no;; --without-posix_spawn) POSIX_SPAWN=no;; - --without-ppoll) PPOLL=no;; + --without-pollts) POLLTS=no;; + --with-pollts) POLLTS=$var;; --serviceexists) SERVICEEXISTS=$var;; --servicecmd) SERVICECMD=$var;; --servicestatus) SERVICESTATUS=$var;; @@ -525,46 +526,47 @@ else echo "#include " >>$CONFIG_H fi -if [ -z "$PPOLL" ]; then - printf "Testing for ppoll ... " - cat <_ppoll.c +if [ -z "$POLLTS" ]; then + printf "Testing for pollts ... " + cat <_pollts.c #include +#include #include +#include int main(void) { - ppoll(NULL, 0, NULL, NULL); + pollts(NULL, 0, NULL, NULL); return 0; } EOF - if $XCC _ppoll.c -o _ppoll 2>/dev/null; then - PPOLL=yes + if $XCC _pollts.c -o _pollts 2>/dev/null; then + POLLTS=yes else - PPOLL=no + POLLTS=no fi - echo "$PPOLL" - rm -f _ppoll.c _ppoll + echo "$POLLTS" + rm -f _pollts.c _pollts fi -if [ "$PPOLL" = no ]; then - printf "Testing for pollts ... " - cat <_pollts.c +if [ "$POLLTS" = no ]; then + printf "Testing for ppoll ... " + cat <_ppoll.c #include -#include #include -#include int main(void) { - pollts(NULL, 0, NULL, NULL); + ppoll(NULL, 0, NULL, NULL); return 0; } EOF - if $XCC _pollts.c -o _pollts 2>/dev/null; then - PPOLL=pollts + if $XCC _ppoll.c -o _ppoll 2>/dev/null; then + POLLTS=ppoll echo "yes" else - PPOLL=no + POLLTS=no echo "no" fi - rm -f _pollts.c _pollts + echo "$POLLTS" + rm -f _ppoll.c _ppoll fi -if [ "$PPOLL" = no ]; then +if [ "$POLLTS" = no ]; then printf "Testing for pselect ... " cat <_pselect.c #include @@ -575,17 +577,20 @@ int main(void) { } EOF if $XCC _pselect.c -o _pselect 2>/dev/null; then - PPOLL=pselect + POLLTS=pselect echo "yes" else - PPOLL=no + POLLTS=no echo "no" fi rm -f _pselect.c _pselect fi -case "$PPOLL" in -pollts) - echo "#define ppoll pollts" >>$CONFIG_H +case "$POLLTS" in +yes) + ;; +ppoll) + echo "#include \"compat/ppoll.h\"" >>$CONFIG_H + echo "#define pollts ppoll" >>$CONFIG_H ;; pselect) echo "COMPAT_SRCS+= compat/pselect.c" >>$CONFIG_MK diff --git a/eloop.c b/eloop.c index 2a1d88c0..1d089915 100644 --- a/eloop.c +++ b/eloop.c @@ -367,7 +367,7 @@ eloop_start(const sigset_t *sigmask) exit(EXIT_FAILURE); } - n = ppoll(fds, events_len, tsp, sigmask); + n = pollts(fds, events_len, tsp, sigmask); if (n == -1) { if (errno == EAGAIN || errno == EINTR) continue; diff --git a/if-linux-wireless.c b/if-linux-wireless.c index f4b649b5..b8f68faa 100644 --- a/if-linux-wireless.c +++ b/if-linux-wireless.c @@ -1,6 +1,6 @@ /* * dhcpcd - DHCP client daemon - * Copyright (c) 2009-2010 Roy Marples + * Copyright (c) 2009-2013 Roy Marples * All rights reserved * Redistribution and use in source and binary forms, with or without @@ -55,6 +55,7 @@ #include #include "common.h" +#include "config.h" /* We can't include net.h or dhcpcd.h because * they would pull in net/if.h, which defeats the purpose of this hack. */