From 9b7a48421c84c3d055af8bd680ebbe24f87ee8b2 Mon Sep 17 00:00:00 2001 From: Max Date: Fri, 9 Sep 2022 21:02:15 +0700 Subject: [PATCH] Don't manually create pid file Previously osmo-bts created /var/run/osmo-bts.pid which isn't used by anything and makes it hard to run as non-root user. Let's get rid of this pre-systemd relic. Related: OS#4107 Change-Id: I86bcaedbc8cb1297476ad741eaa45585fea3c380 --- doc/manuals/chapters/architecture.adoc | 1 - doc/startup.txt | 1 - src/common/main.c | 21 --------------------- 3 files changed, 23 deletions(-) diff --git a/doc/manuals/chapters/architecture.adoc b/doc/manuals/chapters/architecture.adoc index 30eab7a44..128ed597e 100644 --- a/doc/manuals/chapters/architecture.adoc +++ b/doc/manuals/chapters/architecture.adoc @@ -89,7 +89,6 @@ order to specify which PHY instance is allocated to this specific TRX. | common | phy_links_open() | Iterate over list of configured PHY links | bts-specific | bts_model_phy_link_open() | Open each of the configured PHY links | bts-specific | bts_model_phy_link_close() | Close each of the configured PHY links -| common | write_pid_file() | Generate the pid file | common | osmo_daemonize() | Fork as daemon in background (if configured) | common | bts_main() | Run main loop until global variable quit >= 2 |=== diff --git a/doc/startup.txt b/doc/startup.txt index c60cc0a7e..816e76bf1 100644 --- a/doc/startup.txt +++ b/doc/startup.txt @@ -27,7 +27,6 @@ The start-up procedure of OsmoBTS can be described as follows: | common | abis_open() | Start of the A-bis connection to BSC | common | phy_links_open() | Iterate over list of configured PHY links | bts-specific | bts_model_phy_link_open() | Open each of the configured PHY links -| common | write_pid_file() | Generate the pid file | common | osmo_daemonize() | Fork as daemon in background (if configured) | common | bts_main() | Run main loop until global variable quit >= 2 | bts-specific | bts_model_oml_estab() | Called by core once OML link is established diff --git a/src/common/main.c b/src/common/main.c index d0698125d..954cc34c4 100644 --- a/src/common/main.c +++ b/src/common/main.c @@ -257,25 +257,6 @@ static void signal_handler(int signum) } } -static int write_pid_file(char *procname) -{ - FILE *outf; - char tmp[PATH_MAX+1]; - - snprintf(tmp, sizeof(tmp)-1, "/var/run/%s.pid", procname); - tmp[PATH_MAX-1] = '\0'; - - outf = fopen(tmp, "w"); - if (!outf) - return -1; - - fprintf(outf, "%d\n", getpid()); - - fclose(outf); - - return 0; -} - int bts_main(int argc, char **argv) { struct gsm_bts_trx *trx; @@ -358,8 +339,6 @@ int bts_main(int argc, char **argv) } } - write_pid_file("osmo-bts"); - /* Accept a GSMTAP host from VTY config, but a commandline option overrides that. */ if (gsmtap_ip != NULL) { if (g_bts->gsmtap.remote_host != NULL) {