Date: Tue, 30 Jun 2009 13:38:50 +0000 (UTC) From: Ed Maste <emaste@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r195191 - in head/sys: kern sys Message-ID: <200906301338.n5UDcoSb082155@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: emaste Date: Tue Jun 30 13:38:49 2009 New Revision: 195191 URL: http://svn.freebsd.org/changeset/base/195191 Log: Add FIONSPACE from NetBSD. FIONSPACE is provided so that programs may easily determine how much space is left in the send queue; they do not need to know the send queue size. NetBSD revisions: sys_socket.c r1.41, 1.42 filio.h r1.9 Obtained from: NetBSD Approved by: re (kensmith) Modified: head/sys/kern/sys_socket.c head/sys/sys/filio.h Modified: head/sys/kern/sys_socket.c ============================================================================== --- head/sys/kern/sys_socket.c Tue Jun 30 13:38:14 2009 (r195190) +++ head/sys/kern/sys_socket.c Tue Jun 30 13:38:49 2009 (r195191) @@ -174,6 +174,14 @@ soo_ioctl(struct file *fp, u_long cmd, v *(int *)data = so->so_snd.sb_cc; break; + case FIONSPACE: + if ((so->so_snd.sb_hiwat < so->so_snd.sb_cc) || + (so->so_snd.sb_mbmax < so->so_snd.sb_mbcnt)) + *(int *)data = 0; + else + *(int *)data = sbspace(&so->so_snd); + break; + case FIOSETOWN: error = fsetown(*(int *)data, &so->so_sigio); break; Modified: head/sys/sys/filio.h ============================================================================== --- head/sys/sys/filio.h Tue Jun 30 13:38:14 2009 (r195190) +++ head/sys/sys/filio.h Tue Jun 30 13:38:49 2009 (r195191) @@ -56,6 +56,7 @@ struct fiodgname_arg { }; #define FIODGNAME _IOW('f', 120, struct fiodgname_arg) /* get dev. name */ #define FIONWRITE _IOR('f', 119, int) /* get # bytes (yet) to write */ +#define FIONSPACE _IOR('f', 118, int) /* get space in send queue */ /* Handle lseek SEEK_DATA and SEEK_HOLE for holey file knowledge. */ #define FIOSEEKDATA _IOWR('f', 97, off_t) /* SEEK_DATA */ #define FIOSEEKHOLE _IOWR('f', 98, off_t) /* SEEK_HOLE */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906301338.n5UDcoSb082155>