Browse Source

applied patches by W.C.A. Wijngaards, changed env variable handling

tags/rel-0.9
Marc Alexander Lehmann 13 years ago
parent
commit
70a6a63ba0
4 changed files with 41 additions and 28 deletions
  1. +9
    -0
      README
  2. +15
    -16
      ev.c
  3. +16
    -11
      ev.h
  4. +1
    -1
      ev_poll.c

+ 9
- 0
README View File

@@ -81,3 +81,12 @@ whats missing?
AUTHOR

libev was written and designed by Marc Lehmann and Emanuele Giaquinta.

The following people sent in patches or made other noteworthy
contributions (if I forgot to include you, please shout at me, it was an
accident):

W.C.A. Wijngaards
Christopher Layne
Chris Brody


+ 15
- 16
ev.c View File

@@ -312,7 +312,7 @@ ev_now (EV_P)
}
#endif

#define array_roundsize(type,n) ((n) | 4 & ~3)
#define array_roundsize(type,n) (((n) | 4) & ~3)

#define array_needsize(type,base,cur,cnt,init) \
if (expect_false ((cnt) > cur)) \
@@ -755,7 +755,7 @@ ev_method (EV_P)
}

static void
loop_init (EV_P_ int methods)
loop_init (EV_P_ unsigned int flags)
{
if (!method)
{
@@ -772,24 +772,24 @@ loop_init (EV_P_ int methods)
now_floor = mn_now;
rtmn_diff = ev_rt_now - mn_now;

if (methods == EVMETHOD_AUTO)
if (!enable_secure () && getenv ("LIBEV_METHODS"))
methods = atoi (getenv ("LIBEV_METHODS"));
else
methods = EVMETHOD_ANY;
if (!(flags & EVMETHOD_NOENV) && !enable_secure () && getenv ("LIBEV_FLAGS"))
flags = atoi (getenv ("LIBEV_FLAGS"));
if (!(flags & 0x0000ffff))
flags |= 0x0000ffff;

method = 0;
#if EV_USE_KQUEUE
if (!method && (methods & EVMETHOD_KQUEUE)) method = kqueue_init (EV_A_ methods);
if (!method && (flags & EVMETHOD_KQUEUE)) method = kqueue_init (EV_A_ flags);
#endif
#if EV_USE_EPOLL
if (!method && (methods & EVMETHOD_EPOLL )) method = epoll_init (EV_A_ methods);
if (!method && (flags & EVMETHOD_EPOLL )) method = epoll_init (EV_A_ flags);
#endif
#if EV_USE_POLL
if (!method && (methods & EVMETHOD_POLL )) method = poll_init (EV_A_ methods);
if (!method && (flags & EVMETHOD_POLL )) method = poll_init (EV_A_ flags);
#endif
#if EV_USE_SELECT
if (!method && (methods & EVMETHOD_SELECT)) method = select_init (EV_A_ methods);
if (!method && (flags & EVMETHOD_SELECT)) method = select_init (EV_A_ flags);
#endif

ev_init (&sigev, sigcb);
@@ -861,13 +861,13 @@ loop_fork (EV_P)

#if EV_MULTIPLICITY
struct ev_loop *
ev_loop_new (int methods)
ev_loop_new (unsigned int flags)
{
struct ev_loop *loop = (struct ev_loop *)ev_malloc (sizeof (struct ev_loop));

memset (loop, 0, sizeof (struct ev_loop));

loop_init (EV_A_ methods);
loop_init (EV_A_ flags);

if (ev_method (EV_A))
return loop;
@@ -895,7 +895,7 @@ struct ev_loop *
#else
int
#endif
ev_default_loop (int methods)
ev_default_loop (unsigned int methods)
{
if (sigpipe [0] == sigpipe [1])
if (pipe (sigpipe))
@@ -1033,8 +1033,7 @@ periodics_reify (EV_P)
/* first reschedule or stop timer */
if (w->reschedule_cb)
{
ev_tstamp at = ((WT)w)->at = w->reschedule_cb (w, ev_rt_now + 0.0001);

((WT)w)->at = w->reschedule_cb (w, ev_rt_now + 0.0001);
assert (("ev_periodic reschedule callback returned time in the past", ((WT)w)->at > ev_rt_now));
downheap ((WT *)periodics, periodiccnt, 0);
}


+ 16
- 11
ev.h View File

@@ -231,15 +231,20 @@ union ev_any_watcher
struct ev_child child;
};

#define EVMETHOD_AUTO 0 /* consults environment */
#define EVMETHOD_SELECT 1
#define EVMETHOD_POLL 2
#define EVMETHOD_EPOLL 4
#define EVMETHOD_KQUEUE 8
#define EVMETHOD_DEVPOLL 16 /* NYI */
#define EVMETHOD_PORT 32 /* NYI */
#define EVMETHOD_WIN32 64 /* NYI */
#define EVMETHOD_ANY ~0 /* any method, do not consult env */
/* bits for ev_default_loop and ev_loop_new */
/* the default */
#define EVMETHOD_AUTO 0x00000000 /* not quite a mask */

/* method bits to be ored together */
#define EVMETHOD_SELECT 0x00000001 /* about anywhere */
#define EVMETHOD_POLL 0x00000002 /* !win */
#define EVMETHOD_EPOLL 0x00000004 /* linux */
#define EVMETHOD_KQUEUE 0x00000008 /* bsd */
#define EVMETHOD_DEVPOLL 0x00000010 /* solaris 8 */ /* NYI */
#define EVMETHOD_PORT 0x00000020 /* solaris 10 */ /* NYI */

/* flag bits */
#define EVMETHOD_NOENV 0x01000000 /* do NOT consult environment */

#if EV_PROTOTYPES
int ev_version_major (void);
@@ -264,10 +269,10 @@ void ev_set_syserr_cb (void (*cb)(const char *msg));
# if EV_MULTIPLICITY
/* the default loop is the only one that handles signals and child watchers */
/* you can call this as often as you like */
struct ev_loop *ev_default_loop (int methods); /* returns default loop */
struct ev_loop *ev_default_loop (unsigned int flags); /* returns default loop */

/* create and destroy alternative loops that don't handle signals */
struct ev_loop *ev_loop_new (int methods);
struct ev_loop *ev_loop_new (unsigned int flags);
void ev_loop_destroy (EV_P);
void ev_loop_fork (EV_P);



+ 1
- 1
ev_poll.c View File

@@ -53,7 +53,7 @@ poll_modify (EV_P_ int fd, int oev, int nev)
if (idx < 0) /* need to allocate a new pollfd */
{
pollidxs [fd] = idx = pollcnt++;
array_needsize (struct pollfd, polls, pollmax, pollcnt, );
array_needsize (struct pollfd, polls, pollmax, pollcnt, (void));
polls [idx].fd = fd;
}



Loading…
Cancel
Save