Module: sip-router
Branch: sr_3.0
Commit: e3dc76b5830f40c08251d6df21cb502ba39f442e
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=e3dc76b…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Fri Mar 12 12:16:16 2010 +0100
mem: fix real_used stats for realloc
A realloc that shrank an allocation accounted twice for the
fragment overhead. Basically each shrinking realloc would
introduce an error in the real_used mem stats, between 8 bytes
(f_malloc, no debugging, 32 bits) and up to 96 bytes (q_malloc
with debugging, 64 bits).
This bug concerns only the accounting part. It does not cause any
memory leak or any real runtime problem. It was introduced
in commit fb9d6e50 (2005).
(cherry picked from commit 75c1e9a735c693a6985a7a1786116b5fe4044fd9)
---
mem/f_malloc.c | 4 +++-
mem/q_malloc.c | 7 +++++--
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/mem/f_malloc.c b/mem/f_malloc.c
index 2c05fe6..49c4b7a 100644
--- a/mem/f_malloc.c
+++ b/mem/f_malloc.c
@@ -491,7 +491,9 @@ void* fm_realloc(struct fm_block* qm, void* p, unsigned long size)
fm_split_frag(qm, f, size);
#endif
#if defined(DBG_F_MALLOC) || defined(MALLOC_STATS)
- qm->real_used-=(orig_size-f->size-FRAG_OVERHEAD);
+ /* fm_split frag already adds FRAG_OVERHEAD for the newly created
+ free frag, so here we only need orig_size-f->size for real used */
+ qm->real_used-=(orig_size-f->size);
qm->used-=(orig_size-f->size);
#endif
}else if (f->size<size){
diff --git a/mem/q_malloc.c b/mem/q_malloc.c
index 09cb5c7..04c6dc9 100644
--- a/mem/q_malloc.c
+++ b/mem/q_malloc.c
@@ -562,8 +562,11 @@ void* qm_realloc(struct qm_block* qm, void* p, unsigned long size)
#else
if(split_frag(qm, f, size)!=0){
#endif
- /* update used sizes: freed the spitted frag */
- qm->real_used-=(orig_size-f->size-FRAG_OVERHEAD);
+ /* update used sizes: freed the splited frag */
+ /* split frag already adds FRAG_OVERHEAD for the newly created
+ free frag, so here we only need orig_size-f->size for real used
+ */
+ qm->real_used-=(orig_size-f->size);
qm->used-=(orig_size-f->size);
}
Module: sip-router
Branch: sr_3.0
Commit: 929598a19dfb09efcfcbb1aee57a83f45b12592f
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=929598a…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Wed Mar 10 09:25:13 2010 +0100
make: on-the-fly dependency generation
- support on-the-fly dependency file generation with gcc >=3.0
(the dependency files are generated while compiling the object
file, eliminating another gcc+sed invocation)
- support for using makedepend -f- for generating dependencies
E.g.: make cfg MKDEP="makedepend -f-". In general gcc should be
preferred if available (use this if you don't have gcc and your
compiler doesn't generate good deps).
(cherry picked from commit 5a9014ee4977c6afbc4b0cf65a9fad6237c2e2a6)
---
Makefile.defs | 12 ++++++++++--
Makefile.rules | 22 +++++++++++++++++++---
2 files changed, 29 insertions(+), 5 deletions(-)
diff --git a/Makefile.defs b/Makefile.defs
index de2cf24..358e99c 100644
--- a/Makefile.defs
+++ b/Makefile.defs
@@ -74,6 +74,9 @@
# from the host (andrei)
# 2009-10-01 use -fsigned-char for gcc on ppc, ppc64, arm and arm6
# (on those archs char is unsigned by default) (andrei)
+# 2010-03-10 added CC_MKDEP_OPTS, which contains to the list of options
+# needed to generate dependencies on-the-fly while compiling
+# or is empty if the compiler doesn't support it (andrei)
quiet?=$(if $(filter 1 yes on,$(Q)),silent,verbose)
@@ -345,7 +348,7 @@ ifneq (,$(findstring gcc, $(CC_LONGVER)))
# -e 's/^[^0-9].*\([0-9][0-9]*\.[0-9][0-9]*\).*/\1/')
# sed with POSIX.1 regex doesn't support |, + or ?
# (darwin, solaris ...) => this complicated expression
- MKDEP=$(CC) -MM
+ MKDEP=$(CC) -MM -MG
#transform gcc version into 2.9x or 3.0
CC_SHORTVER:=$(shell echo "$(CC_VER)" | cut -d" " -f 2| \
sed -e 's/[^0-9]*-\(.*\)/\1/'| \
@@ -354,7 +357,11 @@ ifneq (,$(findstring gcc, $(CC_LONGVER)))
's/3\.[4-9]/3.4/' -e 's/4\.[0-1]\..*/4.x/' -e \
's/4\.[0-1]/4.x/' -e 's/4\.[2-9]\..*/4.2+/' -e \
's/4\.[2-9]$$/4.2+/')
-endif
+ifeq (,$(strip $(filter-out 3.0 3.4 4.x 4.2+,$(CC_SHORTVER))))
+ # dependencies can be generated on-the-fly while compiling *.c
+ CC_MKDEP_OPTS=-MMD -MP
+endif # 3.0 <= $(CC_SHORTVER) <= 4.x
+endif # gcc
ifneq (, $(findstring Sun, $(CC_LONGVER)))
CC_NAME=suncc
@@ -1938,6 +1945,7 @@ export exported_vars
saved_fixed_vars:= MAIN_NAME CFG_NAME SCR_NAME FLAVOUR INSTALL_FLAVOUR \
SRC_NAME RELEASE OS ARCH \
C_DEFS DEFS_RM PROFILE CC LD MKDEP MKTAGS LDFLAGS C_INCLUDES \
+ CC_MKDEP_OPTS \
MOD_LDFLAGS LIB_LDFLAGS UTILS_LDFLAGS LIB_SONAME LD_RPATH \
LIB_SUFFIX LIB_PREFIX \
LIBS \
diff --git a/Makefile.rules b/Makefile.rules
index 5ee7d76..93da8ec 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -25,6 +25,11 @@
# used only for "temporary" defines/includes inside modules or
# libs, C_DEFS and C_INCLUDES are used for the common stuff)
# (andrei)
+# 2010-03-09 generate dependencies when compiling .o instead of on
+# include .d and fix build errors when a .h is moved
+# support for using MKDEP="makedepend-f-" (andrei)
+# 2010-03-10 support for on the-fly dependency generation (while compiling,
+# see CC_MKDEP_OPTS) (andrei)
# check if the saved cfg corresponds with the current one
@@ -59,6 +64,19 @@ cmd_CC=$(CC) $(CFLAGS) $(C_INCLUDES) $(INCLUDES) $(C_DEFS) $(DEFS) -c $< -o $@
cmd_LD=$(LD) $(LDFLAGS) $(objs) $(extra_objs) $(ALL_LIBS) $(SER_RPATH) \
-o $(NAME)
+ifeq (,$(CC_MKDEP_OPTS))
+# if CCC_MKDEP_OPTS is empty => CC cannot generate dependencies on the fly
+cmd_MKDEP=$(MKDEP) $(filter -D% -I%,$(CFLAGS)) $(C_INCLUDES) $(INCLUDES) \
+ $(C_DEFS) $(DEFS) $< \
+ | sed -e 's/\#.*//' -e '/:[ ]*$$/d' -e '/^[ ]*$$/d' \
+ -e 's|.*:|$@: $$(wildcard |' -e 's/\([^\\]\)$$/\1)/'> $*.d
+else
+# deps can be generated on the fly by cmd_CC
+cmd_CC+=$(CC_MKDEP_OPTS)
+# no MKDEP command any more
+cmd_MKDEP=
+endif # CC_MKDEP_OPTS
+
# what will be displayed if quiet==silent
silent_cmd_CC=CC ($(CC)) [$(strip $(crt_type) $(NAME))] $@
silent_cmd_LD=LD ($(LD)) [$(strip $(crt_type) $(NAME))] $@
@@ -84,9 +102,7 @@ exec_cmd= $(if $($(quiet)_cmd_$(1)),\
#implicit rules
%.o:%.c $(ALLDEP)
$(call exec_cmd,CC)
- @$(MKDEP) $(CFLAGS) $(C_INCLUDES) $(INCLUDES) $(C_DEFS) $(DEFS) $< \
- | sed -e 's/#.*//' -e '/:[ ]*$$/d' -e '/^[ ]*$$/d' \
- -e 's#.*:#$@: $$(wildcard #g' -e 's/\([^\\]\)$$/\1)/'> $*.d
+ @$(call cmd_MKDEP)
# use RPATH and SER_LIBS if needed (make install and the module depends
# on some ser libs)
Patches item #2826542, was opened at 2009-07-24 15:27
Message generated for change (Comment added) made by miconda
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=743022&aid=2826542&group_…
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: modules
Group: ver 1.5.x
>Status: Closed
>Resolution: Accepted
Priority: 5
Private: No
Submitted By: Alex Hermann (axlh)
>Assigned to: Daniel-Constantin Mierla (miconda)
Summary: Add id parameter to pua_mi's send_publish
Initial Comment:
When using presence with dialog-info, one needs to be able to specify an id, otherwise presentity from different calls for the same presentity-uri will overwrite each other. This patch makes it possible to specify an 'id' in the MI interface for send_publish. Unfortunately it breaks backward compatibility but it's the only way to use dialog-info with MI without having to manually store a the state of the ETag in the proxy.
----------------------------------------------------------------------
>Comment By: Daniel-Constantin Mierla (miconda)
Date: 2010-03-17 21:37
Message:
Patch applied in GIT devel version.
----------------------------------------------------------------------
Comment By: Alex Hermann (axlh)
Date: 2010-03-02 12:05
Message:
I don't think changing the API in a stable release is appropriate. So, no,
I didn't commit it to 1.5. It might apply to git master too, but I haven't
had time to use/evaluate SR yet and I don't feel comfortable with
committing without testing.
----------------------------------------------------------------------
Comment By: Daniel-Constantin Mierla (miconda)
Date: 2010-03-01 21:02
Message:
Just saw this one again. Alex, did you commit it?
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=743022&aid=2826542&group_…
Module: sip-router
Branch: master
Commit: 8b7f0d9c8a79e5d2d5e7acd193a1ddace84a4a0b
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=8b7f0d9…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Wed Mar 17 20:32:40 2010 +0100
pua_mi: id parameter introduced in mi pua_publish
- the parameter is before etag
- required to refer to same call for dialog-info
- patch by Alex Hermann (SF#2826542)
---
modules_k/pua_mi/README | 122 +++++++++++++++++++-------------
modules_k/pua_mi/doc/pua_mi_admin.xml | 13 ++++
modules_k/pua_mi/mi_func.c | 21 ++++++-
3 files changed, 105 insertions(+), 51 deletions(-)
diff --git a/modules_k/pua_mi/README b/modules_k/pua_mi/README
index 487b3d0..ecbc6ca 100644
--- a/modules_k/pua_mi/README
+++ b/modules_k/pua_mi/README
@@ -14,27 +14,26 @@ Juha Heinanen
Copyright � 2006 voice-system.ro
Revision History
- Revision $Revision$ $Date: 2008-08-06 12:08:33 +0200
- (Mi, 06 Aug 2008) $
- __________________________________________________________
+ Revision $Revision$ $Date$
+ __________________________________________________________________
Table of Contents
1. Admin Guide
- 1.1. Overview
- 1.2. Dependencies
+ 1. Overview
+ 2. Dependencies
- 1.2.1. Kamailio Modules
- 1.2.2. External Libraries or Applications
+ 2.1. Kamailio Modules
+ 2.2. External Libraries or Applications
- 1.3. Exported Parameters
- 1.4. Exported Functions
- 1.5. Exported MI functions
+ 3. Exported Parameters
+ 4. Exported Functions
+ 5. Exported MI functions
- 1.5.1. pua_publish
+ 5.1. pua_publish
- 1.6. pua_subscribe
+ 6. pua_subscribe
List of Examples
@@ -42,44 +41,63 @@ Juha Heinanen
Chapter 1. Admin Guide
-1.1. Overview
+ Table of Contents
+
+ 1. Overview
+ 2. Dependencies
+
+ 2.1. Kamailio Modules
+ 2.2. External Libraries or Applications
+
+ 3. Exported Parameters
+ 4. Exported Functions
+ 5. Exported MI functions
+
+ 5.1. pua_publish
+
+ 6. pua_subscribe
- The pua_mi offers the possibility to publish presence
- information and subscribe to presence information via MI
- transports.
+1. Overview
- Using this module you can create independent
- applications/scripts to publish not sip-related information
- (e.g., system resources like CPU-usage, memory, number of
- active subscribers ...). Also, this module allows non-SIP
- speaking applications to subscribe presence information kept in
- a SIP presence server.
+ The pua_mi offers the possibility to publish presence information and
+ subscribe to presence information via MI transports.
-1.2. Dependencies
+ Using this module you can create independent applications/scripts to
+ publish not sip-related information (e.g., system resources like
+ CPU-usage, memory, number of active subscribers ...). Also, this module
+ allows non-SIP speaking applications to subscribe presence information
+ kept in a SIP presence server.
-1.2.1. Kamailio Modules
+2. Dependencies
+
+ 2.1. Kamailio Modules
+ 2.2. External Libraries or Applications
+
+2.1. Kamailio Modules
The following modules must be loaded before this module:
* pua
-1.2.2. External Libraries or Applications
+2.2. External Libraries or Applications
- The following libraries or applications must be installed
- before running Kamailio with this module loaded:
+ The following libraries or applications must be installed before
+ running Kamailio with this module loaded:
* none
-1.3. Exported Parameters
+3. Exported Parameters
* none
-1.4. Exported Functions
+4. Exported Functions
+
+ The module does not export functions to be used in configuration
+ script.
- The module does not export functions to be used in
- configuration script.
+5. Exported MI functions
-1.5. Exported MI functions
+ 5.1. pua_publish
-1.5.1. pua_publish
+5.1. pua_publish
Command parameters:
* presentity_uri - e.g. sip:system@kamailio.org
@@ -88,13 +106,18 @@ Chapter 1. Admin Guide
information (e.g. presence).
* content type - Content type of published information (e.g.
application/pidf+xml) or . if no information is enclosed.
- * ETag - ETag that publish should match or . if no ETag is
- given.
- * extra_headers - Extra headers added to PUBLISH request or .
- if no extra headers.
+ * id - id for a series of related PUBLISHes to the same
+ presentity-uri or . to always use the same series. For example
+ dialog-info must reuse the same id for the same call otherwise
+ status will be lost when multiple parallel calls to/from the same
+ user take place. The dialog-id from the dialog-info body qualifies
+ as a suitable id here.
+ * ETag - ETag that publish should match or . if no ETag is given.
+ * extra_headers - Extra headers added to PUBLISH request or . if no
+ extra headers.
* body - The body of the publish request containing published
- information or missing if no published information. It has
- to be a single line for FIFO transport.
+ information or missing if no published information. It has to be a
+ single line for FIFO transport.
Example 1.1. pua_publish FIFO example
...
@@ -106,20 +129,19 @@ presence
application/pidf+xml
.
.
-<?xml version='1.0'?><presence xmlns='urn:ietf:params:xml:ns:pidf' xmlns
-:dm='urn:ietf:params:xml:ns:pidf:data-model' xmlns:rpid='urn:ietf:params
-:xml:ns:pidf:rpid' xmlns:c='urn:ietf:params:xml:ns:pidf:cipid' entity='s
-ystem(a)kamailio.org'><tuple id='0x81475a0'><status><basic>open</basic></s
-tatus></tuple><dm:person id='pdd748945'><rpid:activities><rpid:away/>awa
-y</rpid:activities><dm:note>CPU:16 MEM:476</dm:note></dm:person></presen
-ce>
-
+.
+<?xml version='1.0'?><presence xmlns='urn:ietf:params:xml:ns:pidf' xmlns:dm='urn
+:ietf:params:xml:ns:pidf:data-model' xmlns:rpid='urn:ietf:params:xml:ns:pidf:rpi
+d' xmlns:c='urn:ietf:params:xml:ns:pidf:cipid' entity='system(a)kamailio.org'><tup
+le id='0x81475a0'><status><basic>open</basic></status></tuple><dm:person id='pdd
+748945'><rpid:activities><rpid:away/>away</rpid:activities><dm:note>CPU:16 MEM:4
+76</dm:note></dm:person></presence>
-1.6. pua_subscribe
+6. pua_subscribe
Command parameters:
* presentity_uri - e.g. sip:presentity@kamailio.org
* watcher_uri - e.g. sip:watcher@kamailio.org
* event package
- * expires - Relative time in seconds for the desired validity
- of the subscription.
+ * expires - Relative time in seconds for the desired validity of the
+ subscription.
diff --git a/modules_k/pua_mi/doc/pua_mi_admin.xml b/modules_k/pua_mi/doc/pua_mi_admin.xml
index 8602c49..5f332b8 100644
--- a/modules_k/pua_mi/doc/pua_mi_admin.xml
+++ b/modules_k/pua_mi/doc/pua_mi_admin.xml
@@ -120,6 +120,18 @@
</listitem>
<listitem>
<para>
+ <emphasis>id</emphasis>
+ - id for a series of related PUBLISHes to the same
+ presentity-uri or . to always use the same series.
+ For example dialog-info must reuse the same id for the
+ same call otherwise status will be lost when multiple
+ parallel calls to/from the same user take place. The
+ dialog-id from the dialog-info body qualifies as a suitable
+ id here.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
<emphasis>ETag</emphasis>
- ETag that publish should
match or . if no ETag is given.
@@ -154,6 +166,7 @@ presence
application/pidf+xml
.
.
+.
<?xml version='1.0'?><presence xmlns='urn:ietf:params:xml:ns:pidf' xmlns:dm='urn:ietf:params:xml:ns:pidf:data-model' xmlns:rpid='urn:ietf:params:xml:ns:pidf:rpid' xmlns:c='urn:ietf:params:xml:ns:pidf:cipid' entity='system(a)kamailio.org'><tuple id='0x81475a0'><status><basic>open</basic></status></tuple><dm:person id='pdd748945'><rpid:activities><rpid:away/>away</rpid:activities><dm:note>CPU:16 MEM:476</dm:note></dm:person></presence>
]]>
</programlisting>
diff --git a/modules_k/pua_mi/mi_func.c b/modules_k/pua_mi/mi_func.c
index b8089aa..fe3fa3a 100644
--- a/modules_k/pua_mi/mi_func.c
+++ b/modules_k/pua_mi/mi_func.c
@@ -58,6 +58,7 @@ struct mi_root* mi_pua_publish(struct mi_root* cmd, void* param)
publ_info_t publ;
str event;
str content_type;
+ str id;
str etag;
str extra_headers;
int result;
@@ -142,6 +143,19 @@ struct mi_root* mi_pua_publish(struct mi_root* cmd, void* param)
if(node == NULL)
return 0;
+ /* Get id */
+ id= node->value;
+ if(id.s== NULL || id.len== 0)
+ {
+ LM_ERR("empty id parameter\n");
+ return init_mi_tree(400, "Empty id parameter", 20);
+ }
+ LM_DBG("id '%.*s'\n", id.len, id.s);
+
+ node = node->next;
+ if(node == NULL)
+ return 0;
+
/* Get etag */
etag= node->value;
if(etag.s== NULL || etag.len== 0)
@@ -213,7 +227,12 @@ struct mi_root* mi_pua_publish(struct mi_root* cmd, void* param)
{
publ.content_type= content_type;
}
-
+
+ if(! (id.len== 1 && id.s[0]== '.'))
+ {
+ publ.id= id;
+ }
+
if(! (etag.len== 1 && etag.s[0]== '.'))
{
publ.etag= &etag;