From owner-svn-src-projects@FreeBSD.ORG Mon Jan 3 02:40:49 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 31ED0106566B; Mon, 3 Jan 2011 02:40:49 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 204B58FC12; Mon, 3 Jan 2011 02:40:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p032enKc067302; Mon, 3 Jan 2011 02:40:49 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p032emrg067298; Mon, 3 Jan 2011 02:40:48 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <201101030240.p032emrg067298@svn.freebsd.org> From: Jeff Roberson Date: Mon, 3 Jan 2011 02:40:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r216902 - in projects/ofed/head/contrib/ofed: libsdp/src usr.lib usr.lib/libsdp X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jan 2011 02:40:49 -0000 Author: jeff Date: Mon Jan 3 02:40:48 2011 New Revision: 216902 URL: http://svn.freebsd.org/changeset/base/216902 Log: Port libsdp which automatically converts tcp applications to use sdp. - Use the prebuilt copy of the scanner and parser since our yacc chokes on the provided specifications. - Hack out the epoll support. kqueue() support is only required for shadow sockets which allow a single socket to exist on both tcp and sdp. This is currently not supported on bsd. Sponsored by: Isilon Systems, iX Systems, and Panasas. Added: projects/ofed/head/contrib/ofed/usr.lib/libsdp/ projects/ofed/head/contrib/ofed/usr.lib/libsdp/Makefile Deleted: projects/ofed/head/contrib/ofed/libsdp/src/config_parser.y projects/ofed/head/contrib/ofed/libsdp/src/config_scanner.l Modified: projects/ofed/head/contrib/ofed/libsdp/src/port.c projects/ofed/head/contrib/ofed/usr.lib/Makefile Modified: projects/ofed/head/contrib/ofed/libsdp/src/port.c ============================================================================== --- projects/ofed/head/contrib/ofed/libsdp/src/port.c Mon Jan 3 01:54:02 2011 (r216901) +++ projects/ofed/head/contrib/ofed/libsdp/src/port.c Mon Jan 3 02:40:48 2011 (r216902) @@ -60,7 +60,9 @@ #include #include #include +#ifdef __linux__ #include +#endif #ifdef SOLARIS_BUILD /* We're done protecting ourselves from the header prototypes */ @@ -152,6 +154,7 @@ typedef int (*pselect_func_t) (int n, typedef int (*poll_func_t) (struct pollfd * ufds, unsigned long int nfds, int timeout); +#ifdef __linux__ typedef int (*epoll_create_func_t) (int size); typedef int (*epoll_ctl_func_t) (int epfd, @@ -165,6 +168,7 @@ typedef int (*epoll_pwait_func_t) (int e struct epoll_event * events, int maxevents, int timeout, const sigset_t * sigmask); +#endif struct socket_lib_funcs { @@ -184,10 +188,12 @@ struct socket_lib_funcs { select_func_t select; pselect_func_t pselect; poll_func_t poll; +#ifdef __linux__ epoll_create_func_t epoll_create; epoll_ctl_func_t epoll_ctl; epoll_wait_func_t epoll_wait; epoll_pwait_func_t epoll_pwait; +#endif }; /* socket_lib_funcs */ #ifdef SOLARIS_BUILD @@ -910,6 +916,7 @@ find_free_port(const struct sockaddr *si goto close_and_mark; } else { int err; +#ifdef __linux__ socklen_t len = sizeof(int); ret = getsockopt(tmp_sd[1 - tmp_turn], SOL_TCP, @@ -919,6 +926,9 @@ find_free_port(const struct sockaddr *si __func__, strerror(errno)); goto close_and_mark; } +#else + err = -errno; +#endif if (-ENOENT == err || -EADDRINUSE != err) { /* bind() failed due to either: * 1. IP is ETH, not IB, so can't bind() to sdp socket. @@ -1028,11 +1038,15 @@ check_legal_bind(const struct sockaddr * if (EADDRINUSE != errno) goto done; +#ifdef __linux__ if (-1 == getsockopt(*sdp_sd, SOL_TCP, SDP_LAST_BIND_ERR, &err, &len)) { __sdp_log(9, "Error check_legal_bind:getsockopt: %s\n", strerror(errno)); goto done; } +#else + err = -errno; +#endif if (-ENOENT != err) { /* bind() failed due to real error. Can't continue */ __sdp_log(9, "Error check_legal_bind: " @@ -2164,7 +2178,7 @@ done: if we have shadow we must poll on it too - which requires a hack back and forth */ -int poll(struct pollfd *ufds, unsigned long int nfds, int timeout) +int poll(struct pollfd *ufds, nfds_t nfds, int timeout) { int ret; int shadow_fd; @@ -2255,6 +2269,7 @@ done: return ret; } /* poll */ +#ifdef __linux__ /* ========================================================================= */ /*..epoll_create -- replacement socket call. */ /* @@ -2379,6 +2394,7 @@ epoll_pwait(int epfd, program_invocation_short_name, epfd, ret); return ret; } /* epoll_pwait */ +#endif /* ========================================================================= */ @@ -2516,6 +2532,7 @@ void __sdp_init(void) fprintf(stderr, "%s\n", error_str); } +#ifdef __linux__ _socket_funcs.epoll_create = dlsym(__libc_dl_handle, "epoll_create"); if (NULL != (error_str = dlerror())) { fprintf(stderr, "%s\n", error_str); @@ -2535,6 +2552,7 @@ void __sdp_init(void) if (NULL != (error_str = dlerror())) { fprintf(stderr, "%s\n", error_str); } +#endif #ifdef SOLARIS_BUILD _socket_xnet_funcs.socket = dlsym(__libc_dl_handle, "__xnet_socket"); if (NULL != (error_str = dlerror())) { Modified: projects/ofed/head/contrib/ofed/usr.lib/Makefile ============================================================================== --- projects/ofed/head/contrib/ofed/usr.lib/Makefile Mon Jan 3 01:54:02 2011 (r216901) +++ projects/ofed/head/contrib/ofed/usr.lib/Makefile Mon Jan 3 02:40:48 2011 (r216902) @@ -1,6 +1,6 @@ .include SUBDIR = libibcommon libibmad libibumad libibverbs libmlx4 libmthca -SUBDIR += libopensm libosmcomp libosmvendor libibcm librdmacm +SUBDIR += libopensm libosmcomp libosmvendor libibcm librdmacm libsdp .include Added: projects/ofed/head/contrib/ofed/usr.lib/libsdp/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/ofed/head/contrib/ofed/usr.lib/libsdp/Makefile Mon Jan 3 02:40:48 2011 (r216902) @@ -0,0 +1,21 @@ +# $FreeBSD$ + +SHLIBDIR?= /usr/lib + +.include + +SDPDIR= ../../libsdp/src + +.PATH: ${SDPDIR} + +LIB= sdp +SHLIB_MAJOR= 1 +NO_PROFILE= +NO_MAN= + +SRCS= log.c match.c port.c config_parser.c config_scanner.c + +CFLAGS+= -DSYSCONFDIR=\"/etc\" +CFLAGS+= -I${OFEDSYS}/include + +.include