PATCH: kannel on AIX - override ar

2008-07-02 Thread Bostock James
Hi,

To build kannel in 64 bit mode, you need to use ar -X64 instead of
ar to build archive libraries. The following patch to configure.in
allows the ar program to be specified by the AR environment variable.

Regards,

James


--- gateway-1.4.1.orig/configure.in 2006-06-06 16:02:58.0
+0200
+++ gateway-1.4.1/configure.in  2008-07-02 10:53:41.0 +0200
@@ -109,6 +109,7 @@
 AC_PROG_RANLIB
 AC_PROG_YACC
 AC_PROG_LEX
+AC_CHECK_TOOL(AR, ar)
 AC_PATH_PROG(CONVERT, convert)
 AC_PATH_PROG(PERL, perl)

@@ -116,7 +117,7 @@
 dnl Executable extension for systems that need one, i.e. Cygwin
 dnl Set the LIBTOOL to be used to create libs
 EXE_EXT=
-LIBTOOL=ar rc
+LIBTOOL=$AR rc
 case $host in
   *-sun-solaris*)
 CFLAGS=$CFLAGS -DSunOS=1





Kannel on AIX - is it necessary to explicitly link against wtc8/wtc9?

2008-07-02 Thread Bostock James
Hi,

If Kannel is configured with --with-oracle, it tries to link the wtc8
library or, if the file $ORACLE_HOME/lib/libwtc8.so does not exist, the
wtc9 library.

On AIX, with Oracle 9.2, linking explicitly against libwtc9 also
requires explicitly linking against libclntst9 and libodm (a system
library).

My question is whether it is necessary to explicitly check for libwtc8
or libwtc9 (note that there is no corresponding library for Oracle 10)?
Is it not sufficient to link against libclntsh?

Note that for certain configurations of HP-UX, the shared library
extension is .sl not .so so the existing check is inherently
non-portable.

Regards,

James



PATCH: Microsecond sleep time

2008-07-02 Thread Werner Coetzee

Hi

Can anyone explain why gwthread is using the poll function to sleep (using 
milliseconds as timeout), and not maybe the select function (using microseconds 
as timeout)?

We have the requirement to be able to sleep for less than a millisecond, which 
the current gwthread_sleep can't provide.

Below is a patch to do just that, using the select function.
I have tested it, so if anyone has any comments, please let me hear them.

The diff is from our own SVN repository, but as far as I know, it is up-to-date 
with the cvs.


Index: gwthread.h
===
--- gwthread.h  (revision 459)
+++ gwthread.h  (working copy)
@@ -113,7 +113,7 @@
  * call. Returns the internal thread id and the process id. */
 void gwthread_self_ids(long *tid, long *pid);

-/* If the other thread is currently in gwthread_pollfd or gwthread_sleep,
+/* If the other thread is currently in gwthread_pollfd, gwthread_sleep, or 
gwthread_sleep_micro,
  * make it return immediately.  Otherwise, make it return immediately, the
  * next time it calls one of those functions. */
 void gwthread_wakeup(long thread);
@@ -142,6 +142,10 @@
  * calls gwthread_wakeup on us.  Fractional seconds are allowed. */
 void gwthread_sleep(double seconds);

