Skip to content

Commit 5483a2f

Browse files
committed
For #12: Remove sendmmsg
1 parent eda23b2 commit 5483a2f

File tree

2 files changed

+0
-73
lines changed

2 files changed

+0
-73
lines changed

io.c

Lines changed: 0 additions & 65 deletions
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.

public.h

Lines changed: 0 additions & 8 deletions
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

0 commit comments

Comments
 (0)