/* 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
#include <config.h>
+#include <poll.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (poll, int, (struct pollfd[], nfds_t, int));
+
#include <stdio.h>
#include <string.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
-#include <poll.h>
#include <fcntl.h>
#include <stdlib.h>
#include <stdbool.h>
+#include <sys/ioctl.h>
#include <errno.h>
-#include "sockets.h"
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
# define WIN32_NATIVE
#define SO_REUSEPORT SO_REUSEADDR
#endif
-#define TEST_PORT 12345
+#define TEST_PORT 12345
/* Minimal testing infrastructure. */
{
#ifdef WIN32_NATIVE
unsigned long iMode = 1;
- ioctlsocket (s, FIONBIO, (void *) &iMode);
-
+ 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
pfd.fd = fd;
pfd.events = ev;
pfd.revents = 0;
- r = poll (&pfd, 1, time);
+ r = poll (&pfd, 1, time);
if (r < 0)
return r;
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);
{
int result;
- gl_sockets_startup (SOCKETS_2_0);
-
#ifdef INTERACTIVE
printf ("Please press Enter\n");
test (test_tty, "TTY");