+/* Sleep until seconds seconds have elapsed, or until another thread
+ * calls gwthread_wakeup on us.  Fractional seconds are allowed. */
+void gwthread_sleep_micro(double dseconds);
+
 /* Force a specific thread to terminate. Returns 0 on success, -1 if the
  * thread has been terminated while calling and non-zero for the pthread
  * specific error code.


AND


Index: gwthread-pthread.c
===
--- gwthread-pthread.c  (revision 459)
+++ gwthread-pthread.c  (working copy)
@@ -780,6 +780,42 @@
 }


+void gwthread_sleep_micro(double dseconds)
+{
+fd_set fd_set_recv;
+struct threadinfo *threadinfo;
+int fd;
+int ret;
+
+threadinfo = getthreadinfo();
+fd = threadinfo-wakefd_recv;
+
+FD_ZERO(fd_set_recv);
+FD_SET(fd, fd_set_recv);
+
+if (dseconds  0) {
+ret = select(fd + 1, fd_set_recv, NULL, NULL, NULL);
+}
+else {
+struct timeval timeout;
+timeout.tv_sec = dseconds;
+timeout.tv_usec = (dseconds - timeout.tv_sec) * 100;
+
+ret = select(fd + 1, fd_set_recv, NULL, NULL, timeout);
+}
+
+if (ret  0) {
+if (errno != EINTR  errno != EAGAIN) {
+warning(errno, gwthread_sleep_micro: error in select());
+}
+}
+
+if (FD_ISSET(fd, fd_set_recv)) {
+flushpipe(fd);
+}
+}
+
+
 int gwthread_cancel(long thread)
 {
 struct threadinfo *threadinfo;






Regards
Werner







Re: PATCH: Microsecond sleep time

2008-07-02 Thread Andreas Fink


On 02.07.2008, at 14:29, Werner Coetzee wrote:



Hi

Can anyone explain why gwthread is using the poll function to sleep  
(using milliseconds as timeout), and not maybe the select function  
(using microseconds as timeout)?



Kannel can use poll or select. It's a platform specific decision by ./ 
configure as not all have poll as far as I remember.
Select has an issue if you have a lot of file descriptors open as it  
uses an array of many fd's. poll is much smarter there.


The reason why kannel uses poll on a pipe to sleep is for the simple  
reason that a thread can be  woken up before the sleep time expires by  
sending a byte to the pipe.


We have the requirement to be able to sleep for less than a  
millisecond, which the current gwthread_sleep can't provide.


If its for pure sleeping of such small time amounts, you might consult  
your operating system's documentation. maybe usleep() or nanosleep()  
is better for such cases. However be aware that if you sleep such  
small amounts, accuracy can become an issue. Unix kernels are not real  
time kernels.


usleep() on MacOS X says:

DESCRIPTION
	 The usleep() function suspends execution of the calling thread  
until either useconds microseconds have elapsed or a signal is deliv-
	 ered to the thread whose action is to invoke a signal-catching  
function or to terminate the thread or process.  The actual time
	 slept may be longer, due to system latencies and possible  
limitations in the timer resolution of the hardware.


	 This function is implemented, using nanosleep(2), by pausing for  
useconds microseconds or until a signal occurs.  Consequently, in
	 this implementation, sleeping has no effect on the state of  
process timers and there is no special handling for SIGALRM.







Andreas Fink

Fink Consulting GmbH
Global Networks Schweiz AG
BebbiCell AG
IceCell ehf

---
Tel: +41-61-330 Fax: +41-61-331  Mobile: +41-79-2457333
Address: Clarastrasse 3, 4058 Basel, Switzerland
E-Mail:  [EMAIL PROTECTED]
www.finkconsulting.com www.global-networks.ch www.bebbicell.ch
---
ICQ: 8239353 MSN: [EMAIL PROTECTED] AIM: smsrelay Skype: andreasfink
Yahoo: finkconsulting SMS: +41792457333

http://a-fink.blogspot.com/   A developers view about iPhone SDK







Re: PATCH: Microsecond sleep time

2008-07-02 Thread Stipe Tolj

Werner Coetzee schrieb:

Hi

Can anyone explain why gwthread is using the poll function to sleep (using 
milliseconds as timeout), and not maybe the select function (using microseconds 
as timeout)?

We have the requirement to be able to sleep for less than a millisecond, which 
the current gwthread_sleep can't provide.

Below is a patch to do just that, using the select function.
I have tested it, so if anyone has any comments, please let me hear them.

The diff is from our own SVN repository, but as far as I know, it is up-to-date 
with the cvs.


Hi Werner,

I'm +0 for applying the patch to CVS, since it's an additive feature and doesn't 
hurt any existing core bricks of the gwlib.


The calls should be POSIX.1 compliant and portable hence I guess.

Werner, could you do me a favor and resend the patch in a single file as mail 
attachment please. This ensures we don't get truncated end of line chars etc, 
which is a mess to correct by hand while patching ;)


And thanks a lot for contributing.

Stipe

---
Kölner Landstrasse 419
40589 Düsseldorf, NRW, Germany

tolj.org system architecture  Kannel Software Foundation (KSF)
http://www.tolj.org/  http://www.kannel.org/

mailto:st_{at}_tolj.org   mailto:stolj_{at}_kannel.org
---



Re: Kannel on AIX - is it necessary to explicitly link against wtc8/wtc9?

2008-07-02 Thread Stipe Tolj

Hi James,

Bostock James schrieb:

Hi,

If Kannel is configured with --with-oracle, it tries to link the wtc8
library or, if the file $ORACLE_HOME/lib/libwtc8.so does not exist, the
wtc9 library.

On AIX, with Oracle 9.2, linking explicitly against libwtc9 also
requires explicitly linking against libclntst9 and libodm (a system
library).


so this means our current --with-oracle option won't work out-of-the-box for AIX 
and Oracle 9.2, right?



My question is whether it is necessary to explicitly check for libwtc8
or libwtc9 (note that there is no corresponding library for Oracle 10)?
Is it not sufficient to link against libclntsh?


good question; we should have someone with all the Oracle 8,9,10,11 versions 
installed and test.



Note that for certain configurations of HP-UX, the shared library
extension is .sl not .so so the existing check is inherently
non-portable.


which one do you refer to here?

Stipe

---
Kölner Landstrasse 419
40589 Düsseldorf, NRW, Germany

tolj.org system architecture  Kannel Software Foundation (KSF)
http://www.tolj.org/  http://www.kannel.org/

mailto:st_{at}_tolj.org   mailto:stolj_{at}_kannel.org
---



Re: [PATCH] multipart MIME output

2008-07-02 Thread Stipe Tolj

P. A. Bagyenda schrieb:

hi,

For a while I've noticed spurious CRLF at the end of body parts inside 
multipart MIME messages.  I believe I have tracked this down to a couple 
of bugs in the gwlib/mime.c  module, which is used heavily by Mbuni MMS 
Gateway.


 Attached patch fixes these. Broadly, the code was too complicated for 
what should have been a simpler task (thanks partly to your truly!). 
I've tried to simplify the code to be true to RFC 2046 Sec. 5. Tests 
confirm that it is doing the right thing now.


 In addition, the test case for multipart mime is actually mal-formed 
itself :(, lacking CRLF after each header, and at certain boundaries. A 
cleaner one is attached.


Thanks again Paul. Committed to CVS:

2008-07-02  Stipe Tolj  stolj at kannel.org
* gwlib/mime.c: fix and relax function mime_entity_to_octstr() for end of
  line chars. Thanks to Paul Bagyenda for providing the patch.
  [Msg-Id: [EMAIL PROTECTED]]
* test/mime-multipart.txt: demo MIME multipart input file for test/
  test_mime_multipart.c.

Stipe

---
Kölner Landstrasse 419
40589 Düsseldorf, NRW, Germany

tolj.org system architecture  Kannel Software Foundation (KSF)
http://www.tolj.org/  http://www.kannel.org/

mailto:st_{at}_tolj.org   mailto:stolj_{at}_kannel.org
---



RE: PATCH: Microsecond sleep time

2008-07-02 Thread Werner Coetzee
Hi Stipe

Patch attached.

Werner

-Original Message-
From: Stipe Tolj [mailto:[EMAIL PROTECTED]
Sent: 02 July 2008 16:18
To: Werner Coetzee
Cc: devel@kannel.org
Subject: Re: PATCH: Microsecond sleep time

Werner Coetzee schrieb:
 Hi

 Can anyone explain why gwthread is using the poll function to sleep (using 
 milliseconds as timeout), and not maybe the select function (using 
 microseconds as timeout)?

 We have the requirement to be able to sleep for less than a millisecond, 
 which the current gwthread_sleep can't provide.

 Below is a patch to do just that, using the select function.
 I have tested it, so if anyone has any comments, please let me hear them.

 The diff is from our own SVN repository, but as far as I know, it is 
 up-to-date with the cvs.

Hi Werner,

I'm +0 for applying the patch to CVS, since it's an additive feature and doesn't
hurt any existing core bricks of the gwlib.

The calls should be POSIX.1 compliant and portable hence I guess.

Werner, could you do me a favor and resend the patch in a single file as mail
attachment please. This ensures we don't get truncated end of line chars etc,
which is a mess to correct by hand while patching ;)

And thanks a lot for contributing.

Stipe

---
Kölner Landstrasse 419
40589 Düsseldorf, NRW, Germany

tolj.org system architecture  Kannel Software Foundation (KSF)
http://www.tolj.org/  http://www.kannel.org/

mailto:st_{at}_tolj.org   mailto:stolj_{at}_kannel.org
---
/* gwthread.h */

