laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-netif/+/36314?usp=email )
Change subject: introduce osmo_stream_cli_get_iofd() API
......................................................................
introduce osmo_stream_cli_get_iofd() API
Using this, a user can obtain the osmo_io_fd, for example in order to
perform configuration like osmo_iofd_set_alloc_info() or
osmo_iofd_set_txqueue_max_length().
Change-Id: Ie19c8294ddb12dfe5e0fd44e047c47e6f9cbd384
---
M include/osmocom/netif/stream.h
M src/stream_cli.c
M src/stream_srv.c
3 files changed, 37 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/14/36314/1
diff --git a/include/osmocom/netif/stream.h b/include/osmocom/netif/stream.h
index 1d97530..61bc1ad 100644
--- a/include/osmocom/netif/stream.h
+++ b/include/osmocom/netif/stream.h
@@ -109,6 +109,7 @@
const char *osmo_stream_srv_get_sockname(const struct osmo_stream_srv *conn);
struct osmo_fd *osmo_stream_srv_get_ofd(struct osmo_stream_srv *srv);
int osmo_stream_srv_get_fd(const struct osmo_stream_srv *srv);
+struct osmo_io_fd *osmo_stream_srv_get_iofd(const struct osmo_stream_srv *srv);
void osmo_stream_srv_destroy(struct osmo_stream_srv *conn);
void osmo_stream_srv_set_flush_and_destroy(struct osmo_stream_srv *conn);
@@ -177,6 +178,7 @@
char *osmo_stream_cli_get_sockname(const struct osmo_stream_cli *cli);
struct osmo_fd *osmo_stream_cli_get_ofd(struct osmo_stream_cli *cli);
int osmo_stream_cli_get_fd(const struct osmo_stream_cli *cli);
+struct osmo_io_fd *osmo_stream_cli_get_iofd(const struct osmo_stream_cli *cli);
void osmo_stream_cli_set_connect_cb(struct osmo_stream_cli *cli, int (*connect_cb)(struct osmo_stream_cli *cli));
void osmo_stream_cli_set_disconnect_cb(struct osmo_stream_cli *cli, int (*disconnect_cb)(struct osmo_stream_cli *cli));
void osmo_stream_cli_set_read_cb(struct osmo_stream_cli *cli, int (*read_cb)(struct osmo_stream_cli *cli));
diff --git a/src/stream_cli.c b/src/stream_cli.c
index ca60e25..784aa84 100644
--- a/src/stream_cli.c
+++ b/src/stream_cli.c
@@ -222,6 +222,17 @@
return -EINVAL;
}
+/*! Retrieve osmo_io descriptor of the stream client socket.
+ * This function must not be called on a stream client in legacy osmo_fd mode!
+ * \param[in] cli Stream Client of which we want to obtain the file descriptor
+ * \returns osmo_io_fd of stream client. */
+struct osmo_io_fd *
+osmo_stream_cli_get_iofd(const struct osmo_stream_cli *cli)
+{
+ OSMO_ASSERT(cli->mode == OSMO_STREAM_MODE_OSMO_IO);
+ return cli->iofd;
+}
+
static void osmo_stream_cli_read(struct osmo_stream_cli *cli)
{
LOGSCLI(cli, LOGL_DEBUG, "message received\n");
diff --git a/src/stream_srv.c b/src/stream_srv.c
index 3220b9e..a02c1c2 100644
--- a/src/stream_srv.c
+++ b/src/stream_srv.c
@@ -1037,6 +1037,17 @@
return -EINVAL;
}
+/*! Retrieve osmo_io descriptor of the stream server socket.
+ * This function must not be called on a stream server in legacy osmo_fd mode!
+ * \param[in] srv Stream Server of which we want to obtain the osmo_io descriptor
+ * \returns osmo_io_fd of stream server. */
+struct osmo_io_fd *
+osmo_stream_srv_get_iofd(const struct osmo_stream_srv *srv)
+{
+ OSMO_ASSERT(srv->mode == OSMO_STREAM_MODE_OSMO_IO);
+ return srv->iofd;
+}
+
/*! Retrieve the master (Link) from a Stream Server.
* \param[in] conn Stream Server of which we want to know the Link
* \returns Link through which the given Stream Server is established */
--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/36314?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: Ie19c8294ddb12dfe5e0fd44e047c47e6f9cbd384
Gerrit-Change-Number: 36314
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: newchange
Attention is currently required from: laforge.
fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/36287?usp=email )
Change subject: osmo_io: Dont use __linux__ but !EMBEDDED
......................................................................
Patch Set 2: Code-Review+2
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/36287?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I260443ba3cd0bb81dade434208dea4ea70fe8ad8
Gerrit-Change-Number: 36287
Gerrit-PatchSet: 2
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Comment-Date: Sat, 16 Mar 2024 04:20:51 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: fixeria, jolly, laforge.
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/36288?usp=email )
Change subject: osmo_io: Massive improvement of API documentation
......................................................................
Patch Set 4:
(1 comment)
File src/core/osmo_io.c:
https://gerrit.osmocom.org/c/libosmocore/+/36288/comment/126333a6_b0d7dde7
PS4, Line 831: * queue. The iofd tself is not freed and can be assigned a new file descriptor with osmo_iofd_register()
typo: itself
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/36288?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I6315cfc7ff34a0f8971517edf035e1efcef3ed5c
Gerrit-Change-Number: 36288
Gerrit-PatchSet: 4
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: jolly <andreas(a)eversberg.eu>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: jolly <andreas(a)eversberg.eu>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Fri, 15 Mar 2024 20:34:42 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment