osmo_io (unlike its io_uring backend) is not linux specific, so putting
it in an "#ifdef __linux__" block is plain wrong.
A side-effect is that all our doxygen comments are not processed as
__linux__ is not set while doxygen parses the source file.
Change-Id: I260443ba3cd0bb81dade434208dea4ea70fe8ad8
This was done for read error in a previous patch. This is required
because osmo_io_uring does not support errno, instead it uses the
result code. To have a unified API, set the result code equally.
Related: OS#5751
Change-Id: I405094449a6644db37534757f2fbccbcff982f23
Add support osmo_io operations resembling sendmsg() and recvmsg() socket
operations. This is what will enable the implementation of higher-layer
functions like equivalents of sctp_recvmsg() and sctp_send() in
libosmo-netif and/or other users.
Change-Id: I89eb519b22d21011d61a7855b2364bc3c295df82
Related: OS#5751
This relocation is necessary as the backend (osmo_io_fd or
osmo_io_uring) requires a different approach in handling connect
notifications. As a result, a function call has been introduced to
struct iofd_backend_ops.
In a subsequent patch, the process for the osmo_io_uring backend will
be modified to handle SCTP connect notifications using poll/select.
If connect notification is requested using poll/select, the file
descriptior must be registered to osmo_fd, using osmo_fd_register. If
read / write notification is requested by application, the file
descriptior must be registered also. A flag is used prevent calling
osmo_fd_register / osmo_fd_unregister multiple times, which would cause
a crash.
Change-Id: I905ec85210570aff8addadfc9603335d04eb057a
Related: OS#5751
As we introduce more modes, and each mode aliases call-back function
pointers to those of another mode, we have more and more error cases
where we (for exampele) access read_cb, but in reality the user has
populated recvfrom_cb.
Let's use a struct, meaning that call-backs of one mode no longer alias
to the same memory locations of call-backs fro another mode. This
allows us to properly check if the user actually provided the right
callbacks for the given mode of the iofd.
This breaks ABI, but luckily not API. So a simple recompile of
higher-layer library + application code will work.
Change-Id: I9d302df8d00369e7b30437a52deb205f75882be3
The two functions of the SCTP socket interface we use in osmo-* are
sctp_send() and sctp_recvmsg(). We do not use sctp_sendmsg() at all,
so let's make sure the mode is named correctly.
Change-Id: Ie2d1c7ce6f211dbe025a0e843ad733443102ea15
Related: OS#5751
Avoid uninitialized read, found with valgrind
Syscall param recvmsg(msg) points to uninitialised byte(s)
at 0x49FD865: __recvmsg_syscall (recvmsg.c:27)
by 0x49FD865: recvmsg (recvmsg.c:41)
by 0x4891FAE: iofd_poll_ofd_cb_recvmsg_sendmsg (osmo_io_poll.c:66)
by 0x48921B2: iofd_poll_ofd_cb_dispatch (osmo_io_poll.c:119)
by 0x48941F1: poll_disp_fds (select.c:419)
by 0x4894299: _osmo_select_main (select.c:457)
by 0x4894304: osmo_select_main (select.c:496)
by 0x10DC3E: test_segm_ipa_stream_srv_run (stream_test.c:628)
by 0x10E2A5: main (stream_test.c:879)
Address 0x1ffefffa68 is on thread 1's stack
in frame #1, created by iofd_poll_ofd_cb_recvmsg_sendmsg (osmo_io_poll.c:45)
Change-Id: I21114ad57784126cfdeb4a932ed44dbf23946fbe
libosmo-netif does a non blocking connect(), which as per definition of
the socket API is signalled from the OS to the user by marking the file
descriptor writable.
osmo_io needs to signal this somehow. Previously osmo_io would only call
the write_cb if actual data has been sent. This patch changes the behaviour
so that calling osmo_iofd_write_enable() will call write_cb() on a writable
socket even if the write queue is empty.
Change-Id: I893cbc3becd5e125f2f06b3654578aed0aacadf3
* make backend configurable for later
* segmentation callback for chunked streams
* logging target for osmo_io
* support partial writes
Change-Id: I50d73cf550d6ce8154bf827bf47408131cf5b0a0
Related: SYS#5094, OS#5751