Some setsockopt() options are not defined or supported in BSD. On BSD, overide setsockopt() to an internal routine and define these Linux options to be -1, Then if the option is -1 just return with no error, else call the original function. Signed-off-by: Boaz Harrosh <bharrosh@xxxxxxxxxxx> --- usr/bsd/os.c | 11 +++++++++++ usr/bsd/sys/socket.h | 23 +++++++++++++++++++++++ 2 files changed, 34 insertions(+), 0 deletions(-) create mode 100644 usr/bsd/sys/socket.h diff --git a/usr/bsd/os.c b/usr/bsd/os.c index d8bd51a..74c5960 100644 --- a/usr/bsd/os.c +++ b/usr/bsd/os.c @@ -54,3 +54,14 @@ int os_semtimedop (int __semid, struct sembuf *__sops, size_t __nsops, { return -1; } + +int bsd_setsockopt(int s, int level, int optname, const void *optval, + socklen_t optlen) +{ + if (optname == BSD_NOT_SUPPORTED) + return 0; + +#undef setsockop + return setsockopt(s, level, optname, optval, optlen); +} + diff --git a/usr/bsd/sys/socket.h b/usr/bsd/sys/socket.h new file mode 100644 index 0000000..c7d7b13 --- /dev/null +++ b/usr/bsd/sys/socket.h @@ -0,0 +1,23 @@ +#ifndef __TGTBSD_SYS_SOCKET_H__ +#define __TGTBSD_SYS_SOCKET_H__ + +/* Overide socket.h on BSD to define Linux specific options, in which case + * just return success. + */ + +#include <../include/sys/socket.h> + +#define setsockopt bsd_setsockopt + +#define BSD_NOT_SUPPORTED -1 +#define TCP_KEEPIDLE BSD_NOT_SUPPORTED +#define TCP_KEEPCNT BSD_NOT_SUPPORTED +#define TCP_KEEPINTVL BSD_NOT_SUPPORTED +#define TCP_CORK BSD_NOT_SUPPORTED +#define SOL_TCP BSD_NOT_SUPPORTED + +/* is in bsd/os.c */ +int bsd_setsockopt(int s, int level, int optname, const void *optval, + socklen_t optlen); + +#endif /* __TGTBSD_SYS_SOCKET_H__ */ -- 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