This patch was automatically generated with perl.
Based on a patch by Peter Rosin.
#ifndef ARC4RANDOM_NO_INCLUDES
#include "evconfig-private.h"
-#ifdef WIN32
+#ifdef _WIN32
#include <wincrypt.h>
#include <process.h>
#else
unsigned char s[256];
};
-#ifdef WIN32
+#ifdef _WIN32
#define getpid _getpid
#define pid_t int
#endif
rs.j = rs.i;
}
-#ifndef WIN32
+#ifndef _WIN32
static ssize_t
read_all(int fd, unsigned char *buf, size_t count)
{
}
#endif
-#ifdef WIN32
+#ifdef _WIN32
#define TRY_SEED_WIN32
static int
arc4_seed_win32(void)
}
#endif
-#ifndef WIN32
+#ifndef _WIN32
#define TRY_SEED_URANDOM
static int
arc4_seed_urandom(void)
#include "event2/event-config.h"
#include "evconfig-private.h"
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
#include <io.h>
struct evbuffer_chain_file_segment,
chain);
if (info->segment) {
-#ifdef WIN32
+#ifdef _WIN32
if (info->segment->type == EVBUF_FS_MMAP)
UnmapViewOfFile(chain->buffer);
#endif
* Reads data from a file descriptor into a buffer.
*/
-#if defined(_EVENT_HAVE_SYS_UIO_H) || defined(WIN32)
+#if defined(_EVENT_HAVE_SYS_UIO_H) || defined(_WIN32)
#define USE_IOVEC_IMPL
#endif
static int
get_n_bytes_readable_on_socket(evutil_socket_t fd)
{
-#if defined(FIONREAD) && defined(WIN32)
+#if defined(FIONREAD) && defined(_WIN32)
unsigned long lng = EVBUFFER_MAX_READ;
if (ioctlsocket(fd, FIONREAD, &lng) < 0)
return -1;
WSABUF_FROM_EVBUFFER_IOV(&vecs[i], &ev_vecs[i]);
#endif
-#ifdef WIN32
+#ifdef _WIN32
{
DWORD bytesRead;
DWORD flags=0;
/* We can append new data at this point */
p = chain->buffer + chain->misalign + chain->off;
-#ifndef WIN32
+#ifndef _WIN32
n = read(fd, p, howmuch);
#else
n = recv(fd, p, howmuch, 0);
}
chain = chain->next;
}
-#ifdef WIN32
+#ifdef _WIN32
{
DWORD bytesSent;
if (WSASend(fd, iov, i, &bytesSent, 0, NULL, NULL))
#endif
#ifdef USE_IOVEC_IMPL
n = evbuffer_write_iovec(buffer, fd, howmuch);
-#elif defined(WIN32)
+#elif defined(_WIN32)
/* XXX(nickm) Don't disable this code until we know if
* the WSARecv code above works. */
void *p = evbuffer_pullup(buffer, howmuch);
seg->fd = fd;
seg->flags = flags;
-#ifdef WIN32
+#ifdef _WIN32
#define lseek _lseeki64
#define fstat _fstat
#define stat _stat
}
}
#endif
-#ifdef WIN32
+#ifdef _WIN32
if (!(flags & EVBUF_FS_DISABLE_MMAP)) {
long h = (long)_get_osfhandle(fd);
HANDLE m;
if (seg->type == EVBUF_FS_SENDFILE) {
;
} else if (seg->type == EVBUF_FS_MMAP) {
-#ifdef WIN32
+#ifdef _WIN32
CloseHandle(seg->mapping_handle);
#elif defined (_EVENT_HAVE_MMAP)
if (munmap(seg->mapping, seg->length) == -1)
chain->off = length;
chain->buffer_len = chain->misalign + length;
} else if (seg->type == EVBUF_FS_MMAP) {
-#ifdef WIN32
+#ifdef _WIN32
ev_uint64_t total_offset = seg->offset+offset;
ev_uint64_t offset_rounded=0, offset_remaining=0;
LPVOID data;
#define BEV_IS_FILTER(bevp) ((bevp)->be_ops == &bufferevent_ops_filter)
#define BEV_IS_PAIR(bevp) ((bevp)->be_ops == &bufferevent_ops_pair)
-#ifdef WIN32
+#ifdef _WIN32
extern const struct bufferevent_ops bufferevent_ops_async;
#define BEV_IS_ASYNC(bevp) ((bevp)->be_ops == &bufferevent_ops_async)
#else
#include <stdarg.h>
#endif
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#endif
#include <errno.h>
#include <unistd.h>
#endif
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#endif
#include <stdarg.h>
#endif
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#endif
#include <unistd.h>
#endif
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#endif
#include <sys/types.h>
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#endif
#include <unistd.h>
#endif
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#endif
#include "mm-internal.h"
#include "bufferevent-internal.h"
#include "util-internal.h"
-#ifdef WIN32
+#ifdef _WIN32
#include "iocp-internal.h"
#endif
goto done;
} else {
connected = 1;
-#ifdef WIN32
+#ifdef _WIN32
if (BEV_IS_ASYNC(bufev)) {
event_del(&bufev->ev_write);
bufferevent_async_set_connected(bufev);
struct bufferevent_private *bufev_p;
struct bufferevent *bufev;
-#ifdef WIN32
+#ifdef _WIN32
if (base && event_base_get_iocp(base))
return bufferevent_async_new(base, fd, options);
#endif
ownfd = 1;
}
if (sa) {
-#ifdef WIN32
+#ifdef _WIN32
if (bufferevent_async_can_connect(bev)) {
bufferevent_setfd(bev, fd);
r = bufferevent_async_connect(bev, fd, sa, socklen);
if (r < 0)
goto freesock;
}
-#ifdef WIN32
+#ifdef _WIN32
/* ConnectEx() isn't always around, even when IOCP is enabled.
* Here, we borrow the socket object's write handler to fall back
* on a non-blocking connect() when ConnectEx() is unavailable. */
#define SLIST_HEAD_INITIALIZER(head) \
{ NULL }
-#ifndef WIN32
+#ifndef _WIN32
#define SLIST_ENTRY(type) \
struct { \
struct type *sle_next; /* next element */ \
* arguments. */
#define EVBUFFER_CB_NODEFER 2
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#endif
#include <sys/queue.h>
* overflows when we have mutually recursive callbacks, and for
* serializing callbacks in a single thread. */
unsigned deferred_cbs : 1;
-#ifdef WIN32
+#ifdef _WIN32
/** True iff this buffer is set up for overlapped IO. */
unsigned is_overlapped : 1;
#endif
* evbuffer_chain with the EVBUFFER_FILESEGMENT flag set. */
struct evbuffer_chain_file_segment {
struct evbuffer_file_segment *segment;
-#ifdef WIN32
+#ifdef _WIN32
/** If we're using CreateFileMapping, this is the handle to the view. */
HANDLE view_handle;
#endif
int fd;
/** If we're using mmap, this is the raw mapped memory. */
void *mapping;
-#ifdef WIN32
+#ifdef _WIN32
/** If we're using CreateFileMapping, this is the mapping */
HANDLE mapping_handle;
#endif
#include <sys/stat.h>
#include <stdio.h>
#include <stdarg.h>
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#ifndef _WIN32_IE
#include "ipv6-internal.h"
#include "util-internal.h"
#include "evthread-internal.h"
-#ifdef WIN32
+#ifdef _WIN32
#include <ctype.h>
#include <winsock2.h>
#include <windows.h>
static char *
evdns_get_default_hosts_filename(void)
{
-#ifdef WIN32
+#ifdef _WIN32
/* Windows is a little coy about where it puts its configuration
* files. Sure, they're _usually_ in C:\windows\system32, but
* there's no reason in principle they couldn't be in
}
-#ifdef WIN32
+#ifdef _WIN32
/* Add multiple nameservers from a space-or-comma-separated list. */
static int
evdns_nameserver_ip_add_line(struct evdns_base *base, const char *ips) {
if (initialize_nameservers) {
int r;
-#ifdef WIN32
+#ifdef _WIN32
r = evdns_base_config_windows_nameservers(base);
#else
r = evdns_base_resolv_conf_parse(base, DNS_OPTIONS_ALL, "/etc/resolv.conf");
size_t fdinfo_len;
};
-#ifdef WIN32
+#ifdef _WIN32
/* If we're on win32, then file descriptors are not nice low densely packed
integers. Instead, they are pointer-like windows handles, and we want to
use a hashtable instead of an array to map fds to events.
int current_event_waiters;
#endif
-#ifdef WIN32
+#ifdef _WIN32
/** IOCP support structure, if IOCP is enabled. */
struct event_iocp_port *iocp;
#endif
#include "event2/event-config.h"
#include "evconfig-private.h"
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#undef WIN32_LEAN_AND_MEAN
#endif
#include <sys/types.h>
-#if !defined(WIN32) && defined(_EVENT_HAVE_SYS_TIME_H)
+#if !defined(_WIN32) && defined(_EVENT_HAVE_SYS_TIME_H)
#include <sys/time.h>
#endif
#include <sys/queue.h>
#ifdef _EVENT_HAVE_DEVPOLL
extern const struct eventop devpollops;
#endif
-#ifdef WIN32
+#ifdef _WIN32
extern const struct eventop win32ops;
#endif
#ifdef _EVENT_HAVE_SELECT
&selectops,
#endif
-#ifdef WIN32
+#ifdef _WIN32
&win32ops,
#endif
NULL
}
#endif
-#ifdef WIN32
+#ifdef _WIN32
if (cfg && (cfg->flags & EVENT_BASE_FLAG_STARTUP_IOCP))
event_base_start_iocp(base, cfg->n_cpus_hint);
#endif
int
event_base_start_iocp(struct event_base *base, int n_cpus)
{
-#ifdef WIN32
+#ifdef _WIN32
if (base->iocp)
return 0;
base->iocp = event_iocp_port_launch(n_cpus);
void
event_base_stop_iocp(struct event_base *base)
{
-#ifdef WIN32
+#ifdef _WIN32
int rv;
if (!base->iocp)
/* XXX(niels) - check for internal events first */
EVUTIL_ASSERT(base);
-#ifdef WIN32
+#ifdef _WIN32
event_base_stop_iocp(base);
#endif
char buf[1];
int r;
buf[0] = (char) 0;
-#ifdef WIN32
+#ifdef _WIN32
r = send(base->th_notify_fd[1], buf, 1, 0);
#else
r = write(base->th_notify_fd[1], buf, 1);
memcpy(p, str, ln+1);
return p;
} else
-#ifdef WIN32
+#ifdef _WIN32
return _strdup(str);
#else
return strdup(str);
{
unsigned char buf[1024];
struct event_base *base = arg;
-#ifdef WIN32
+#ifdef _WIN32
while (recv(fd, (char*)buf, sizeof(buf), 0) > 0)
;
#else
}
#endif
-#ifdef WIN32
+#ifdef _WIN32
#define LOCAL_SOCKETPAIR_AF AF_INET
#else
#define LOCAL_SOCKETPAIR_AF AF_UNIX
/* For int types. */
#include <evutil.h>
-#ifdef WIN32
+#ifdef _WIN32
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
struct event_iocp_port *
event_base_get_iocp(struct event_base *base)
{
-#ifdef WIN32
+#ifdef _WIN32
return base->iocp;
#else
return NULL;
#include <sys/param.h>
#endif
-#ifdef WIN32
+#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <winsock2.h>
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#ifndef WIN32
+#ifndef _WIN32
#include <syslog.h>
#endif
#ifdef _EVENT_HAVE_UNISTD_H
#include "event2/event-config.h"
#include "evconfig-private.h"
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#undef WIN32_LEAN_AND_MEAN
#endif
#include <sys/types.h>
-#if !defined(WIN32) && defined(_EVENT_HAVE_SYS_TIME_H)
+#if !defined(_WIN32) && defined(_EVENT_HAVE_SYS_TIME_H)
#include <sys/time.h>
#endif
#include <sys/queue.h>
#include <stdio.h>
#include <stdlib.h>
-#ifndef WIN32
+#ifndef _WIN32
#include <unistd.h>
#endif
#include <errno.h>
#include "event2/event-config.h"
#include "evconfig-private.h"
-#ifdef WIN32
+#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <winsock2.h>
#include <windows.h>
#endif
#include <sys/types.h>
-#ifndef WIN32
+#ifndef _WIN32
#include <sys/socket.h>
#endif
#ifdef _EVENT_HAVE_SYS_TIME_H
#include <sys/queue.h>
#include <stdio.h>
#include <stdlib.h>
-#ifndef WIN32
+#ifndef _WIN32
#include <unistd.h>
#endif
#include <errno.h>
struct event_base;
-#ifndef WIN32
+#ifndef _WIN32
/* On Windows, the way we currently make DLLs, it's not allowed for us to
* have shared global structures. Thus, we only do the direct-call-to-function
* code path if we know that the local shared library system supports it.
#include "event2/event-config.h"
#include "evconfig-private.h"
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include "event2/event-config.h"
#include "evconfig-private.h"
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#define WIN32_LEAN_AND_MEAN
#include "strlcpy-internal.h"
#include "ipv6-internal.h"
-#ifdef WIN32
+#ifdef _WIN32
#define open _open
#define read _read
#define close _close
return -2;
}
read_so_far = 0;
-#ifdef WIN32
+#ifdef _WIN32
#define N_TO_READ(x) ((x) > INT_MAX) ? INT_MAX : ((int)(x))
#else
#define N_TO_READ(x) (x)
int
evutil_socketpair(int family, int type, int protocol, evutil_socket_t fd[2])
{
-#ifndef WIN32
+#ifndef _WIN32
return socketpair(family, type, protocol, fd);
#else
return evutil_ersatz_socketpair(family, type, protocol, fd);
* for now, and really, when localhost is down sometimes, we
* have other problems too.
*/
-#ifdef WIN32
+#ifdef _WIN32
#define ERR(e) WSA##e
#else
#define ERR(e) e
int
evutil_make_socket_nonblocking(evutil_socket_t fd)
{
-#ifdef WIN32
+#ifdef _WIN32
{
u_long nonblocking = 1;
if (ioctlsocket(fd, FIONBIO, &nonblocking) == SOCKET_ERROR) {
int
evutil_make_listen_socket_reuseable(evutil_socket_t sock)
{
-#ifndef WIN32
+#ifndef _WIN32
int one = 1;
/* REUSEADDR on Unix means, "don't hang on to this address after the
* listener is closed." On Windows, though, it means "don't keep other
int
evutil_make_socket_closeonexec(evutil_socket_t fd)
{
-#if !defined(WIN32) && defined(_EVENT_HAVE_SETFD)
+#if !defined(_WIN32) && defined(_EVENT_HAVE_SETFD)
int flags;
if ((flags = fcntl(fd, F_GETFD, NULL)) < 0) {
event_warn("fcntl(%d, F_GETFD)", fd);
int
evutil_closesocket(evutil_socket_t sock)
{
-#ifndef WIN32
+#ifndef _WIN32
return close(sock);
#else
return closesocket(sock);
return (ev_int64_t)strtoll(s, endptr, base);
#elif _EVENT_SIZEOF_LONG == 8
return (ev_int64_t)strtol(s, endptr, base);
-#elif defined(WIN32) && defined(_MSC_VER) && _MSC_VER < 1300
+#elif defined(_WIN32) && defined(_MSC_VER) && _MSC_VER < 1300
/* XXXX on old versions of MS APIs, we only support base
* 10. */
ev_int64_t r;
if (endptr)
*endptr = (char*) s;
return r;
-#elif defined(WIN32)
+#elif defined(_WIN32)
return (ev_int64_t) _strtoi64(s, endptr, base);
#elif defined(_EVENT_SIZEOF_LONG_LONG) && _EVENT_SIZEOF_LONG_LONG == 8
long long r;
}
#endif
-#ifdef WIN32
+#ifdef _WIN32
int
evutil_socket_geterror(evutil_socket_t sock)
{
int n = parse_numeric_servname(servname);
if (n>=0)
return n;
-#if defined(_EVENT_HAVE_GETSERVBYNAME) || defined(WIN32)
+#if defined(_EVENT_HAVE_GETSERVBYNAME) || defined(_WIN32)
if (!(hints->ai_flags & EVUTIL_AI_NUMERICSERV)) {
struct servent *ent = getservbyname(servname, protocol);
if (ent) {
* ever resolving even a literal IPv6 address when
* ai_addrtype is PF_UNSPEC.
*/
-#ifdef WIN32
+#ifdef _WIN32
{
int tmp_port;
err = evutil_getaddrinfo_common(nodename,servname,&hints,
/* fall back to gethostbyname. */
/* XXXX This needs a lock everywhere but Windows. */
ent = gethostbyname(nodename);
-#ifdef WIN32
+#ifdef _WIN32
err = WSAGetLastError();
#else
err = h_errno;
case EVUTIL_EAI_SYSTEM:
return "system error";
default:
-#if defined(USE_NATIVE_GETADDRINFO) && defined(WIN32)
+#if defined(USE_NATIVE_GETADDRINFO) && defined(_WIN32)
return gai_strerrorA(err);
#elif defined(USE_NATIVE_GETADDRINFO)
return gai_strerror(err);
}
}
-#ifdef WIN32
+#ifdef _WIN32
#define E(code, s) { code, (s " [" #code " ]") }
static struct { int code; const char *msg; } windows_socket_errors[] = {
E(WSAEINTR, "Interrupted function call"),
long
_evutil_weakrand(void)
{
-#ifdef WIN32
+#ifdef _WIN32
return rand();
#else
return random();
return -1;
}
-#ifdef WIN32
+#ifdef _WIN32
HANDLE
evutil_load_windows_system_library(const TCHAR *library_name)
{
#include <sys/ioccom.h>
#endif
-#ifndef WIN32
+#ifndef _WIN32
#include <sys/resource.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <netdb.h>
#endif
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#ifndef WIN32
+#ifndef _WIN32
#include <syslog.h>
#endif
#include <signal.h>
{
if (evhttp_find_header(headers, "Date") == NULL) {
char date[50];
-#ifndef WIN32
+#ifndef _WIN32
struct tm cur;
#endif
struct tm *cur_p;
time_t t = time(NULL);
-#ifdef WIN32
+#ifdef _WIN32
cur_p = gmtime(&t);
#else
gmtime_r(&t, &cur);
* when connecting to a local address. the cleanup is going
* to reschedule this function call.
*/
-#ifndef WIN32
+#ifndef _WIN32
if (errno == ECONNREFUSED)
goto cleanup;
#endif
@return 0 if successful, or -1 if an error occurred
@see evdns_resolv_conf_parse()
*/
-#ifdef WIN32
+#ifdef _WIN32
int evdns_base_config_windows_nameservers(struct evdns_base *);
#define EVDNS_BASE_CONFIG_WINDOWS_NAMESERVERS_IMPLEMENTED
#endif
*/
struct evdns_server_port *evdns_add_server_port(evutil_socket_t socket, int flags, evdns_request_callback_fn_type callback, void *user_data);
-#ifdef WIN32
+#ifdef _WIN32
int evdns_config_windows_nameservers(void);
#define EVDNS_CONFIG_WINDOWS_NAMESERVERS_IMPLEMENTED
#endif
EVRPC_OUTPUT /**< apply the function to an output hook */
};
-#ifndef WIN32
+#ifndef _WIN32
/** Deprecated alias for EVRPC_INPUT. Not available on windows, where it
* conflicts with platform headers. */
#define INPUT EVRPC_INPUT
void evthread_set_id_callback(
unsigned long (*id_fn)(void));
-#if defined(WIN32) && !defined(_EVENT_DISABLE_THREAD_SUPPORT)
+#if defined(_WIN32) && !defined(_EVENT_DISABLE_THREAD_SUPPORT)
/** Sets up Libevent for use with Windows builtin locking and thread ID
functions. Unavailable if Libevent is not built for Windows.
#include <netdb.h>
#endif
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#else
#include <sys/socket.h>
#ifdef _EVENT_HAVE_UINT64_T
#define ev_uint64_t uint64_t
#define ev_int64_t int64_t
-#elif defined(WIN32)
+#elif defined(_WIN32)
#define ev_uint64_t unsigned __int64
#define ev_int64_t signed __int64
#elif _EVENT_SIZEOF_LONG_LONG == 8
#ifdef _EVENT_HAVE_UINT32_T
#define ev_uint32_t uint32_t
#define ev_int32_t int32_t
-#elif defined(WIN32)
+#elif defined(_WIN32)
#define ev_uint32_t unsigned int
#define ev_int32_t signed int
#elif _EVENT_SIZEOF_LONG == 4
#ifdef _EVENT_HAVE_UINT16_T
#define ev_uint16_t uint16_t
#define ev_int16_t int16_t
-#elif defined(WIN32)
+#elif defined(_WIN32)
#define ev_uint16_t unsigned short
#define ev_int16_t signed short
#elif _EVENT_SIZEOF_INT == 2
#define ev_ssize_t ssize_t
#endif
-#ifdef WIN32
+#ifdef _WIN32
#define ev_off_t ev_int64_t
#else
#define ev_off_t off_t
#define EV_SSIZE_MIN ((-EV_SSIZE_MAX) - 1)
-#ifdef WIN32
+#ifdef _WIN32
#define ev_socklen_t int
#elif defined(_EVENT_socklen_t)
#define ev_socklen_t _EVENT_socklen_t
#endif
#endif
-#ifdef WIN32
+#ifdef _WIN32
/** A type wide enough 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
* function, and don't let you use strerror for the error codes. And handling
* EWOULDBLOCK is ... different. */
-#ifdef WIN32
+#ifdef _WIN32
/** Return the most recent socket error. Not idempotent on all platforms. */
#define EVUTIL_SOCKET_ERROR() WSAGetLastError()
/** Replace the most recent socket error with errcode */
/* This whole file is actually win32 only. We wrap the structures in a win32
* ifdef so that we can test-compile code that uses these interfaces on
* non-win32 platforms. */
-#ifdef WIN32
+#ifdef _WIN32
/**
Internal use only. Wraps an OVERLAPPED that we're using for libevent
#include <sys/types.h>
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#include <mswsock.h>
#include "util-internal.h"
#include "log-internal.h"
#include "evthread-internal.h"
-#ifdef WIN32
+#ifdef _WIN32
#include "iocp-internal.h"
#include "defer-internal.h"
#include "event-internal.h"
struct event listener;
};
-#ifdef WIN32
+#ifdef _WIN32
struct evconnlistener_iocp {
struct evconnlistener base;
evutil_socket_t fd;
{
struct evconnlistener_event *lev;
-#ifdef WIN32
+#ifdef _WIN32
if (base && event_base_get_iocp(base)) {
const struct win32_extension_fns *ext =
event_get_win32_extension_fns();
LOCK(lev);
while (1) {
struct sockaddr_storage ss;
-#ifdef WIN32
+#ifdef _WIN32
int socklen = sizeof(ss);
#else
socklen_t socklen = sizeof(ss);
}
}
-#ifdef WIN32
+#ifdef _WIN32
struct accepting_socket {
CRITICAL_SECTION lock;
struct event_overlapped overlapped;
#include "event2/event-config.h"
#include "evconfig-private.h"
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <sys/types.h>
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#else
evdns_add_server_port_with_base(event_base, sock, 0, evdns_server_callback, NULL);
}
if (idx < c) {
-#ifdef WIN32
+#ifdef _WIN32
evdns_base_config_windows_nameservers(evdns_base);
#else
evdns_base_resolv_conf_parse(evdns_base, DNS_OPTION_NAMESERVERS,
#include <sys/types.h>
#include <sys/stat.h>
-#ifndef WIN32
+#ifndef _WIN32
#include <sys/queue.h>
#include <unistd.h>
#include <sys/time.h>
char buf[255];
int len;
struct event *ev = arg;
-#ifdef WIN32
+#ifdef _WIN32
DWORD dwBytesRead;
#endif
fprintf(stderr, "fifo_read called with fd: %d, event: %d, arg: %p\n",
fd, event, arg);
-#ifdef WIN32
+#ifdef _WIN32
len = ReadFile((HANDLE)fd, buf, sizeof(buf) - 1, &dwBytesRead, NULL);
/* Check for end of file. */
main(int argc, char **argv)
{
struct event evfifo;
-#ifdef WIN32
+#ifdef _WIN32
HANDLE socket;
/* Open a file. */
socket = CreateFileA("test.txt", /* open File */
event_init();
/* Initalize one event */
-#ifdef WIN32
+#ifdef _WIN32
event_set(&evfifo, (int)socket, EV_READ, fifo_read, &evfifo);
#else
event_set(&evfifo, socket, EV_READ, fifo_read, &evfifo);
event_add(&evfifo, NULL);
event_dispatch();
-#ifdef WIN32
+#ifdef _WIN32
CloseHandle(socket);
#endif
return (0);
#include <errno.h>
#include <stdio.h>
#include <signal.h>
-#ifndef WIN32
+#ifndef _WIN32
#include <netinet/in.h>
# ifdef _XOPEN_SOURCE_EXTENDED
# include <arpa/inet.h>
struct event *signal_event;
struct sockaddr_in sin;
-#ifdef WIN32
+#ifdef _WIN32
WSADATA wsa_data;
WSAStartup(0x0201, &wsa_data);
#endif
#include <sys/types.h>
#include <sys/stat.h>
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#include <windows.h>
/* Compatibility for possible missing IPv6 declarations */
#include "../util-internal.h"
-#ifdef WIN32
+#ifdef _WIN32
#define stat _stat
#define fstat _fstat
#define open _open
if (S_ISDIR(st.st_mode)) {
/* If it's a directory, read the comments and make a little
* index page */
-#ifdef WIN32
+#ifdef _WIN32
HANDLE d;
WIN32_FIND_DATAA ent;
char *pattern;
if (!strlen(path) || path[strlen(path)-1] != '/')
trailing_slash = "/";
-#ifdef WIN32
+#ifdef _WIN32
dirlen = strlen(whole_path);
pattern = malloc(dirlen+3);
memcpy(pattern, whole_path, dirlen);
uri_root, path, /* XXX html-escape this? */
trailing_slash,
decoded_path /* XXX html-escape this */);
-#ifdef WIN32
+#ifdef _WIN32
do {
const char *name = ent.cFileName;
#else
evbuffer_add_printf(evb,
" <li><a href=\"%s\">%s</a>\n",
name, name);/* XXX escape this */
-#ifdef WIN32
+#ifdef _WIN32
} while (FindNextFileA(d, &ent));
#else
}
#endif
evbuffer_add_printf(evb, "</ul></body></html>\n");
-#ifdef WIN32
+#ifdef _WIN32
CloseHandle(d);
#else
closedir(d);
struct evhttp_bound_socket *handle;
unsigned short port = 0;
-#ifdef WIN32
+#ifdef _WIN32
WSADATA WSAData;
WSAStartup(0x101, &WSAData);
#else
#include <string.h>
#include <errno.h>
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#else
#include <event2/event-config.h>
#include <sys/stat.h>
-#ifndef WIN32
+#ifndef _WIN32
#include <sys/queue.h>
#include <unistd.h>
#include <sys/time.h>
{
struct event signal_int;
struct event_base* base;
-#ifdef WIN32
+#ifdef _WIN32
WORD wVersionRequested;
WSADATA wsaData;
int err;
#include <event2/event-config.h>
#include <sys/stat.h>
-#ifndef WIN32
+#ifndef _WIN32
#include <sys/queue.h>
#include <unistd.h>
#endif
#include <event2/event_struct.h>
#include <event2/util.h>
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#endif
struct event_base *base;
int flags;
-#ifdef WIN32
+#ifdef _WIN32
WORD wVersionRequested;
WSADATA wsaData;
int err;
#include "event2/event-config.h"
#include "evconfig-private.h"
-#ifdef WIN32
+#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <winsock2.h>
#include <windows.h>
on Linux do a reasonable thing using signalfd.
*/
-#ifndef WIN32
+#ifndef _WIN32
/* Windows wants us to call our signal handlers as __cdecl. Nobody else
* expects you to do anything crazy like this. */
#define __cdecl
*/
if (evutil_socketpair(
AF_UNIX, SOCK_STREAM, 0, base->sig.ev_signal_pair) == -1) {
-#ifdef WIN32
+#ifdef _WIN32
/* Make this nonfatal on win32, where sometimes people
have localhost firewalled. */
event_sock_warn(-1, "%s: socketpair", __func__);
evsig_handler(int sig)
{
int save_errno = errno;
-#ifdef WIN32
+#ifdef _WIN32
int socket_errno = EVUTIL_SOCKET_ERROR();
#endif
ev_uint8_t msg;
msg = sig;
send(evsig_base_fd, (char*)&msg, 1, 0);
errno = save_errno;
-#ifdef WIN32
+#ifdef _WIN32
EVUTIL_SET_SOCKET_ERROR(socket_errno);
#endif
}
#ifdef _EVENT_HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
-#ifdef WIN32
+#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#else
int
main(int argc, char **argv)
{
-#ifndef WIN32
+#ifndef _WIN32
struct rlimit rl;
#endif
int i, c;
struct timeval *tv;
int *cp;
-#ifdef WIN32
+#ifdef _WIN32
WSADATA WSAData;
WSAStartup(0x101, &WSAData);
#endif
}
}
-#ifndef WIN32
+#ifndef _WIN32
rl.rlim_cur = rl.rlim_max = num_pipes * 2 + 50;
if (setrlimit(RLIMIT_NOFILE, &rl) == -1) {
perror("setrlimit");
#ifdef _EVENT_HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
-#ifdef WIN32
+#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#else
int
main(int argc, char **argv)
{
-#ifndef WIN32
+#ifndef _WIN32
struct rlimit rl;
#endif
int i, c;
}
}
-#ifndef WIN32
+#ifndef _WIN32
rl.rlim_cur = rl.rlim_max = num_pipes * 2 + 50;
if (setrlimit(RLIMIT_NOFILE, &rl) == -1) {
perror("setrlimit");
#include <sys/types.h>
#include <sys/stat.h>
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#else
#include <sys/socket.h>
int use_iocp = 0;
unsigned short port = 8080;
-#ifdef WIN32
+#ifdef _WIN32
WSADATA WSAData;
WSAStartup(0x101, &WSAData);
#else
exit(1);
}
break;
-#ifdef WIN32
+#ifdef _WIN32
case 'i':
use_iocp = 1;
evthread_use_windows_threads();
*/
#include <sys/types.h>
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#else
#include <sys/socket.h>
throughput = total_n_handled /
(total.tv_sec+ ((double)total.tv_usec)/1000000.0);
-#ifdef WIN32
+#ifdef _WIN32
#define I64_FMT "%I64d"
#define I64_TYP __int64
#else
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
#endif
#include <sys/time.h>
#endif
#include <sys/queue.h>
-#ifndef WIN32
+#ifndef _WIN32
#include <sys/socket.h>
#include <sys/wait.h>
#include <signal.h>
#include "regress.h"
-#ifndef WIN32
+#ifndef _WIN32
#include "regress.gen.h"
#endif
#define SHUT_WR 1
#endif
-#ifdef WIN32
+#ifdef _WIN32
#define write(fd,buf,len) send((fd),(buf),(int)(len),0)
#define read(fd,buf,len) recv((fd),(buf),(int)(len),0)
#endif
short got_read_on_close = 0, got_write_on_close = 0;
char buf[1024];
memset(buf, 99, sizeof(buf));
-#ifdef WIN32
+#ifdef _WIN32
#define LOCAL_SOCKETPAIR_AF AF_INET
#else
#define LOCAL_SOCKETPAIR_AF AF_UNIX
data->base = NULL;
}
-#ifndef WIN32
+#ifndef _WIN32
static void signal_cb(evutil_socket_t fd, short event, void *arg);
#define current_base event_global_current_base_
}
}
-#ifndef WIN32
+#ifndef _WIN32
/* You can't do this test on windows, since dup2 doesn't work on sockets */
static void
{ "event_once", test_event_once, TT_ISOLATED, &basic_setup, NULL },
{ "event_pending", test_event_pending, TT_ISOLATED, &basic_setup,
NULL },
-#ifndef WIN32
+#ifndef _WIN32
{ "dup_fd", test_dup_fd, TT_ISOLATED, &basic_setup, NULL },
#endif
{ "mm_functions", test_mm_functions, TT_FORK, NULL, NULL },
{ "struct_event_size", test_struct_event_size, 0, NULL, NULL },
-#ifndef WIN32
+#ifndef _WIN32
LEGACY(fork, TT_ISOLATED),
#endif
END_OF_TESTCASES
};
struct testcase_t signal_testcases[] = {
-#ifndef WIN32
+#ifndef _WIN32
LEGACY(simplesignal, TT_ISOLATED),
LEGACY(multiplesignal, TT_ISOLATED),
LEGACY(immediatesignal, TT_ISOLATED),
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
#endif
#include <sys/time.h>
#endif
#include <sys/queue.h>
-#ifndef WIN32
+#ifndef _WIN32
#include <sys/socket.h>
#include <sys/wait.h>
#include <signal.h>
/* The old tests here need assertions to work. */
#undef NDEBUG
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
#endif
#include <sys/time.h>
#endif
#include <sys/queue.h>
-#ifndef WIN32
+#ifndef _WIN32
#include <sys/socket.h>
#include <sys/wait.h>
#include <signal.h>
#include "event2/util.h"
#include "bufferevent-internal.h"
-#ifdef WIN32
+#ifdef _WIN32
#include "iocp-internal.h"
#endif
be_flags |= BEV_OPT_THREADSAFE;
}
bufferevent_connect_test_flags = be_flags;
-#ifdef WIN32
+#ifdef _WIN32
if (!strcmp((char*)data->setup_data, "unset_connectex")) {
struct win32_extension_fns *ext =
(struct win32_extension_fns *)
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
#include <ws2tcpip.h>
#include <sys/time.h>
#endif
#include <sys/queue.h>
-#ifndef WIN32
+#ifndef _WIN32
#include <sys/socket.h>
#include <signal.h>
#include <netinet/in.h>
#include "event2/event-config.h"
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#endif
#include <sys/types.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#ifndef WIN32
+#ifndef _WIN32
#include <sys/time.h>
#include <unistd.h>
#endif
#define SHUT_WR 1
#endif
-#ifdef WIN32
+#ifdef _WIN32
#define LOCAL_SOCKETPAIR_AF AF_INET
#else
#define LOCAL_SOCKETPAIR_AF AF_UNIX
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#include <windows.h>
#include <sys/time.h>
#endif
#include <sys/queue.h>
-#ifndef WIN32
+#ifndef _WIN32
#include <sys/socket.h>
#include <signal.h>
#include <unistd.h>
evutil_make_socket_nonblocking(fd);
if (connect(fd, sa, slen) == -1) {
-#ifdef WIN32
+#ifdef _WIN32
int tmp_err = WSAGetLastError();
if (tmp_err != WSAEINPROGRESS && tmp_err != WSAEINVAL &&
tmp_err != WSAEWOULDBLOCK)
}
#ifndef SHUT_WR
-#ifdef WIN32
+#ifdef _WIN32
#define SHUT_WR SD_SEND
#else
#define SHUT_WR 1
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
#endif
#include <sys/types.h>
-#ifndef WIN32
+#ifndef _WIN32
#include <sys/socket.h>
#include <netinet/in.h>
# ifdef _XOPEN_SOURCE_EXTENDED
evutil_socket_connect(&fd2, (struct sockaddr*)&ss1, slen1);
evutil_socket_connect(&fd3, (struct sockaddr*)&ss2, slen2);
-#ifdef WIN32
+#ifdef _WIN32
Sleep(100); /* XXXX this is a stupid stopgap. */
#endif
event_base_dispatch(base);
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
#include <io.h>
#include <sys/types.h>
-#ifndef WIN32
+#ifndef _WIN32
#include <sys/socket.h>
#include <sys/wait.h>
#include <signal.h>
int
regress_make_tmpfile(const void *data, size_t datalen, char **filename_out)
{
-#ifndef WIN32
+#ifndef _WIN32
char tmpfilename[32];
int fd;
*filename_out = NULL;
evutil_socket_t spair[2] = { -1, -1 };
struct basic_test_data *data = NULL;
-#ifndef WIN32
+#ifndef _WIN32
if (testcase->flags & TT_ENABLE_IOCP_FLAG)
return (void*)TT_SKIP;
#endif
/* ============================================================ */
-#if (!defined(_EVENT_HAVE_PTHREADS) && !defined(WIN32)) || defined(_EVENT_DISABLE_THREAD_SUPPORT)
+#if (!defined(_EVENT_HAVE_PTHREADS) && !defined(_WIN32)) || defined(_EVENT_DISABLE_THREAD_SUPPORT)
struct testcase_t thread_testcases[] = {
{ "basic", NULL, TT_SKIP, NULL, NULL },
END_OF_TESTCASES
{ "rpc/", rpc_testcases },
{ "thread/", thread_testcases },
{ "listener/", listener_testcases },
-#ifdef WIN32
+#ifdef _WIN32
{ "iocp/", iocp_testcases },
{ "iocp/bufferevent/", bufferevent_iocp_testcases },
{ "iocp/listener/", listener_iocp_testcases },
int
main(int argc, const char **argv)
{
-#ifdef WIN32
+#ifdef _WIN32
WORD wVersionRequested;
WSADATA wsaData;
int err;
err = WSAStartup(wVersionRequested, &wsaData);
#endif
-#ifndef WIN32
+#ifndef _WIN32
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR)
return 1;
#endif
-#ifdef WIN32
+#ifdef _WIN32
tinytest_skip(testgroups, "http/connection_retry");
#endif
/* The old tests here need assertions to work. */
#undef NDEBUG
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
#endif
#include <sys/time.h>
#endif
#include <sys/queue.h>
-#ifndef WIN32
+#ifndef _WIN32
#include <sys/socket.h>
#include <signal.h>
#include <unistd.h>
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
#endif
-#ifndef WIN32
+#ifndef _WIN32
#include <sys/socket.h>
#include <netinet/in.h>
#endif
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
#include <ws2tcpip.h>
#include <sys/time.h>
#endif
#include <sys/queue.h>
-#ifndef WIN32
+#ifndef _WIN32
#include <sys/socket.h>
#include <signal.h>
#include <netinet/in.h>
#ifdef _EVENT_HAVE_PTHREADS
#include <pthread.h>
-#elif defined(WIN32)
+#elif defined(_WIN32)
#include <process.h>
#endif
#include <assert.h>
}
static int notification_fd_used = 0;
-#ifndef WIN32
+#ifndef _WIN32
static int got_sigchld = 0;
static void
sigchld_cb(evutil_socket_t fd, short event, void *arg)
tt_abort_msg("Couldn't make base notifiable!");
}
-#ifndef WIN32
+#ifndef _WIN32
if (data->setup_data && !strcmp(data->setup_data, "forking")) {
pid_t pid;
int status;
#define CB_COUNT 128
#define QUEUE_THREAD_COUNT 8
-#ifdef WIN32
+#ifdef _WIN32
#define SLEEP_MS(ms) Sleep(ms)
#else
#define SLEEP_MS(ms) usleep((ms) * 1000)
struct testcase_t thread_testcases[] = {
{ "basic", thread_basic, TT_FORK|TT_NEED_THREADS|TT_NEED_BASE,
&basic_setup, NULL },
-#ifndef WIN32
+#ifndef _WIN32
{ "forking", thread_basic, TT_FORK|TT_NEED_THREADS|TT_NEED_BASE,
&basic_setup, (char*)"forking" },
#endif
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
#include <ws2tcpip.h>
#include <sys/types.h>
-#ifndef WIN32
+#ifndef _WIN32
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
exit(exitcode);
}
-#ifndef WIN32
+#ifndef _WIN32
#define CAN_CHECK_ERR
static void
check_error_logging(void (*fn)(void), int wantexitcode,
sock_err_fn(void)
{
evutil_socket_t fd = socket(AF_INET, SOCK_STREAM, 0);
-#ifdef WIN32
+#ifdef _WIN32
EVUTIL_SET_SOCKET_ERROR(WSAEWOULDBLOCK);
#else
errno = EAGAIN;
/* Try with a socket errno. */
fd = socket(AF_INET, SOCK_STREAM, 0);
-#ifdef WIN32
+#ifdef _WIN32
evutil_snprintf(buf, sizeof(buf),
"Unhappy socket: %s",
evutil_socket_error_to_string(WSAEWOULDBLOCK));
evutil_freeaddrinfo(ai);
}
-#ifdef WIN32
+#ifdef _WIN32
static void
test_evutil_loadsyslib(void *arg)
{
{ "integers", test_evutil_integers, 0, NULL, NULL },
{ "rand", test_evutil_rand, TT_FORK, NULL, NULL },
{ "getaddrinfo", test_evutil_getaddrinfo, TT_FORK, NULL, NULL },
-#ifdef WIN32
+#ifdef _WIN32
{ "loadsyslib", test_evutil_loadsyslib, TT_FORK, NULL, NULL },
#endif
END_OF_TESTCASES,
/* The old tests here need assertions to work. */
#undef NDEBUG
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
#endif
#include "event2/event-config.h"
#include <sys/types.h>
-#ifndef WIN32
+#ifndef _WIN32
#include <sys/socket.h>
#include <sys/wait.h>
#include <unistd.h>
#include "event2/event-config.h"
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
#else
#include <time.h>
struct cpu_usage_timer {
-#ifdef WIN32
+#ifdef _WIN32
HANDLE thread;
FILETIME usertimeBegin;
FILETIME kerneltimeBegin;
static void
start_cpu_usage_timer(struct cpu_usage_timer *timer)
{
-#ifdef WIN32
+#ifdef _WIN32
int r;
FILETIME createtime, exittime;
timer->thread = GetCurrentThread();
evutil_gettimeofday(&timer->timeBegin, NULL);
}
-#ifdef WIN32
+#ifdef _WIN32
static ev_int64_t
filetime_to_100nsec(const FILETIME *ft)
{
get_cpu_usage(struct cpu_usage_timer *timer, double *secElapsedOut,
double *secUsedOut, double *usageOut)
{
-#ifdef WIN32
+#ifdef _WIN32
double usertime_seconds, kerneltime_seconds;
FILETIME createtime, exittime, usertimeEnd, kerneltimeEnd;
int r;
struct timeval timeEnd, timeDiff;
double secondsPassed, secondsUsed;
-#ifdef WIN32
+#ifdef _WIN32
r = GetThreadTimes(timer->thread, &createtime, &exittime,
&usertimeEnd, &kerneltimeEnd);
if (r==0) printf("GetThreadTimes failed.");
double usage, secPassed, secUsed;
-#ifdef WIN32
+#ifdef _WIN32
WORD wVersionRequested;
WSADATA wsaData;
int err;
*/
#include "event2/event-config.h"
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#else
#include <unistd.h>
const char *test = "test string";
evutil_socket_t pair[2];
-#ifdef WIN32
+#ifdef _WIN32
WORD wVersionRequested;
WSADATA wsaData;
int err;
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#ifndef WIN32
+#ifndef _WIN32
#include <unistd.h>
#endif
#include <errno.h>
int
main(int argc, char **argv)
{
-#ifdef WIN32
+#ifdef _WIN32
WORD wVersionRequested;
WSADATA wsaData;
int err;
#include <assert.h>
#include <math.h>
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#else
struct client_state *cs = ctx;
struct evbuffer *output = bufferevent_get_output(bev);
char buf[1024];
-#ifdef WIN32
+#ifdef _WIN32
int r = rand() % 256;
#else
int r = random() % 256;
int i,j;
double ratio;
-#ifdef WIN32
+#ifdef _WIN32
WORD wVersionRequested = MAKEWORD(2,2);
WSADATA wsaData;
int err;
err = WSAStartup(wVersionRequested, &wsaData);
#endif
-#ifndef WIN32
+#ifndef _WIN32
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR)
return 1;
#endif
{
struct timeval tv;
evutil_gettimeofday(&tv, NULL);
-#ifdef WIN32
+#ifdef _WIN32
srand(tv.tv_usec);
#else
srandom(tv.tv_usec);
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#ifndef WIN32
+#ifndef _WIN32
#include <unistd.h>
#include <sys/time.h>
#endif
static int
rand_int(int n)
{
-#ifdef WIN32
+#ifdef _WIN32
return (int)(rand() % n);
#else
return (int)(random() % n);
{
struct timeval tv;
int i;
-#ifdef WIN32
+#ifdef _WIN32
WORD wVersionRequested;
WSADATA wsaData;
int err;
*/
#include "event2/event-config.h"
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#else
#include <unistd.h>
{
struct event ev;
-#ifdef WIN32
+#ifdef _WIN32
WORD wVersionRequested;
WSADATA wsaData;
int err;
err = WSAStartup(wVersionRequested, &wsaData);
#endif
-#ifndef WIN32
+#ifndef _WIN32
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR)
return (1);
#endif
#include "tinytest_local.h"
#endif
-#ifdef WIN32
+#ifdef _WIN32
#include <windows.h>
#else
#include <sys/types.h>
/** Name of the current test, if we haven't logged is yet. Used for --quiet */
const char *cur_test_name = NULL;
-#ifdef WIN32
+#ifdef _WIN32
/** Pointer to argv[0] for win32. */
static const char *commandname = NULL;
#endif
_testcase_run_forked(const struct testgroup_t *group,
const struct testcase_t *testcase)
{
-#ifdef WIN32
+#ifdef _WIN32
/* Fork? On Win32? How primitive! We'll do what the smart kids do:
we'll invoke our own exe (whose name we recall from the command
line) with a command line that tells it to run just the test we
{
int i, j, n=0;
-#ifdef WIN32
+#ifdef _WIN32
commandname = v[0];
#endif
for (i=1; i<c; ++i) {
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#endif
data," and we need to look at the error code. Second, Windows defines
a different set of error codes for sockets. */
-#ifndef WIN32
+#ifndef _WIN32
/* True iff e is an error that means a read/write operation can be retried. */
#define EVUTIL_ERR_RW_RETRIABLE(e) \
int evutil_hex_char_to_int(char c);
-#ifdef WIN32
+#ifdef _WIN32
HANDLE evutil_load_windows_system_library(const TCHAR *library_name);
#endif