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/.
pespin gerrit-no-reply at lists.osmocom.orgpespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-trx/+/21594 ) Change subject: ipc-driver-test: Allow setting dir prefix for UD socket ...................................................................... ipc-driver-test: Allow setting dir prefix for UD socket Change-Id: I35282b38a1d560fb3440fe0aa9a27808d9d116cc --- M Transceiver52M/device/ipc/ipc-driver-test.c M Transceiver52M/device/ipc/shm.h 2 files changed, 24 insertions(+), 11 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/94/21594/1 diff --git a/Transceiver52M/device/ipc/ipc-driver-test.c b/Transceiver52M/device/ipc/ipc-driver-test.c index da53463..d8284c7 100644 --- a/Transceiver52M/device/ipc/ipc-driver-test.c +++ b/Transceiver52M/device/ipc/ipc-driver-test.c @@ -49,6 +49,7 @@ #include "ipc_sock.h" #define DEFAULT_SHM_NAME "/osmo-trx-ipc-driver-shm2" +#define IPC_SOCK_PATH_PREFIX "/tmp" static void *tall_ctx; struct ipc_sock_state *global_ipc_sock_state; @@ -63,6 +64,11 @@ static struct ipc_shm_region *decoded_region; +static struct { + int msocknum; + char *ud_prefix_dir; +} cmdline_cfg; + static const struct log_info_cat default_categories[] = { [DMAIN] = { .name = "DMAIN", @@ -185,8 +191,8 @@ chan_info = ipc_prim->u.open_cnf.chan_info; for (i = 0; i < num_chans; i++) { - snprintf(chan_info->chan_ipc_sk_path, sizeof(chan_info->chan_ipc_sk_path), "%s_%d", - IPC_SOCK_PATH_PREFIX, i); + snprintf(chan_info->chan_ipc_sk_path, sizeof(chan_info->chan_ipc_sk_path),"%s/ipc_sock%d_%d", + cmdline_cfg.ud_prefix_dir, cmdline_cfg.msocknum, i); /* FIXME: dynamc chan limit, currently 8 */ if (i < 8) ipc_sock_init(chan_info->chan_ipc_sk_path, &global_ctrl_socks[i], ipc_chan_sock_accept, i); @@ -413,20 +419,20 @@ { printf("ipc-driver-test Usage:\n" " -h --help This message\n" + " -u --unix-sk-dir DIR Existing directory where to create the Master socket\n" " -n --sock-num NR Master socket suffix number NR\n"); } -static int msocknum = 0; - static void handle_options(int argc, char **argv) { while (1) { int option_index = 0, c; const struct option long_options[] = { { "help", 0, 0, 'h' }, + { "unix-sk-dir", 1, 0, 'u' }, { "sock-num", 1, 0, 'n' }, { 0, 0, 0, 0 } }; - c = getopt_long(argc, argv, "hn:", long_options, &option_index); + c = getopt_long(argc, argv, "hu:n:", long_options, &option_index); if (c == -1) break; @@ -435,9 +441,13 @@ print_help(); exit(0); break; - case 'n': - msocknum = atoi(optarg); + case 'u': + cmdline_cfg.ud_prefix_dir = talloc_strdup(tall_ctx, optarg); break; + case 'n': + cmdline_cfg.msocknum = atoi(optarg); + break; + default: exit(2); break; @@ -452,14 +462,19 @@ int main(int argc, char **argv) { - char ipc_msock_path[sizeof(IPC_SOCK_PATH_PREFIX) + 3]; + char ipc_msock_path[128]; tall_ctx = talloc_named_const(NULL, 0, "OsmoTRX"); msgb_talloc_ctx_init(tall_ctx, 0); osmo_init_logging2(tall_ctx, &log_infox); log_enable_multithread(); handle_options(argc, argv); - snprintf(ipc_msock_path, sizeof(ipc_msock_path), "%s%d", IPC_SOCK_PATH_PREFIX, msocknum); + + if (!cmdline_cfg.ud_prefix_dir) + cmdline_cfg.ud_prefix_dir = talloc_strdup(tall_ctx, IPC_SOCK_PATH_PREFIX); + + + snprintf(ipc_msock_path, sizeof(ipc_msock_path), "%s/ipc_sock%d", cmdline_cfg.ud_prefix_dir, cmdline_cfg.msocknum); LOGP(DMAIN, LOGL_INFO, "Starting %s\n", argv[0]); ipc_sock_init(ipc_msock_path, &global_ipc_sock_state, ipc_sock_accept, 0); diff --git a/Transceiver52M/device/ipc/shm.h b/Transceiver52M/device/ipc/shm.h index fcddd54..46c3add 100644 --- a/Transceiver52M/device/ipc/shm.h +++ b/Transceiver52M/device/ipc/shm.h @@ -79,8 +79,6 @@ ////////////////// // Master socket ////////////////// - -#define IPC_SOCK_PATH_PREFIX "/tmp/ipc_sock" #define IPC_SOCK_API_VERSION 1 /* msg_type */ -- To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/21594 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Change-Id: I35282b38a1d560fb3440fe0aa9a27808d9d116cc Gerrit-Change-Number: 21594 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin at sysmocom.de> Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201207/1007f80d/attachment.htm>