Some setsockopt() options are not defined or supported in BSD. This patch #ifdef's those unseported options. [ Alternativly we can overide setsockopt() to an internal routine and define these Linux options to be some elegal value (like 0), Then if the option is 0 just return with no error, else call the original function.] Signed-off-by: Boaz Harrosh <bharrosh@xxxxxxxxxxx> --- usr/iscsi/iscsi_tcp.c | 15 +++++++++++++-- 1 files changed, 13 insertions(+), 2 deletions(-) diff --git a/usr/iscsi/iscsi_tcp.c b/usr/iscsi/iscsi_tcp.c index bee2145..e730101 100644 --- a/usr/iscsi/iscsi_tcp.c +++ b/usr/iscsi/iscsi_tcp.c @@ -66,6 +66,7 @@ static int set_keepalive(int fd) if (ret) return ret; +#ifndef __MAKE_TGT_ON_BSD__ opt = 1800; ret = setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE, &opt, sizeof(opt)); if (ret) @@ -80,6 +81,7 @@ static int set_keepalive(int fd) ret = setsockopt(fd, IPPROTO_TCP, TCP_KEEPINTVL, &opt, sizeof(opt)); if (ret) return ret; +#endif return 0; } @@ -279,18 +281,27 @@ static size_t iscsi_tcp_write_begin(struct iscsi_connection *conn, void *buf, size_t nbytes) { struct iscsi_tcp_connection *tcp_conn = TCP_CONN(conn); - int opt = 1; - setsockopt(tcp_conn->fd, SOL_TCP, TCP_CORK, &opt, sizeof(opt)); +#ifndef __MAKE_TGT_ON_BSD__ + { + int opt = 1; + setsockopt(tcp_conn->fd, SOL_TCP, TCP_CORK, &opt, sizeof(opt)); + } +#endif + + dprintf("fd=%d buf=%p nbytes=%zd\n", tcp_conn->fd, buf, nbytes); return write(tcp_conn->fd, buf, nbytes); } static void iscsi_tcp_write_end(struct iscsi_connection *conn) { +#ifndef __MAKE_TGT_ON_BSD__ struct iscsi_tcp_connection *tcp_conn = TCP_CONN(conn); int opt = 0; setsockopt(tcp_conn->fd, SOL_TCP, TCP_CORK, &opt, sizeof(opt)); + dprintf("iscsi_tcp_write_end\n"); +#endif } static size_t iscsi_tcp_close(struct iscsi_connection *conn) -- 1.6.0.6 -- To unsubscribe from this list: send the line "unsubscribe stgt" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html