Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Jan 2011 02:40:48 +0000 (UTC)
From:      Jeff Roberson <jeff@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r216902 - in projects/ofed/head/contrib/ofed: libsdp/src usr.lib usr.lib/libsdp
Message-ID:  <201101030240.p032emrg067298@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 <fcntl.h>
 #include <signal.h>
 #include <sys/poll.h>
+#ifdef __linux__
 #include <sys/epoll.h>
+#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 <bsd.own.mk>
 
 SUBDIR	= libibcommon libibmad libibumad libibverbs libmlx4 libmthca
-SUBDIR	+= libopensm libosmcomp libosmvendor libibcm librdmacm
+SUBDIR	+= libopensm libosmcomp libosmvendor libibcm librdmacm libsdp
 
 .include <bsd.subdir.mk>

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 <bsd.own.mk>
+
+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 <bsd.lib.mk>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201101030240.p032emrg067298>