1
1

Rollback my changes for the Windows port on these 3 files. Remove some of the

functionality of libevent for Windows. Anyway, these functions are not 
currently used in the Open MPI project, so it's safe to remove them from the
Windows library. But, they should be never used otherwise changes are 
required.

This commit was SVN r11378.
Этот коммит содержится в:
George Bosilca 2006-08-23 21:17:50 +00:00
родитель 9dda057f05
Коммит 9d5ba9daee
3 изменённых файлов: 12 добавлений и 26 удалений

Просмотреть файл

@ -62,7 +62,7 @@ evbuffer_new(void)
{ {
struct evbuffer *buffer; struct evbuffer *buffer;
buffer = (struct evbuffer*)calloc(1, sizeof(struct evbuffer)); buffer = calloc(1, sizeof(struct evbuffer));
return (buffer); return (buffer);
} }
@ -207,7 +207,7 @@ evbuffer_readline(struct evbuffer *buffer)
if (i == (u_int) len) if (i == (u_int) len)
return (NULL); return (NULL);
if ((line = (char*)malloc(i + 1)) == NULL) { if ((line = malloc(i + 1)) == NULL) {
fprintf(stderr, "%s: out of memory\n", __func__); fprintf(stderr, "%s: out of memory\n", __func__);
evbuffer_drain(buffer, i); evbuffer_drain(buffer, i);
return (NULL); return (NULL);
@ -274,7 +274,7 @@ evbuffer_expand(struct evbuffer *buf, size_t datlen)
if ((newbuf = realloc(buf->buffer, length)) == NULL) if ((newbuf = realloc(buf->buffer, length)) == NULL)
return (-1); return (-1);
buf->orig_buffer = buf->buffer = (u_char*)newbuf; buf->orig_buffer = buf->buffer = newbuf;
buf->totallen = length; buf->totallen = length;
} }
@ -336,19 +336,13 @@ evbuffer_read(struct evbuffer *buf, int fd, int howmuch)
{ {
u_char *p; u_char *p;
size_t oldoff = buf->off; size_t oldoff = buf->off;
#ifdef WIN32
u_long n = EVBUFFER_MAX_READ;
DWORD dwBytesRead;
#else
int n = EVBUFFER_MAX_READ; int n = EVBUFFER_MAX_READ;
#ifdef WIN32
DWORD dwBytesRead;
#endif #endif
#if !defined(__WINDOWS__) && defined(FIONREAD) #ifdef FIONREAD
#ifdef WIN32
if (ioctlsocket(fd, FIONREAD, &n) == -1 || n == 0) {
#else
if (ioctl(fd, FIONREAD, &n) == -1 || n == 0) { if (ioctl(fd, FIONREAD, &n) == -1 || n == 0) {
#endif
n = EVBUFFER_MAX_READ; n = EVBUFFER_MAX_READ;
} else if (n > EVBUFFER_MAX_READ && n > howmuch) { } else if (n > EVBUFFER_MAX_READ && n > howmuch) {
/* /*
@ -432,7 +426,7 @@ evbuffer_find(struct evbuffer *buffer, const u_char *what, size_t len)
u_char *search = buffer->buffer; u_char *search = buffer->buffer;
u_char *p; u_char *p;
while ((p = (u_char*)memchr(search, *what, remain)) != NULL && remain >= len) { while ((p = memchr(search, *what, remain)) != NULL && remain >= len) {
if (memcmp(p, what, len) == 0) if (memcmp(p, what, len) == 0)
return (p); return (p);

Просмотреть файл

@ -42,7 +42,6 @@
#endif #endif
#include "event.h" #include "event.h"
#include "opal/opal_socket_errno.h"
/* prototypes */ /* prototypes */
@ -71,7 +70,7 @@ bufferevent_add(struct opal_event *ev, int timeout)
static void static void
bufferevent_read_pressure_cb(struct evbuffer *buf, size_t old, size_t now, bufferevent_read_pressure_cb(struct evbuffer *buf, size_t old, size_t now,
void *arg) { void *arg) {
struct bufferevent *bufev = (struct bufferevent*)arg; struct bufferevent *bufev = arg;
/* /*
* If we are below the watermak then reschedule reading if it's * If we are below the watermak then reschedule reading if it's
* still enabled. * still enabled.
@ -87,7 +86,7 @@ bufferevent_read_pressure_cb(struct evbuffer *buf, size_t old, size_t now,
static void static void
bufferevent_readcb(int fd, short event, void *arg) bufferevent_readcb(int fd, short event, void *arg)
{ {
struct bufferevent *bufev = (struct bufferevent*)arg; struct bufferevent *bufev = arg;
int res = 0; int res = 0;
short what = OPAL_EVBUFFER_READ; short what = OPAL_EVBUFFER_READ;
size_t len; size_t len;
@ -141,7 +140,7 @@ bufferevent_readcb(int fd, short event, void *arg)
static void static void
bufferevent_writecb(int fd, short event, void *arg) bufferevent_writecb(int fd, short event, void *arg)
{ {
struct bufferevent *bufev = (struct bufferevent*)arg; struct bufferevent *bufev = arg;
int res = 0; int res = 0;
short what = OPAL_EVBUFFER_WRITE; short what = OPAL_EVBUFFER_WRITE;
@ -155,12 +154,7 @@ bufferevent_writecb(int fd, short event, void *arg)
if (res == -1) { if (res == -1) {
if (errno == EAGAIN || if (errno == EAGAIN ||
errno == EINTR || errno == EINTR ||
#if !defined(__WINDOWS__) errno == EINPROGRESS)
errno == EINPROGRESS
#else
0
#endif /* !defined(__WINDOWS__) */
)
goto reschedule; goto reschedule;
/* error case */ /* error case */
what |= OPAL_EVBUFFER_ERROR; what |= OPAL_EVBUFFER_ERROR;
@ -207,7 +201,7 @@ bufferevent_new(int fd, evbuffercb readcb, evbuffercb writecb,
{ {
struct bufferevent *bufev; struct bufferevent *bufev;
if ((bufev = (struct bufferevent*)calloc(1, sizeof(struct bufferevent))) == NULL) if ((bufev = calloc(1, sizeof(struct bufferevent))) == NULL)
return (NULL); return (NULL);
if ((bufev->input = evbuffer_new()) == NULL) { if ((bufev->input = evbuffer_new()) == NULL) {

Просмотреть файл

@ -27,8 +27,6 @@
#ifndef _LOG_H_ #ifndef _LOG_H_
#define _LOG_H_ #define _LOG_H_
#include "opal/event/event_rename.h"
void event_err(int eval, const char *fmt, ...); void event_err(int eval, const char *fmt, ...);
void event_warn(const char *fmt, ...); void event_warn(const char *fmt, ...);
void event_errx(int eval, const char *fmt, ...); void event_errx(int eval, const char *fmt, ...);