summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-11-25 21:53:06 +0000
committerNick Mathewson <nickm@torproject.org>2007-11-25 21:53:06 +0000
commit1120f04f3eaafe98259ef286eecb648337b2214f (patch)
tree3bfb01d3eed147b7b0e4a39504d9b5b61c8cec6f
parentcbf9cfdf4507651ba39489158b17cf11703bb43d (diff)
downloadlibevent-1120f04f3eaafe98259ef286eecb648337b2214f.tar.gz
r16731@catbus: nickm | 2007-11-25 16:52:53 -0500
Replace all fds on non-unix-specific APIs with evutil_socket_t, which is int on unix and intptr_t on win32. svn:r552
-rw-r--r--ChangeLog2
-rw-r--r--buffer.c4
-rw-r--r--evbuffer.c6
-rw-r--r--evdns.c18
-rw-r--r--event.c20
-rw-r--r--event.h23
-rw-r--r--evhttp.h2
-rw-r--r--evrpc.c4
-rw-r--r--evsignal.h6
-rw-r--r--evutil.c10
-rw-r--r--evutil.h38
-rw-r--r--http-internal.h6
-rw-r--r--http.c46
-rw-r--r--signal.c4
14 files changed, 107 insertions, 82 deletions
diff --git a/ChangeLog b/ChangeLog
index ce23c07a..292555c3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -12,6 +12,8 @@ Changes in current version:
o The kqueue implementation now restores original signal handlers correctly when its signal events are removed.
o Check return value of event_add in signal.c
o Add a more powerful evbuffer_readln as a replacement for evbuffer_readline. The new function handles more newline styles, and is more useful with buffers that may contain a nul characters.
+ o Do not mangle socket handles on 64-bit windows.
+
Changes in 1.4.0:
diff --git a/buffer.c b/buffer.c
index 6dacca8f..a6549cc2 100644
--- a/buffer.c
+++ b/buffer.c
@@ -399,7 +399,7 @@ evbuffer_drain(struct evbuffer *buf, size_t len)
#define EVBUFFER_MAX_READ 4096
int
-evbuffer_read(struct evbuffer *buf, int fd, int howmuch)
+evbuffer_read(struct evbuffer *buf, evutil_socket_t fd, int howmuch)
{
u_char *p;
size_t oldoff = buf->off;
@@ -457,7 +457,7 @@ evbuffer_read(struct evbuffer *buf, int fd, int howmuch)
}
int
-evbuffer_write(struct evbuffer *buffer, int fd)
+evbuffer_write(struct evbuffer *buffer, evutil_socket_t fd)
{
int n;
diff --git a/evbuffer.c b/evbuffer.c
index 32c9f921..b46b543f 100644
--- a/evbuffer.c
+++ b/evbuffer.c
@@ -92,7 +92,7 @@ bufferevent_read_pressure_cb(struct evbuffer *buf, size_t old, size_t now,
}
static void
-bufferevent_readcb(int fd, short event, void *arg)
+bufferevent_readcb(evutil_socket_t fd, short event, void *arg)
{
struct bufferevent *bufev = arg;
int res = 0;
@@ -155,7 +155,7 @@ bufferevent_readcb(int fd, short event, void *arg)
}
static void
-bufferevent_writecb(int fd, short event, void *arg)
+bufferevent_writecb(evutil_socket_t fd, short event, void *arg)
{
struct bufferevent *bufev = arg;
int res = 0;
@@ -225,7 +225,7 @@ bufferevent_writecb(int fd, short event, void *arg)
*/
struct bufferevent *
-bufferevent_new(int fd, evbuffercb readcb, evbuffercb writecb,
+bufferevent_new(evutil_socket_t fd, evbuffercb readcb, evbuffercb writecb,
everrorcb errorcb, void *cbarg)
{
struct bufferevent *bufev;
diff --git a/evdns.c b/evdns.c
index 03ccd8ac..3093f4b9 100644
--- a/evdns.c
+++ b/evdns.c
@@ -216,7 +216,7 @@ struct reply {
};
struct nameserver {
- int socket; /* a connected UDP socket */
+ evutil_socket_t socket; /* a connected UDP socket */
u32 address;
int failed_times; /* number of times which we have given this server a chance */
int timedout; /* number of times in a row a request has timed out */
@@ -237,7 +237,7 @@ static struct nameserver *server_head = NULL;
/* Represents a local port where we're listening for DNS requests. Right now, */
/* only UDP is supported. */
struct evdns_server_port {
- int socket; /* socket we use to read queries and write replies. */
+ evutil_socket_t socket; /* socket we use to read queries and write replies. */
int refcnt; /* reference count. */
char choked; /* Are we currently blocked from writing? */
char closing; /* Are we trying to close this port, pending writes? */
@@ -325,7 +325,7 @@ static const int global_nameserver_timeouts_length = sizeof(global_nameserver_ti
static struct nameserver *nameserver_pick(void);
static void evdns_request_insert(struct request *req, struct request **head);
-static void nameserver_ready_callback(int fd, short events, void *arg);
+static void nameserver_ready_callback(evutil_socket_t fd, short events, void *arg);
static int evdns_transmit(void);
static int evdns_request_transmit(struct request *req);
static void nameserver_send_probe(struct nameserver *const ns);
@@ -340,13 +340,13 @@ static void request_submit(struct request *const req);
static int server_request_free(struct server_request *req);
static void server_request_free_answers(struct server_request *req);
static void server_port_free(struct evdns_server_port *port);
-static void server_port_ready_callback(int fd, short events, void *arg);
+static void server_port_ready_callback(evutil_socket_t fd, short events, void *arg);
static int strtoint(const char *const str);
#ifdef WIN32
static int
-last_error(int sock)
+last_error(evutil_socket_t sock)
{
int optval, optvallen=sizeof(optval);
int err = WSAGetLastError();
@@ -458,7 +458,7 @@ request_find_from_trans_id(u16 trans_id) {
/* a libevent callback function which is called when a nameserver */
/* has gone down and we want to test if it has came back to life yet */
static void
-nameserver_prod_callback(int fd, short events, void *arg) {
+nameserver_prod_callback(evutil_socket_t fd, short events, void *arg) {
struct nameserver *const ns = (struct nameserver *) arg;
(void)fd;
(void)events;
@@ -1237,7 +1237,7 @@ nameserver_write_waiting(struct nameserver *ns, char waiting) {
/* a callback function. Called by libevent when the kernel says that */
/* a nameserver socket is ready for writing or reading */
static void
-nameserver_ready_callback(int fd, short events, void *arg) {
+nameserver_ready_callback(evutil_socket_t fd, short events, void *arg) {
struct nameserver *ns = (struct nameserver *) arg;
(void)fd;
@@ -1255,7 +1255,7 @@ nameserver_ready_callback(int fd, short events, void *arg) {
/* a callback function. Called by libevent when the kernel says that */
/* a server socket is ready for writing or reading. */
static void
-server_port_ready_callback(int fd, short events, void *arg) {
+server_port_ready_callback(evutil_socket_t fd, short events, void *arg) {
struct evdns_server_port *port = (struct evdns_server_port *) arg;
(void) fd;
@@ -1852,7 +1852,7 @@ evdns_server_request_get_requesting_addr(struct evdns_server_request *_req, stru
/* this is a libevent callback function which is called when a request */
/* has timed out. */
static void
-evdns_request_timeout_callback(int fd, short events, void *arg) {
+evdns_request_timeout_callback(evutil_socket_t fd, short events, void *arg) {
struct request *const req = (struct request *) arg;
(void) fd;
(void) events;
diff --git a/event.c b/event.c
index 3c4aafc2..13662210 100644
--- a/event.c
+++ b/event.c
@@ -381,7 +381,7 @@ event_base_dispatch(struct event_base *event_base)
}
static void
-event_loopexit_cb(int fd, short what, void *arg)
+event_loopexit_cb(evutil_socket_t fd, short what, void *arg)
{
struct event_base *base = arg;
base->event_gotterm = 1;
@@ -513,14 +513,14 @@ event_base_loop(struct event_base *base, int flags)
struct event_once {
struct event ev;
- void (*cb)(int, short, void *);
+ void (*cb)(evutil_socket_t, short, void *);
void *arg;
};
/* One-time callback, it deletes itself */
static void
-event_once_cb(int fd, short events, void *arg)
+event_once_cb(evutil_socket_t fd, short events, void *arg)
{
struct event_once *eonce = arg;
@@ -530,16 +530,18 @@ event_once_cb(int fd, short events, void *arg)
/* not threadsafe, event scheduled once. */
int
-event_once(int fd, short events,
- void (*callback)(int, short, void *), void *arg, struct timeval *tv)
+event_once(evutil_socket_t fd, short events,
+ void (*callback)(evutil_socket_t, short, void *),
+ void *arg, struct timeval *tv)
{
return event_base_once(current_base, fd, events, callback, arg, tv);
}
/* Schedules an event once */
int
-event_base_once(struct event_base *base, int fd, short events,
- void (*callback)(int, short, void *), void *arg, struct timeval *tv)
+event_base_once(struct event_base *base, evutil_socket_t fd, short events,
+ void (*callback)(evutil_socket_t, short, void *),
+ void *arg, struct timeval *tv)
{
struct event_once *eonce;
struct timeval etv;
@@ -584,8 +586,8 @@ event_base_once(struct event_base *base, int fd, short events,
}
void
-event_set(struct event *ev, int fd, short events,
- void (*callback)(int, short, void *), void *arg)
+event_set(struct event *ev, evutil_socket_t fd, short events,
+ void (*callback)(evutil_socket_t, short, void *), void *arg)
{
/* Take the current base - caller needs to set the real base later */
ev->ev_base = current_base;
diff --git a/event.h b/event.h
index 89cf75ff..4a6f758b 100644
--- a/event.h
+++ b/event.h
@@ -217,7 +217,7 @@ struct event {
struct event_base *ev_base;
- int ev_fd;
+ evutil_socket_t ev_fd;
short ev_events;
short ev_ncalls;
short *ev_pncalls; /* Allows deletes in callback */
@@ -226,7 +226,7 @@ struct event {
int ev_pri; /* smaller numbers are higher priority */
- void (*ev_callback)(int, short, void *arg);
+ void (*ev_callback)(evutil_socket_t, short, void *arg);
void *ev_arg;
int ev_res; /* result passed to event callback */
@@ -528,7 +528,7 @@ int event_base_loopbreak(struct event_base *);
@see event_add(), event_del(), event_once()
*/
-void event_set(struct event *, int, short, void (*)(int, short, void *), void *);
+void event_set(struct event *, evutil_socket_t, short, void (*)(evutil_socket_t, short, void *), void *);
/**
Schedule a one-time event to occur.
@@ -548,7 +548,7 @@ void event_set(struct event *, int, short, void (*)(int, short, void *), void *)
@see event_set()
*/
-int event_once(int, short, void (*)(int, short, void *), void *, struct timeval *);
+int event_once(evutil_socket_t , short, void (*)(evutil_socket_t, short, void *), void *, struct timeval *);
/**
@@ -569,7 +569,7 @@ int event_once(int, short, void (*)(int, short, void *), void *, struct timeval
@return 0 if successful, or -1 if an error occurred
@see event_once()
*/
-int event_base_once(struct event_base *, int, short, void (*)(int, short, void *), void *, struct timeval *);
+int event_base_once(struct event_base *, evutil_socket_t, short, void (*)(evutil_socket_t, short, void *), void *, struct timeval *);
/**
@@ -606,6 +606,13 @@ int event_add(struct event *, struct timeval *);
*/
int event_del(struct event *);
+/**
+ Make an event active.
+
+ @param ev an event to make active.
+ @param res a set of flags to pass to the event's callback.
+ @param ncalls
+ **/
void event_active(struct event *, int, short);
@@ -789,7 +796,7 @@ struct bufferevent {
error occurred
@see bufferevent_base_set(), bufferevent_free()
*/
-struct bufferevent *bufferevent_new(int fd,
+struct bufferevent *bufferevent_new(evutil_socket_t fd,
evbuffercb readcb, evbuffercb writecb, everrorcb errorcb, void *cbarg);
@@ -1042,7 +1049,7 @@ void evbuffer_drain(struct evbuffer *, size_t);
@return the number of bytes written, or -1 if an error occurred
@see evbuffer_read()
*/
-int evbuffer_write(struct evbuffer *, int);
+int evbuffer_write(struct evbuffer *, evutil_socket_t);
/**
@@ -1054,7 +1061,7 @@ int evbuffer_write(struct evbuffer *, int);
@return the number of bytes read, or -1 if an error occurred
@see evbuffer_write()
*/
-int evbuffer_read(struct evbuffer *, int, int);
+int evbuffer_read(struct evbuffer *, evutil_socket_t, int);
/**
diff --git a/evhttp.h b/evhttp.h
index 106ac231..a5bf73ed 100644
--- a/evhttp.h
+++ b/evhttp.h
@@ -80,7 +80,7 @@ struct evhttp *evhttp_new(struct event_base *base);
*
* @param address a string containing the IP address to listen(2) on
* @param port the port number to listen on
- * @return a newly allocated evhttp struct
+ * @return 0 on success, -1 on failure.
* @see evhttp_free()
*/
int evhttp_bind_socket(struct evhttp *http, const char *address, u_short port);
diff --git a/evrpc.c b/evrpc.c
index 7945c745..670f3c0e 100644
--- a/evrpc.c
+++ b/evrpc.c
@@ -479,7 +479,7 @@ evrpc_pool_set_timeout(struct evrpc_pool *pool, int timeout_in_secs)
static void evrpc_reply_done(struct evhttp_request *, void *);
-static void evrpc_request_timeout(int, short, void *);
+static void evrpc_request_timeout(evutil_socket_t, short, void *);
/*
* Finds a connection object associated with the pool that is currently
@@ -643,7 +643,7 @@ evrpc_pool_schedule(struct evrpc_pool *pool)
}
static void
-evrpc_request_timeout(int fd, short what, void *arg)
+evrpc_request_timeout(evutil_socket_t fd, short what, void *arg)
{
struct evrpc_request_wrapper *ctx = arg;
struct evhttp_connection *evcon = ctx->evcon;
diff --git a/evsignal.h b/evsignal.h
index 0d1e8314..65297db4 100644
--- a/evsignal.h
+++ b/evsignal.h
@@ -27,12 +27,16 @@
#ifndef _EVSIGNAL_H_
#define _EVSIGNAL_H_
+#ifndef evutil_socket_t
+#include "evutil.h"
+#endif
+
typedef void (*ev_sighandler_t)(int);
struct evsignal_info {
struct event_list signalqueue;
struct event ev_signal;
- int ev_signal_pair[2];
+ evutil_socket_t ev_signal_pair[2];
int ev_signal_added;
volatile sig_atomic_t evsignal_caught;
sig_atomic_t evsigcaught[NSIG];
diff --git a/evutil.c b/evutil.c
index 47136f08..83d207b6 100644
--- a/evutil.c
+++ b/evutil.c
@@ -52,7 +52,7 @@
#include "log.h"
int
-evutil_socketpair(int family, int type, int protocol, int fd[2])
+evutil_socketpair(int family, int type, int protocol, evutil_socket_t fd[2])
{
#ifndef WIN32
return socketpair(family, type, protocol, fd);
@@ -64,9 +64,9 @@ evutil_socketpair(int family, int type, int protocol, int fd[2])
* for now, and really, when localhost is down sometimes, we
* have other problems too.
*/
- int listener = -1;
- int connector = -1;
- int acceptor = -1;
+ evutil_socket_t listener = -1;
+ evutil_socket_t connector = -1;
+ evutil_socket_t acceptor = -1;
struct sockaddr_in listen_addr;
struct sockaddr_in connect_addr;
int size;
@@ -150,7 +150,7 @@ evutil_socketpair(int family, int type, int protocol, int fd[2])
}
int
-evutil_make_socket_nonblocking(int fd)
+evutil_make_socket_nonblocking(evutil_socket_t fd)
{
#ifdef WIN32
{
diff --git a/evutil.h b/evutil.h
index d156e663..27aa9c06 100644
--- a/evutil.h
+++ b/evutil.h
@@ -43,8 +43,29 @@ extern "C" {
#include <sys/time.h>
#endif
-int evutil_socketpair(int d, int type, int protocol, int sv[2]);
-int evutil_make_socket_nonblocking(int sock);
+#ifdef _EVENT_HAVE_STDINT_H
+#include <stdint.h>
+#define ev_uint64_t uint64_t
+#define ev_uint32_t uint32_t
+#define ev_uint16_t uint16_t
+#define ev_uint8_t uint8_t
+#elif defined(WIN32)
+#define ev_uint64_t __uint64_t
+#define ev_uint32_t unsigned int
+#define ev_uint16_t unsigned short
+#define ev_uint8_t unsigned char
+#endif
+
+#ifdef WIN32
+/** Type to hold the output of "socket()" or "accept()". On Windows, this is
+ * an intptr_t; elsewhere, it is an int. */
+#define evutil_socket_t intptr_t
+#else
+#define evutil_socket_t int
+#endif
+
+int evutil_socketpair(int d, int type, int protocol, evutil_socket_t sv[2]);
+int evutil_make_socket_nonblocking(evutil_socket_t sock);
#ifdef WIN32
#define EVUTIL_CLOSESOCKET(s) closesocket(s)
#else
@@ -109,19 +130,6 @@ int evutil_make_socket_nonblocking(int sock);
#define evutil_timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
#endif
-#ifdef _EVENT_HAVE_STDINT_H
-#include <stdint.h>
-#define ev_uint64_t uint64_t
-#define ev_uint32_t uint32_t
-#define ev_uint16_t uint16_t
-#define ev_uint8_t uint8_t
-#elif defined(WIN32)
-#define ev_uint64_t __uint64_t
-#define ev_uint32_t unsigned int
-#define ev_uint16_t unsigned short
-#define ev_uint8_t unsigned char
-#endif
-
#ifdef __cplusplus
}
#endif
diff --git a/http-internal.h b/http-internal.h
index e9a45f12..f1708655 100644
--- a/http-internal.h
+++ b/http-internal.h
@@ -41,7 +41,7 @@ struct evhttp_connection {
/* we use tailq only if they were created for an http server */
TAILQ_ENTRY(evhttp_connection) (next);
- int fd;
+ evutil_socket_t fd;
struct event ev;
struct event close_ev;
struct evbuffer *input_buffer;
@@ -113,14 +113,14 @@ int evhttp_connection_connect(struct evhttp_connection *);
void evhttp_connection_fail(struct evhttp_connection *,
enum evhttp_connection_error error);
-void evhttp_get_request(struct evhttp *, int, struct sockaddr *, socklen_t);
+void evhttp_get_request(struct evhttp *, evutil_socket_t, struct sockaddr *, socklen_t);
int evhttp_hostportfile(char *, char **, u_short *, char **);
int evhttp_parse_lines(struct evhttp_request *, struct evbuffer*);
void evhttp_start_read(struct evhttp_connection *);
-void evhttp_read_header(int, short, void *);
+void evhttp_read_header(evutil_socket_t, short, void *);
void evhttp_make_header(struct evhttp_connection *, struct evhttp_request *);
void evhttp_write_buffer(struct evhttp_connection *,
diff --git a/http.c b/http.c
index 2017f193..f9219051 100644
--- a/http.c
+++ b/http.c
@@ -151,9 +151,9 @@ fake_freeaddrinfo(struct addrinfo *ai)
extern int debug;
-static int socket_connect(int fd, const char *address, unsigned short port);
-static int bind_socket_ai(struct addrinfo *);
-static int bind_socket(const char *, u_short);
+static int socket_connect(evutil_socket_t kefd, const char *address, unsigned short port);
+static evutil_socket_t bind_socket_ai(struct addrinfo *);
+static evutil_socket_t bind_socket(const char *, u_short);
static void name_from_addr(struct sockaddr *, socklen_t, char **, char **);
static int evhttp_associate_new_request_with_connection(
struct evhttp_connection *evcon);
@@ -163,8 +163,8 @@ static void evhttp_connection_stop_detectclose(
struct evhttp_connection *evcon);
static void evhttp_request_dispatch(struct evhttp_connection* evcon);
-void evhttp_read(int, short, void *);
-void evhttp_write(int, short, void *);
+void evhttp_read(evutil_socket_t, short, void *);
+void evhttp_write(evutil_socket_t, short, void *);
#ifndef HAVE_STRSEP
/* strsep replacement for platforms that lack it. Only works if
@@ -585,7 +585,7 @@ evhttp_connection_fail(struct evhttp_connection *evcon,
}
void
-evhttp_write(int fd, short what, void *arg)
+evhttp_write(evutil_socket_t fd, short what, void *arg)
{
struct evhttp_connection *evcon = arg;
int n;
@@ -771,7 +771,7 @@ evhttp_read_body(struct evhttp_connection *evcon, struct evhttp_request *req)
*/
void
-evhttp_read(int fd, short what, void *arg)
+evhttp_read(evutil_socket_t fd, short what, void *arg)
{
struct evhttp_connection *evcon = arg;
struct evhttp_request *req = TAILQ_FIRST(&evcon->requests);
@@ -916,7 +916,7 @@ evhttp_connection_reset(struct evhttp_connection *evcon)
}
static void
-evhttp_detect_close_cb(int fd, short what, void *arg)
+evhttp_detect_close_cb(evutil_socket_t fd, short what, void *arg)
{
struct evhttp_connection *evcon = arg;
evhttp_connection_reset(evcon);
@@ -943,7 +943,7 @@ evhttp_connection_stop_detectclose(struct evhttp_connection *evcon)
}
static void
-evhttp_connection_retry(int fd, short what, void *arg)
+evhttp_connection_retry(evutil_socket_t fd, short what, void *arg)
{
struct evhttp_connection *evcon = arg;
@@ -956,7 +956,7 @@ evhttp_connection_retry(int fd, short what, void *arg)
*/
static void
-evhttp_connectioncb(int fd, short what, void *arg)
+evhttp_connectioncb(evutil_socket_t fd, short what, void *arg)
{
struct evhttp_connection *evcon = arg;
int error;
@@ -1349,7 +1349,7 @@ evhttp_get_body(struct evhttp_connection *evcon, struct evhttp_request *req)
}
void
-evhttp_read_header(int fd, short what, void *arg)
+evhttp_read_header(evutil_socket_t fd, short what, void *arg)
{
struct evhttp_connection *evcon = arg;
struct evhttp_request *req = TAILQ_FIRST(&evcon->requests);
@@ -1960,12 +1960,12 @@ evhttp_handle_request(struct evhttp_request *req, void *arg)
}
static void
-accept_socket(int fd, short what, void *arg)
+accept_socket(evutil_socket_t fd, short what, void *arg)
{
struct evhttp *http = arg;
struct sockaddr_storage ss;
socklen_t addrlen = sizeof(ss);
- int nfd;
+ evutil_socket_t nfd;
if ((nfd = accept(fd, (struct sockaddr *)&ss, &addrlen)) == -1) {
event_warn("%s: bad accept", __func__);
@@ -1981,7 +1981,7 @@ int
evhttp_bind_socket(struct evhttp *http, const char *address, u_short port)
{
struct event *ev = &http->bind_ev;
- int fd;
+ evutil_socket_t fd;
if ((fd = bind_socket(address, port)) == -1)
return (-1);
@@ -2052,7 +2052,7 @@ evhttp_free(struct evhttp* http)
{
struct evhttp_cb *http_cb;
struct evhttp_connection *evcon;
- int fd = http->bind_ev.ev_fd;
+ evutil_socket_t fd = http->bind_ev.ev_fd;
/* Remove the accepting part */
event_del(&http->bind_ev);
@@ -2223,7 +2223,7 @@ evhttp_request_uri(struct evhttp_request *req) {
static struct evhttp_connection*
evhttp_get_request_connection(
struct evhttp* http,
- int fd, struct sockaddr *sa, socklen_t salen)
+ evutil_socket_t fd, struct sockaddr *sa, socklen_t salen)
{
struct evhttp_connection *evcon;
char *hostname, *portname;
@@ -2272,7 +2272,7 @@ evhttp_associate_new_request_with_connection(struct evhttp_connection *evcon)
}
void
-evhttp_get_request(struct evhttp *http, int fd,
+evhttp_get_request(struct evhttp *http, evutil_socket_t fd,
struct sockaddr *sa, socklen_t salen)
{
struct evhttp_connection *evcon;
@@ -2355,11 +2355,13 @@ name_from_addr(struct sockaddr *sa, socklen_t salen,
/* Either connect or bind */
-static int
+static evutil_socket_t
bind_socket_ai(struct addrinfo *ai)
{
struct linger linger;
- int fd, on = 1, r;
+ evutil_socket_t fd;
+
+ int on = 1, r;
int serrno;
/* Create listen socket */
@@ -2436,10 +2438,10 @@ make_addrinfo(const char *address, u_short port)
return (aitop);
}
-static int
+static evutil_socket_t
bind_socket(const char *address, u_short port)
{
- int fd;
+ evutil_socket_t fd;
struct addrinfo *aitop = make_addrinfo(address, port);
if (aitop == NULL)
@@ -2457,7 +2459,7 @@ bind_socket(const char *address, u_short port)
}
static int
-socket_connect(int fd, const char *address, unsigned short port)
+socket_connect(evutil_socket_t fd, const char *address, unsigned short port)
{
struct addrinfo *ai = make_addrinfo(address, port);
int res = -1;
diff --git a/signal.c b/signal.c
index 90f915e1..a160d1b3 100644
--- a/signal.c
+++ b/signal.c
@@ -59,8 +59,8 @@
#include "event.h"
#include "event-internal.h"
-#include "evsignal.h"
#include "evutil.h"
+#include "evsignal.h"
#include "log.h"
struct event_base *evsignal_base = NULL;
@@ -69,7 +69,7 @@ static void evsignal_handler(int sig);
/* Callback for when the signal handler write a byte to our signaling socket */
static void
-evsignal_cb(int fd, short what, void *arg)
+evsignal_cb(evutil_socket_t fd, short what, void *arg)
{
static char signals[100];
#ifdef WIN32