This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Harald Welte gerrit-no-reply at lists.osmocom.orgHarald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/12718 )
Change subject: Added support for daemonize to osmo-pcu.
......................................................................
Added support for daemonize to osmo-pcu.
Change-Id: Ia889544e0a350b6bab55da4e4201a617e0241ea2
---
M src/pcu_main.cpp
1 file changed, 16 insertions(+), 1 deletion(-)
Approvals:
Jenkins Builder: Verified
Vadim Yanitskiy: Looks good to me, but someone else must approve
Pau Espin Pedrol: Looks good to me, but someone else must approve
Harald Welte: Looks good to me, approved
diff --git a/src/pcu_main.cpp b/src/pcu_main.cpp
index 7480842..fe85160 100644
--- a/src/pcu_main.cpp
+++ b/src/pcu_main.cpp
@@ -60,6 +60,7 @@
extern void *bv_tall_ctx;
static int quit = 0;
static int rt_prio = -1;
+static bool daemonize = false;
static const char *gsmtap_addr = "localhost"; // FIXME: use gengetopt's default value instead
static void print_help()
@@ -75,6 +76,8 @@
" -V --version print version\n"
" -r --realtime PRIO Use SCHED_RR with the specified "
"priority\n"
+ " -D --daemonize Fork the process into a background"
+ "daemon\n"
" -i --gsmtap-ip The destination IP used for GSMTAP.\n"
);
}
@@ -91,12 +94,13 @@
{ "mnc", 1, 0, 'n' },
{ "version", 0, 0, 'V' },
{ "realtime", 1, 0, 'r' },
+ { "daemonize", 0, 0, 'D' },
{ "exit", 0, 0, 'e' },
{ "gsmtap-ip", 1, 0, 'i' },
{ 0, 0, 0, 0 }
};
- c = getopt_long(argc, argv, "hc:m:n:Vr:e:i:",
+ c = getopt_long(argc, argv, "hc:m:n:Vr:De:i:",
long_options, &option_idx);
if (c == -1)
break;
@@ -130,6 +134,9 @@
case 'r':
rt_prio = atoi(optarg);
break;
+ case 'D':
+ daemonize = true;
+ break;
case 'e':
fprintf(stderr, "Warning: Option '-e' is deprecated!\n");
break;
@@ -329,6 +336,14 @@
}
}
+ if (daemonize) {
+ rc = osmo_daemonize();
+ if (rc < 0) {
+ perror("Error during daemonize");
+ exit(1);
+ }
+ }
+
while (!quit) {
osmo_gsm_timers_check();
osmo_gsm_timers_prepare();
--
To view, visit https://gerrit.osmocom.org/12718
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia889544e0a350b6bab55da4e4201a617e0241ea2
Gerrit-Change-Number: 12718
Gerrit-PatchSet: 2
Gerrit-Owner: Rafael Diniz <rafael at rhizomatica.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Rafael Diniz <rafael at rhizomatica.org>
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com>
Gerrit-CC: Keith Whyte <keith at rhizomatica.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190130/4d04a8dc/attachment.htm>