]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Change from ppoll(2) to pollts(2).
authorRoy Marples <roy@marples.name>
Mon, 18 Feb 2013 21:25:07 +0000 (21:25 +0000)
committerRoy Marples <roy@marples.name>
Mon, 18 Feb 2013 21:25:07 +0000 (21:25 +0000)
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.

common.h
configure
eloop.c
if-linux-wireless.c

index b03f8eee9556d999cd0229af2015fed465a4d313..e6976165956a7c90223029842c66af493491fed1 100644 (file)
--- a/common.h
+++ b/common.h
@@ -1,6 +1,6 @@
 /* 
  * dhcpcd - DHCP client daemon
- * Copyright (c) 2006-2011 Roy Marples <roy@marples.name>
+ * Copyright (c) 2006-2013 Roy Marples <roy@marples.name>
  * All rights reserved
 
  * Redistribution and use in source and binary forms, with or without
@@ -31,7 +31,6 @@
 #include <sys/time.h>
 #include <stdio.h>
 
-#include "config.h"
 #include "defs.h"
 
 #define UNCONST(a)             ((void *)(unsigned long)(const void *)(a))
index b2b5ddce3e1b3eb9641c6059d29b648e13597142..9180c423b13cafd4fed752a6b9524a27c1914d14 100755 (executable)
--- 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 <spawn.h>" >>$CONFIG_H
 fi
 
-if [ -z "$PPOLL" ]; then
-       printf "Testing for ppoll ... "
-       cat <<EOF >_ppoll.c
+if [ -z "$POLLTS" ]; then
+       printf "Testing for pollts ... "
+       cat <<EOF >_pollts.c
 #include <poll.h>
+#include <signal.h>
 #include <stdlib.h>
+#include <time.h>
 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 <<EOF >_pollts.c
+if [ "$POLLTS" = no ]; then
+       printf "Testing for ppoll ... "
+       cat <<EOF >_ppoll.c
 #include <poll.h>
-#include <signal.h>
 #include <stdlib.h>
-#include <time.h>
 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 <<EOF >_pselect.c
 #include <sys/select.h>
@@ -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 2a1d88c062c373fdb09c2d58dbfdb479a66040cf..1d08991531387269c84918ae689f715e8993be85 100644 (file)
--- 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;
index f4b649b54cf169a0eb1028b097cb919bcf4a8f5d..b8f68faadd5bf894a7b1af54089155d27b9ed85d 100644 (file)
@@ -1,6 +1,6 @@
 /* 
  * dhcpcd - DHCP client daemon
- * Copyright (c) 2009-2010 Roy Marples <roy@marples.name>
+ * Copyright (c) 2009-2013 Roy Marples <roy@marples.name>
  * All rights reserved
 
  * Redistribution and use in source and binary forms, with or without
@@ -55,6 +55,7 @@
 #include <unistd.h>
 
 #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. */