summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Mooney <patrick.f.mooney@gmail.com>2015-10-07 21:17:36 +0000
committerRobert Mustacchi <rm@joyent.com>2016-04-25 16:45:08 -0700
commitacb559178a9038e0741b82a6850b72282ab5959e (patch)
treef59fba7a642c6ce88e55fb0772a6f5247eea4d04
parentb7671ee85175f237a818ddb1457a2726d91d56fc (diff)
downloadillumos-joyent-acb559178a9038e0741b82a6850b72282ab5959e.tar.gz
6861 allow sendfile() on AF_UNIX sockets
Reviewed by: Robert Mustacchi <rm@joyent.com> Approved by: Dan McDonald <danmcd@omniti.com>
-rw-r--r--usr/src/uts/common/fs/sockfs/socktpi.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/usr/src/uts/common/fs/sockfs/socktpi.c b/usr/src/uts/common/fs/sockfs/socktpi.c
index e18a0e6ecd..37e441344d 100644
--- a/usr/src/uts/common/fs/sockfs/socktpi.c
+++ b/usr/src/uts/common/fs/sockfs/socktpi.c
@@ -21,7 +21,7 @@
/*
* Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ * Copyright 2015, Joyent, Inc.
* Copyright 2014 Nexenta Systems, Inc. All rights reserved.
*/
@@ -534,6 +534,13 @@ sotpi_init(struct sonode *so, struct sonode *tso, struct cred *cr, int flags)
return (error);
}
+ /* Enable sendfile() on AF_UNIX streams */
+ if (so->so_family == AF_UNIX && so->so_type == SOCK_STREAM) {
+ mutex_enter(&so->so_lock);
+ so->so_mode |= SM_SENDFILESUPP;
+ mutex_exit(&so->so_lock);
+ }
+
/* Wildcard */
if (so->so_protocol != so->so_sockparams->sp_protocol) {
int protocol = so->so_protocol;
@@ -4581,9 +4588,16 @@ sotpi_sendmblk(struct sonode *so, struct nmsghdr *msg, int fflag,
{
int error;
- if (so->so_family != AF_INET && so->so_family != AF_INET6)
+ switch (so->so_family) {
+ case AF_INET:
+ case AF_INET6:
+ case AF_UNIX:
+ break;
+ default:
return (EAFNOSUPPORT);
+ }
+
if (so->so_state & SS_CANTSENDMORE)
return (EPIPE);