1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-24 11:29:10 +00:00

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)
This commit is contained in:
Ed Maste 2009-06-30 13:38:49 +00:00
parent b2d758545b
commit 2dafac3976
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=195191
2 changed files with 9 additions and 0 deletions

View File

@ -174,6 +174,14 @@ soo_ioctl(struct file *fp, u_long cmd, void *data, struct ucred *active_cred,
*(int *)data = so->so_snd.sb_cc; *(int *)data = so->so_snd.sb_cc;
break; 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: case FIOSETOWN:
error = fsetown(*(int *)data, &so->so_sigio); error = fsetown(*(int *)data, &so->so_sigio);
break; break;

View File

@ -56,6 +56,7 @@ struct fiodgname_arg {
}; };
#define FIODGNAME _IOW('f', 120, struct fiodgname_arg) /* get dev. name */ #define FIODGNAME _IOW('f', 120, struct fiodgname_arg) /* get dev. name */
#define FIONWRITE _IOR('f', 119, int) /* get # bytes (yet) to write */ #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. */ /* Handle lseek SEEK_DATA and SEEK_HOLE for holey file knowledge. */
#define FIOSEEKDATA _IOWR('f', 97, off_t) /* SEEK_DATA */ #define FIOSEEKDATA _IOWR('f', 97, off_t) /* SEEK_DATA */
#define FIOSEEKHOLE _IOWR('f', 98, off_t) /* SEEK_HOLE */ #define FIOSEEKHOLE _IOWR('f', 98, off_t) /* SEEK_HOLE */