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/.
laforge gerrit-no-reply at lists.osmocom.orglaforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/23922 ) Change subject: socket: Introduce osmo_sock_set_priority() helper function ...................................................................... socket: Introduce osmo_sock_set_priority() helper function In some situations we want to set the SO_PRIORITY socket option to determine the in-kernel priority of packets generated by this socket. Change-Id: I89abffcd125e6d073338a5c6437b9433220e1823 Related: SYS#5427 --- M include/osmocom/core/socket.h M src/socket.c 2 files changed, 9 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/22/23922/1 diff --git a/include/osmocom/core/socket.h b/include/osmocom/core/socket.h index 92cd202..10e1766 100644 --- a/include/osmocom/core/socket.h +++ b/include/osmocom/core/socket.h @@ -123,6 +123,7 @@ const struct osmo_sockaddr *sockaddr); int osmo_sock_set_dscp(int fd, uint8_t dscp); +int osmo_sock_set_priority(int fd, int prio); #endif /* (!EMBEDDED) */ /*! @} */ diff --git a/src/socket.c b/src/socket.c index 095dee6..6b8c34a 100644 --- a/src/socket.c +++ b/src/socket.c @@ -1802,6 +1802,14 @@ return setsockopt(fd, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)); } +/*! Set the priority value of a socket. + * \param[in] prio priority value. Values outside 0..6 require CAP_NET_ADMIN. + * \returns 0 on success; negative on error. */ +int osmo_sock_set_priority(int fd, int prio) +{ + /* and write it back to the kernel */ + return setsockopt(fd, SOL_SOCKET, SO_PRIORITY, &prio, sizeof(prio)); +} #endif /* HAVE_SYS_SOCKET_H */ -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/23922 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I89abffcd125e6d073338a5c6437b9433220e1823 Gerrit-Change-Number: 23922 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge at osmocom.org> Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210427/0dcd4237/attachment.htm>