Bug #5948


Fix socket (-write) functions in multiple projects (by moving them to a common library...)

Added by arehbein 11 months ago. Updated 11 months ago.

Target version:
Start date:
Due date:
% Done:


Spec Reference:


I've had a short exchange with pespin concerning usage of osmo_fd_write_disable(), resulting in him submitting a patch (, since existing code had been quite suboptimal.

Currently, the socket write function in osmo-bts has been fixed, but while grepping I found a couple of functions that all take a struct osmo_fd * and pretty much contain the same code owing to copy pasta:

osmo-trx/Transceiver52M/device/ipc/ipc_sock.c: ipc_sock_write()
osmo-trx/Transceiver52M/device/ipc/ipc_chan.c: ipc_chan_sock_write()
osmocom-bb/src/host/layer23/src/mobile/mncc_sock.c: mncc_sock_write()
osmo-msc/src/libmsc/mncc_sock.c: mncc_sock_write()
osmo-pcu/src/osmobts_sock.c: pcu_sock_write()
osmo-bsc/src/osmo-bsc/pcu_sock.c: pcu_sock_write()

I have compared them a bit and it very much seems that they all do the same (except for differences that would be left out when applying changes like pespin's patch above) and, going by the patch linked above, should be replaced by some new library function (libosmocore?).
I would also guess that a lot of the other functions in those files dealing with reading and sending messages on that socket share such similarities as well.

What I already see as up to debate is whether or not that should be combined with a transition to the use of Osmocom write queues similar to what is being asked for in

Also where to put such a function, (we might want to keep msgb and socket code in libosmocore independent of each other).


sock_write_functions_grepped.txt sock_write_functions_grepped.txt 32.5 KB Socket write function definitions grepped arehbein, 03/19/2023 10:12 PM

Related issues

Related to libosmocore - Feature #5751: io_uring support in libosmocoreIn Progressjolly11/09/2022

Actions #1

Updated by laforge 11 months ago

  • Assignee deleted (arehbein)
  • Priority changed from Normal to Low

A lot of those functions will likely migrate to osmo_io, I don't see the need of starting another approach in parallel.

Actions #2

Updated by laforge 11 months ago

  • Related to Feature #5751: io_uring support in libosmocore added

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)