/* Sleep until seconds seconds have elapsed, or until another thread
 * calls gwthread_wakeup on us.  Fractional seconds are allowed. */
void gwthread_sleep_micro(double dseconds);




/* gwthread-pthread.c */

void gwthread_sleep_micro(double dseconds)
{
fd_set fd_set_recv;
struct threadinfo *threadinfo;
int fd;
int ret;

threadinfo = getthreadinfo();
fd = threadinfo-wakefd_recv;

FD_ZERO(fd_set_recv);
FD_SET(fd, fd_set_recv);

if (dseconds  0) {
ret = select(fd + 1, fd_set_recv, NULL, NULL, NULL);
}
else {
struct timeval timeout;
timeout.tv_sec = dseconds;
timeout.tv_usec = (dseconds - timeout.tv_sec) * 100;

ret = select(fd + 1, fd_set_recv, NULL, NULL, timeout);
}

if (ret  0) {
if (errno != EINTR  errno != EAGAIN) {
warning(errno, gwthread_sleep_micro: error in select());
}
}

if (FD_ISSET(fd, fd_set_recv)) {
flushpipe(fd);
}
}


Re: Kannel on AIX - is it necessary to explicitly link against wtc8/wtc9?

2008-07-02 Thread Stipe Tolj

Bostock James schrieb:


