[Libevent-users] [PATCH] Add support for evport in test/test.sh

2007-09-25 Thread Trond Norbye

The attached patch will add a test case for the event port implementation.

Trond

Index: test.sh
===
--- test.sh	(revision 453)
+++ test.sh	(working copy)
@@ -7,6 +7,7 @@
 	 EVENT_NOSELECT=yes; export EVENT_NOSELECT
 	 EVENT_NOEPOLL=yes; export EVENT_NOEPOLL
 	 EVENT_NORTSIG=yes; export EVENT_NORTSIG
+ EVENT_NOEVPORT=yes; export EVENT_NOEVPORT
 }
 
 test () {
@@ -87,5 +88,10 @@
 echo EPOLL
 test
 
+setup
+unset EVENT_NOEVPORT
+export EVENT_NOEVPORT
+echo EVPORT
+test
 
 
___
Libevent-users mailing list
Libevent-users@monkey.org
http://monkey.org/mailman/listinfo/libevent-users


[Libevent-users] Question: Library naming

2007-09-25 Thread Trond Norbye
I have intalled libevent 1.3c and 1.3d on my machine, and I have some 
questions about the naming used for libevent.


In my lib-directory I get the following:
lrwxrwxrwx   1 bin bin   22 Sep 24 21:09 libevent-1.3c.so.1 - 
libevent-1.3c.so.1.0.3

-rwxr-xr-x   1 bin bin   160824 Sep 24 21:09 libevent-1.3c.so.1.0.3
lrwxrwxrwx   1 bin bin   22 Sep 24 19:21 libevent-1.3d.so.1 - 
libevent-1.3d.so.1.0.3

-rwxr-xr-x   1 bin bin   303856 Sep 24 19:21 libevent-1.3d.so.1.0.3
lrwxrwxrwx   1 bin bin   22 Sep 24 19:21 libevent.so - 
libevent-1.3d.so.1.0.3


When I look at the dynamic section in the libraries I see that it 
records libevent-1.3[cd].so.1 as the soname, so if I link my application 
with libevent it will require the same version of libevent to be located 
at runtime.


I thought that it was normal to name the libraries like  
libname.so.major.minor.micro (eg: libevent.so.1.3.4) and create 
symbolic links so the application may pick up the newest version of the 
library (with the correct ABI) without re-linking the application.


Is there a good reason for not doing so?

Trond

(I looked in the archive and found 
http://monkeymail.org/archives/libevent-users/2006-March/000114.html, 
but I did not find a response to the question).

___
Libevent-users mailing list
Libevent-users@monkey.org
http://monkey.org/mailman/listinfo/libevent-users


[Libevent-users] [PATCH] Fix syntax error in autogen.sh

2007-09-20 Thread Trond Norbye
/bin/sh does not recognize == as a valid test operator, but /bin/bash 
does...


--Trond


Index: autogen.sh
===
--- autogen.sh	(revision 440)
+++ autogen.sh	(working copy)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 LIBTOOLIZE=libtoolize
 if [ $(uname) == Darwin ] ; then
   LIBTOOLIZE=glibtoolize
___
Libevent-users mailing list
Libevent-users@monkey.org
http://monkey.org/mailman/listinfo/libevent-users


[Libevent-users] [PATCH] Fix problems in evport.c

2007-09-12 Thread Trond Norbye

This patch fix two problems with evport.c on Solaris:

1. The grow-function reallocates the ed_fds array, but ed_pending array 
may contain pointers to the elements in the ed_fds array. These pointers 
must be relocated to avoid using freed memory.


2. evport_dispatch does not handle a NULL-timval-pinter (no time-based 
events are active, wait for I/O).


--Trond

Index: evport.c
===
--- evport.c	(revision 428)
+++ evport.c	(working copy)
@@ -240,8 +240,10 @@
 grow(struct evport_data *epdp, int factor)
 {
 	struct fd_info *tmp;
+	struct fd_info *old = epdp-ed_fds;
 	int oldsize = epdp-ed_nevents;
 	int newsize = factor * oldsize;
+	int ii;
 	assert(factor  1);
 
 	check_evportop(epdp);
@@ -252,6 +254,15 @@
 	epdp-ed_fds = tmp;
 	memset((char*) (epdp-ed_fds + oldsize), 0, 
 	(newsize - oldsize)*sizeof(struct fd_info));
+
+	/* The ev_pending array contains pointers into the released array. */
+	for (ii = 0; ii  EVENTS_PER_GETN; ++ii) {
+		if (epdp-ed_pending[ii] != 0) {
+			int offset = epdp-ed_pending[ii] - old;
+			epdp-ed_pending[ii] = epdp-ed_fds + offset;
+		}
+	}
+
 	epdp-ed_nevents = newsize;
 
 	check_evportop(epdp);
@@ -309,9 +320,16 @@
 
 	/*
 	 * We have to convert a struct timeval to a struct timespec
-	 * (only difference is nanoseconds vs. microseconds)
+	 * (only difference is nanoseconds vs. microseconds). If no time-based
+	 * events are active, we should wait for I/O (and tv == NULL).
 	 */
-	struct timespec ts = {tv-tv_sec, tv-tv_usec * 1000};
+	struct timespec ts;
+	struct timespec *ts_p = NULL;
+	if (tv != NULL) {
+		ts.tv_sec = tv-tv_sec;
+		ts.tv_nsec = tv-tv_usec * 1000;
+		ts_p = ts;
+	}
 
 	/*
 	 * Before doing anything else, we need to reassociate the events we hit
@@ -330,7 +348,7 @@
 	}
 
 	if ((res = port_getn(epdp-ed_port, pevtlist, EVENTS_PER_GETN, 
-		(unsigned int *) nevents, ts)) == -1) {
+		(unsigned int *) nevents, ts_p)) == -1) {
 		if (errno == EINTR) {
 			evsignal_process(base);
 			return (0);
___
Libevent-users mailing list
Libevent-users@monkey.org
http://monkey.org/mailman/listinfo/libevent-users