svn commit: r274422 - in projects/sendfile/sys: kern sys
Gleb Smirnoff
glebius at FreeBSD.org
Wed Nov 12 10:03:12 UTC 2014
Author: glebius
Date: Wed Nov 12 10:03:10 2014
New Revision: 274422
URL: https://svnweb.freebsd.org/changeset/base/274422
Log:
Sync with head @274421.
Modified:
projects/sendfile/sys/kern/sys_socket.c
projects/sendfile/sys/sys/sockbuf.h
Directory Properties:
projects/sendfile/ (props changed)
projects/sendfile/sys/ (props changed)
Modified: projects/sendfile/sys/kern/sys_socket.c
==============================================================================
--- projects/sendfile/sys/kern/sys_socket.c Wed Nov 12 09:57:15 2014 (r274421)
+++ projects/sendfile/sys/kern/sys_socket.c Wed Nov 12 10:03:10 2014 (r274422)
@@ -185,7 +185,11 @@ soo_ioctl(struct file *fp, u_long cmd, v
case FIONSPACE:
/* Unlocked read. */
- *(int *)data = sbspace(&so->so_snd);
+ if ((so->so_snd.sb_hiwat < sbused(&so->so_snd)) ||
+ (so->so_snd.sb_mbmax < so->so_snd.sb_mbcnt))
+ *(int *)data = 0;
+ else
+ *(int *)data = sbspace(&so->so_snd);
break;
case FIOSETOWN:
Modified: projects/sendfile/sys/sys/sockbuf.h
==============================================================================
--- projects/sendfile/sys/sys/sockbuf.h Wed Nov 12 09:57:15 2014 (r274421)
+++ projects/sendfile/sys/sys/sockbuf.h Wed Nov 12 10:03:10 2014 (r274422)
@@ -177,6 +177,10 @@ void sbfree(struct sockbuf *, struct mbu
void sbmtrim(struct sockbuf *, struct mbuf *, int);
int sbready(struct sockbuf *, struct mbuf *, int);
+/*
+ * Return how much data is available to be taken out of socket
+ * buffer right now.
+ */
static inline u_int
sbavail(struct sockbuf *sb)
{
@@ -187,6 +191,10 @@ sbavail(struct sockbuf *sb)
return (sb->sb_acc);
}
+/*
+ * Return how much data sits there in the socket buffer
+ * It might be that some data is not yet ready to be read.
+ */
static inline u_int
sbused(struct sockbuf *sb)
{
More information about the svn-src-projects
mailing list