My question is whether it is necessary to explicitly check for libwtc8
or libwtc9 (note that there is no corresponding library for Oracle 10)?
Is it not sufficient to link against libclntsh?


we have a more recent version of configure.in's oracle detection logic in CVS 
HEAD branch:


[...]
dnl Check for Oracle 10g instant client
if test -f $ORACLE_LIB_PATH/libnnz10.so  \
   test -f $ORACLE_LIB_PATH/libclntsh.so.10.1; then
  LIBS=$LIBS -lnnz10
  AC_CHECK_LIB(clntsh,OCIEnvCreate,[ LIBS=$LIBS -lclntsh -lnnz10 
],exit)
else
  AC_CHECK_LIB(clntsh,OCIEnvCreate,[ LIBS=$LIBS -lclntsh ],exit)
fi

dnl Beware that Oracle 10g doesn't use anymore the libwtcX.so libs,
dnl so we don't break hard in case they are not present.
if test -f $ORACLE_HOME/lib/libwtc8.so; then
  AC_CHECK_LIB(wtc8,wtcstu,[ LIBS=$LIBS -lwtc8 ],AC_MSG_ERROR([Oracle 
libwtc8.so not found]))

fi
if test -f $ORACLE_HOME/lib/libwtc9.so; then
  AC_CHECK_LIB(wtc9,wtcstu,[ LIBS=$LIBS -lwtc9 ],AC_MSG_ERROR([Oracle 
libwtc9.so not found]))

fi
[...]

which only tries to run the AC_CECK_LIB() macros if the library files are really 
present.


Can you please checkout a CVS working copy, since this is way more recent then 
1.4.1 stable.


Stipe

---
Kölner Landstrasse 419
40589 Düsseldorf, NRW, Germany

tolj.org system architecture  Kannel Software Foundation (KSF)
http://www.tolj.org/  http://www.kannel.org/

mailto:st_{at}_tolj.org   mailto:stolj_{at}_kannel.org
---



Re: PATCH: Microsecond sleep time

2008-07-02 Thread Stipe Tolj

Werner Coetzee schrieb:

Hi Stipe

Patch attached.


Hi Werner,

you attached a file micro.c, but not a 'diff -u' formated patch ;)

Can you please resend in diff style as you did in your initial posting, but 
simply attach the patch file so we don't get it clobbered. Thanks.


Stipe

---
Kölner Landstrasse 419
40589 Düsseldorf, NRW, Germany

tolj.org system architecture  Kannel Software Foundation (KSF)
http://www.tolj.org/  http://www.kannel.org/

mailto:st_{at}_tolj.org   mailto:stolj_{at}_kannel.org
---



Re: PATCH: kannel on AIX - override ar

2008-07-02 Thread Stipe Tolj

Bostock James schrieb:

Hi,

To build kannel in 64 bit mode, you need to use ar -X64 instead of
ar to build archive libraries. The following patch to configure.in
allows the ar program to be specified by the AR environment variable.


Thanks James for providing the patch for AIX 64bit builds.

Commited to CVS:

2008-07-02  Stipe Tolj  stolj at kannel.org
* configure[.in]: add support for AIX 64bit builds via setting the ar
  archiever call in $AR env variable.
  Thanks to James Bostock james.bostock at comverse.com for his AIX
  contributions.
  [Msg-Id: 
[EMAIL PROTECTED]]


Stipe

---
Kölner Landstrasse 419
40589 Düsseldorf, NRW, Germany

tolj.org system architecture  Kannel Software Foundation (KSF)
http://www.tolj.org/  http://www.kannel.org/

mailto:st_{at}_tolj.org   mailto:stolj_{at}_kannel.org
---



CVS port number

2008-07-02 Thread Werner Coetzee

Hi what is the port number for Kannel CVS?

I'm using the command as on www.kannel.org:

cvs -d:pserver:[EMAIL PROTECTED]:/home/cvs login

