Module: kamailio
Branch: master
Commit: dbf1c140eb5ed4609d291b26e00243c32d777818
URL: 
https://github.com/kamailio/kamailio/commit/dbf1c140eb5ed4609d291b26e00243c32d777818

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2025-10-13T09:56:32+02:00

core: added --iuid=val cli parameter

- set instance unique id via cli parameter

---

Modified: src/main.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/dbf1c140eb5ed4609d291b26e00243c32d777818.diff
Patch: 
https://github.com/kamailio/kamailio/commit/dbf1c140eb5ed4609d291b26e00243c32d777818.patch

---

diff --git a/src/main.c b/src/main.c
index 472772d7932..7af4478bd23 100644
--- a/src/main.c
+++ b/src/main.c
@@ -148,6 +148,7 @@
 #include "core/timer_proc.h"
 #include "core/srapi.h"
 #include "core/receive.h"
+#include "core/coreparam.h"
 
 #ifdef DEBUG_DMALLOC
 #include <dmalloc.h>
@@ -195,6 +196,7 @@ Options:\n\
     -G file      Create a pgid file\n\
     -h           This help message\n\
     --help       Long option for `-h`\n\
+    --iuid=val   Instance unique id\n\
     -I           Print more internal compile flags and options\n\
     -K           Turn on \"via:\" host checking when forwarding replies\n\
     -l address   Listen on the specified address/interface (multiple -l\n\
@@ -2233,7 +2235,8 @@ int main(int argc, char **argv)
                        {"debug", required_argument, 0, KARGOPTVAL + 8},
                        {"cfg-print", no_argument, 0, KARGOPTVAL + 9},
                        {"atexit", required_argument, 0, KARGOPTVAL + 10},
-                       {"all-errors", no_argument, 0, KARGOPTVAL + 11}, {0, 0, 
0, 0}};
+                       {"all-errors", no_argument, 0, KARGOPTVAL + 11},
+                       {"iuid", required_argument, 0, KARGOPTVAL + 12}, {0, 0, 
0, 0}};
 
        if(argc > 1) {
                /* checks for common wrong arguments */
@@ -2613,6 +2616,16 @@ int main(int argc, char **argv)
                                        goto error;
                                }
                                break;
+                       case KARGOPTVAL + 12:
+                               if(optarg == NULL) {
+                                       fprintf(stderr, "bad instance unique id 
parameter\n");
+                                       goto error;
+                               }
+                               if(ksr_iuid_set(optarg, 0) < 0) {
+                                       fprintf(stderr, "failed to set instance 
unique id\n");
+                                       goto error;
+                               }
+                               break;
 
                        /* special cases */
                        case '?':
@@ -3166,12 +3179,12 @@ int main(int argc, char **argv)
 
        if(dont_fork) {
                fprintf(stderr, "WARNING: no fork mode %s\n",
-                               (udp_listen) ? (
-                                               (udp_listen->next)
-                                                               ? "and more 
than one listen address found "
-                                                                 "(will use 
only the first one)"
-                                                               : "")
-                                                        : "and no udp listen 
address found");
+                               (udp_listen)
+                                               ? ((udp_listen->next) ? "and 
more than one listen "
+                                                                               
                "address found "
+                                                                               
                "(will use only the first one)"
+                                                                               
          : "")
+                                               : "and no udp listen address 
found");
        }
        if(config_check) {
                fprintf(stderr, "config file ok, exiting...\n");
@@ -3445,7 +3458,7 @@ int main(int argc, char **argv)
 int SYMBOL_EXPORT pthread_mutex_init(
                pthread_mutex_t *__mutex, const pthread_mutexattr_t 
*__mutexattr)
 {
-       static int (*real_pthread_mutex_init)(pthread_mutex_t * __mutex,
+       static int (*real_pthread_mutex_init)(pthread_mutex_t *__mutex,
                        const pthread_mutexattr_t *__mutexattr) = 0;
        pthread_mutexattr_t attr;
        int ret;

_______________________________________________
Kamailio - Development Mailing List -- [email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to