summaryrefslogtreecommitdiff
path: root/source4/lib/socket/socket_unix.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-06-03 13:20:08 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:17:28 -0500
commit1692bbf2e267eabd7099f0b6153da0c7cf209d1d (patch)
treeb3a223d81b78e980c7a4c764485d2a1312601f93 /source4/lib/socket/socket_unix.c
parentff27722fea7fb1727ffeadd3efffb15965a754ed (diff)
downloadsamba-1692bbf2e267eabd7099f0b6153da0c7cf209d1d.tar.gz
samba-1692bbf2e267eabd7099f0b6153da0c7cf209d1d.tar.bz2
samba-1692bbf2e267eabd7099f0b6153da0c7cf209d1d.zip
r7227: added a socket_pending() call to abstract away the FIONREAD ioctl. It
will be interesting to see if this causes any portability problems, as it is a less commonly used call. (This used to be commit f6993db31d93059c70b44a23005ba444e205870f)
Diffstat (limited to 'source4/lib/socket/socket_unix.c')
-rw-r--r--source4/lib/socket/socket_unix.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/source4/lib/socket/socket_unix.c b/source4/lib/socket/socket_unix.c
index 04ba89578f..f27076b5d8 100644
--- a/source4/lib/socket/socket_unix.c
+++ b/source4/lib/socket/socket_unix.c
@@ -316,6 +316,16 @@ static int unixdom_get_fd(struct socket_context *sock)
return sock->fd;
}
+static NTSTATUS unixdom_pending(struct socket_context *sock, size_t *npending)
+{
+ int value = 0;
+ if (ioctl(sock->fd, FIONREAD, &value) == 0) {
+ *npending = value;
+ return NT_STATUS_OK;
+ }
+ return map_nt_error_from_unix(errno);
+}
+
static const struct socket_ops unixdom_ops = {
.name = "unix",
.fn_init = unixdom_init,
@@ -327,6 +337,7 @@ static const struct socket_ops unixdom_ops = {
.fn_send = unixdom_send,
.fn_sendto = unixdom_sendto,
.fn_close = unixdom_close,
+ .fn_pending = unixdom_pending,
.fn_set_option = unixdom_set_option,