Skip to content

Commit e80589b

Browse files
committed
ST: For #2188: Remove sendmmsg from ST.
1 parent 1d13021 commit e80589b

File tree

4 files changed

+2
-77
lines changed

4 files changed

+2
-77
lines changed

trunk/3rdparty/st-srs/Makefile

-4
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,6 @@ endif
159159
#
160160
# make EXTRA_CFLAGS=-UMD_HAVE_EPOLL <target>
161161
#
162-
# or to enable sendmmsg(2) support:
163-
#
164-
# make EXTRA_CFLAGS="-DMD_HAVE_SENDMMSG -D_GNU_SOURCE"
165-
#
166162
# or to enable stats for ST:
167163
#
168164
# make EXTRA_CFLAGS=-DDEBUG_STATS

trunk/3rdparty/st-srs/io.c

-65
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,6 @@ unsigned long long _st_stat_recvmsg = 0;
6868
unsigned long long _st_stat_recvmsg_eagain = 0;
6969
unsigned long long _st_stat_sendmsg = 0;
7070
unsigned long long _st_stat_sendmsg_eagain = 0;
71-
unsigned long long _st_stat_sendmmsg = 0;
72-
unsigned long long _st_stat_sendmmsg_eagain = 0;
7371
#endif
7472

7573
#if EAGAIN != EWOULDBLOCK
@@ -726,69 +724,6 @@ int st_sendmsg(_st_netfd_t *fd, const struct msghdr *msg, int flags, st_utime_t
726724
return n;
727725
}
728726

729-
int st_sendmmsg(st_netfd_t fd, struct st_mmsghdr *msgvec, unsigned int vlen, int flags, st_utime_t timeout)
730-
{
731-
#if defined(MD_HAVE_SENDMMSG) && defined(_GNU_SOURCE)
732-
int n;
733-
int left;
734-
struct mmsghdr *p;
735-
736-
#if defined(DEBUG) && defined(DEBUG_STATS)
737-
++_st_stat_sendmmsg;
738-
#endif
739-
740-
left = (int)vlen;
741-
while (left > 0) {
742-
p = (struct mmsghdr*)msgvec + (vlen - left);
743-
744-
if ((n = sendmmsg(fd->osfd, p, left, flags)) < 0) {
745-
if (errno == EINTR)
746-
continue;
747-
if (!_IO_NOT_READY_ERROR)
748-
break;
749-
750-
#if defined(DEBUG) && defined(DEBUG_STATS)
751-
++_st_stat_sendmmsg_eagain;
752-
#endif
753-
754-
/* Wait until the socket becomes writable */
755-
if (st_netfd_poll(fd, POLLOUT, timeout) < 0)
756-
break;
757-
}
758-
759-
left -= n;
760-
}
761-
762-
// An error is returned only if no datagrams could be sent.
763-
if (left == (int)vlen) {
764-
return n;
765-
}
766-
return (int)vlen - left;
767-
#else
768-
struct st_mmsghdr *p;
769-
int i, n;
770-
771-
// @see http://man7.org/linux/man-pages/man2/sendmmsg.2.html
772-
for (i = 0; i < (int)vlen; ++i) {
773-
p = msgvec + i;
774-
n = st_sendmsg(fd, &p->msg_hdr, flags, timeout);
775-
if (n < 0) {
776-
// An error is returned only if no datagrams could be sent.
777-
if (i == 0) {
778-
return n;
779-
}
780-
return i + 1;
781-
}
782-
783-
p->msg_len = n;
784-
}
785-
786-
// Returns the number of messages sent from msgvec; if this is less than vlen, the caller can retry with a
787-
// further sendmmsg() call to send the remaining messages.
788-
return vlen;
789-
#endif
790-
}
791-
792727

793728
/*
794729
* To open FIFOs or other special files.

trunk/3rdparty/st-srs/public.h

-8
Original file line numberDiff line numberDiff line change
@@ -151,14 +151,6 @@ extern int st_sendto(st_netfd_t fd, const void *msg, int len, const struct socka
151151
extern int st_recvmsg(st_netfd_t fd, struct msghdr *msg, int flags, st_utime_t timeout);
152152
extern int st_sendmsg(st_netfd_t fd, const struct msghdr *msg, int flags, st_utime_t timeout);
153153

154-
// @see http://man7.org/linux/man-pages/man2/sendmmsg.2.html
155-
#include <sys/socket.h>
156-
struct st_mmsghdr {
157-
struct msghdr msg_hdr; /* Message header */
158-
unsigned int msg_len; /* Number of bytes transmitted */
159-
};
160-
extern int st_sendmmsg(st_netfd_t fd, struct st_mmsghdr *msgvec, unsigned int vlen, int flags, st_utime_t timeout);
161-
162154
extern st_netfd_t st_open(const char *path, int oflags, mode_t mode);
163155

164156
#ifdef DEBUG

trunk/research/msg_zerocopy/client.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,8 @@ int main(int argc, char** argv)
279279
memcpy(&p->msg_hdr, &msg, sizeof(msghdr));
280280
p->msg_len = 0;
281281
}
282+
283+
// The sendmmsg is removed by https://github.com/ossrs/srs/commit/34dae0fe0ddf2e95353ca8cbdc799f4abf96aead
282284
if (zerocopy) {
283285
r0 = st_sendmmsg(stfd, hdrs, nn_copies + 1, MSG_ZEROCOPY, ST_UTIME_NO_TIMEOUT);
284286
} else {

0 commit comments

Comments
 (0)