but get: cvs [login aborted]: connect to cvs.kannel.org(193.53.0.98):2401 
failed: Connection timed out
Is the port number maybe different from 2401?

Regards
Werner





Re: CVS port number

2008-07-02 Thread Stipe Tolj

Werner Coetzee schrieb:

Hi what is the port number for Kannel CVS?

I'm using the command as on www.kannel.org:

cvs -d:pserver:[EMAIL PROTECTED]:/home/cvs login

but get: cvs [login aborted]: connect to cvs.kannel.org(193.53.0.98):2401 
failed: Connection timed out
Is the port number maybe different from 2401?


nop, it's the standard cvs server port, hence 2401.

Here is a telnet session from outside:

$ telnet cvs.kannel.org 2401
Trying 193.53.0.98...
Connected to cvs.kannel.org.
Escape character is '^]'.

cvs [pserver aborted]: bad auth protocol start:

Connection closed by foreign host.

so thing should work. Maybe an short network outage either on your side or 
ours? ;)

Stipe

---
Kölner Landstrasse 419
40589 Düsseldorf, NRW, Germany

tolj.org system architecture  Kannel Software Foundation (KSF)
http://www.tolj.org/  http://www.kannel.org/

mailto:st_{at}_tolj.org   mailto:stolj_{at}_kannel.org
---



RE: CVS port number

2008-07-02 Thread Werner Coetzee

Thanks Stipe

Looks like a firewall issue on our side.
I'll discuss it with our system administrators tomorrow.

Regards
Werner



-Original Message-
From: Stipe Tolj [mailto:[EMAIL PROTECTED]
Sent: 02 July 2008 18:11
To: Werner Coetzee
Cc: devel@kannel.org
Subject: Re: CVS port number

Werner Coetzee schrieb:
 Hi what is the port number for Kannel CVS?

 I'm using the command as on www.kannel.org:

 cvs -d:pserver:[EMAIL PROTECTED]:/home/cvs login

 but get: cvs [login aborted]: connect to cvs.kannel.org(193.53.0.98):2401 
 failed: Connection timed out
 Is the port number maybe different from 2401?

nop, it's the standard cvs server port, hence 2401.

Here is a telnet session from outside:

$ telnet cvs.kannel.org 2401
Trying 193.53.0.98...
Connected to cvs.kannel.org.
Escape character is '^]'.

cvs [pserver aborted]: bad auth protocol start:

Connection closed by foreign host.

so thing should work. Maybe an short network outage either on your side or 
ours? ;)

Stipe

---
Kölner Landstrasse 419
40589 Düsseldorf, NRW, Germany

tolj.org system architecture  Kannel Software Foundation (KSF)
http://www.tolj.org/  http://www.kannel.org/

mailto:st_{at}_tolj.org   mailto:stolj_{at}_kannel.org
---



RE: PATCH: Microsecond sleep time

2008-07-02 Thread Werner Coetzee
Hi Stipe

Diffs attached.
I hope it's the right format this time.

Regards
Werner



-Original Message-
From: Stipe Tolj [mailto:[EMAIL PROTECTED]
Sent: 02 July 2008 16:48
To: Werner Coetzee
Cc: devel@kannel.org
Subject: Re: PATCH: Microsecond sleep time

Werner Coetzee schrieb:
 Hi Stipe

 Patch attached.

Hi Werner,

you attached a file micro.c, but not a 'diff -u' formated patch ;)

Can you please resend in diff style as you did in your initial posting, but
simply attach the patch file so we don't get it clobbered. Thanks.

Stipe

---
Kölner Landstrasse 419
40589 Düsseldorf, NRW, Germany

tolj.org system architecture  Kannel Software Foundation (KSF)
http://www.tolj.org/  http://www.kannel.org/

mailto:st_{at}_tolj.org   mailto:stolj_{at}_kannel.org
---


gwthread.h.diff
Description: gwthread.h.diff


gwthread-pthread.c.diff
Description: gwthread-pthread.c.diff


Memory leaks in Kannel

2008-07-02 Thread Carlos Parada
Hi all,

I'm using the kannel version 1.4.0 and I wanted to
keep using this version, since I have made slight
changes.
I have noticed that there are some memory leaks in,
1.4.0 that I confirmed at http://www.kannel.org/news.shtml.
 - Fixed memory leaks for concat message handling.
 - Fixed memory leaks in smsbox.

I wanted to fix those problems on version 1.4.0, not
upgrading to 1.4.1. Anybody can provide me a patch to
fix this? or can give me any code, easy tips, etc. so
that I can fix the problem changing the code.


Regards,
Carlos Parada