X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=tests%2Ftest-poll.c;h=7488090077925152591728677fef2f85f5b3603c;hb=217ec874c8e4610ce407f0204c4e3fe30b7c76ec;hp=b0cdb6087a7ce2d19a3371428d719b04ef3a2183;hpb=77041ebc885b2af4e2d48fd49cf5529759351076;p=gnulib.git diff --git a/tests/test-poll.c b/tests/test-poll.c index b0cdb6087..748809007 100644 --- a/tests/test-poll.c +++ b/tests/test-poll.c @@ -1,5 +1,5 @@ /* Test of poll() function. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008-2010 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,17 +19,21 @@ #include +#include + +#include "signature.h" +SIGNATURE_CHECK (poll, int, (struct pollfd[], nfds_t, int)); + #include #include #include #include #include -#include #include #include #include +#include #include -#include "sockets.h" #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ # define WIN32_NATIVE @@ -50,7 +54,7 @@ #define SO_REUSEPORT SO_REUSEADDR #endif -#define TEST_PORT 12345 +#define TEST_PORT 12345 /* Minimal testing infrastructure. */ @@ -130,10 +134,10 @@ connect_to_socket (int blocking) #ifdef WIN32_NATIVE unsigned long iMode = 1; ioctl (s, FIONBIO, (char *) &iMode); - + #elif defined F_GETFL int oldflags = fcntl (s, F_GETFL, NULL); - + if (!(oldflags & O_NONBLOCK)) fcntl (s, F_SETFL, oldflags | O_NONBLOCK); #endif @@ -161,7 +165,7 @@ poll1 (int fd, int ev, int time) pfd.fd = fd; pfd.events = ev; pfd.revents = 0; - r = poll (&pfd, 1, time); + r = poll (&pfd, 1, time); if (r < 0) return r; @@ -268,7 +272,7 @@ test_accept_first (void) close (s); c = connect_to_socket (true); if (poll1_nowait (c, POLLOUT | POLLWRNORM | POLLRDBAND) - != (POLLOUT | POLLWRNORM)) + != (POLLOUT | POLLWRNORM)) failed ("cannot write after blocking connect"); write (c, "foo", 3); wait (&pid); @@ -359,8 +363,6 @@ main () { int result; - gl_sockets_startup (SOCKETS_1_1); - #ifdef INTERACTIVE printf ("Please press Enter\n"); test (test_tty, "TTY");