public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH librdmacm 0/8] librdmacm "synchronisation" against libibverbs
@ 2013-07-16 21:59 Yann Droneaud
       [not found] ` <cover.1374011243.git.ydroneaud-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 14+ messages in thread
From: Yann Droneaud @ 2013-07-16 21:59 UTC (permalink / raw)
  To: Sean Hefty, linux-rdma-u79uwXL29TY76Z2rM5mHXA, Jeff Squyres,
	Bart Van Assche
  Cc: Yann Droneaud

Hi,

Please find a few patches to bring librdmacm up to date regarding
autotools support and some others fixes ...

I've used patches from libibverbs to update autoconf/automake
support: I reused commit messages and author of libibverbs commit,
I hope it's ok for you to get credit about those patches to librdmacm.

I've added .gitignore files to the sources and cleanup file modes.

At last, I've added support for close on exec, just like I did
for libibverbs. It might be good to add support for close on exec
since I've managed to get the change applied in the kernel
(Thanks Roland :).


Bart Van Assche (2):
  Add "foreign" option to AM_INIT_AUTOMAKE
  Makefile.am: Fix an automake warning

Jeff Squyres (1):
  autogen.sh: Use autoreconf in autogen.sh

Yann Droneaud (5):
  configure: Apply updates proposed by autoupdate
  configure: Use automake's option "subdir-objects"
  Add .gitignore rules
  Remove executable mode bit on plain text files
  Open files with "close on exec" flag

 .gitignore                | 64 +++++++++++++++++++++++++++++++++++++++++++++++
 Makefile.am               |  2 +-
 autogen.sh                |  7 +-----
 configure.ac              | 40 +++++++++++++++++++++++------
 examples/.gitignore       | 22 ++++++++++++++++
 include/rdma/rdma_cma.h   |  0
 man/rdma_accept.3         |  0
 man/rdma_connect.3        |  0
 man/rdma_create_qp.3      |  0
 man/rdma_getaddrinfo.3    |  0
 man/rdma_join_multicast.3 |  0
 man/rdma_notify.3         |  0
 src/.gitignore            |  9 +++++++
 src/acm.c                 |  4 +--
 src/addrinfo.c            |  0
 src/cma.c                 |  2 +-
 16 files changed, 132 insertions(+), 18 deletions(-)
 create mode 100644 .gitignore
 create mode 100644 examples/.gitignore
 mode change 100755 => 100644 include/rdma/rdma_cma.h
 mode change 100755 => 100644 man/rdma_accept.3
 mode change 100755 => 100644 man/rdma_connect.3
 mode change 100755 => 100644 man/rdma_create_qp.3
 mode change 100755 => 100644 man/rdma_getaddrinfo.3
 mode change 100755 => 100644 man/rdma_join_multicast.3
 mode change 100755 => 100644 man/rdma_notify.3
 create mode 100644 src/.gitignore
 mode change 100755 => 100644 src/acm.c
 mode change 100755 => 100644 src/addrinfo.c
 mode change 100755 => 100644 src/cma.c

-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH librdmacm 1/8] Add "foreign" option to AM_INIT_AUTOMAKE
       [not found] ` <cover.1374011243.git.ydroneaud-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org>
@ 2013-07-16 21:59   ` Yann Droneaud
  2013-07-16 21:59   ` [PATCH librdmacm 2/8] Makefile.am: Fix an automake warning Yann Droneaud
                     ` (6 subsequent siblings)
  7 siblings, 0 replies; 14+ messages in thread
From: Yann Droneaud @ 2013-07-16 21:59 UTC (permalink / raw)
  To: Sean Hefty, linux-rdma-u79uwXL29TY76Z2rM5mHXA
  Cc: Bart Van Assche, Yann Droneaud

From: Bart Van Assche <bvanassche-HInyCGIudOg@public.gmane.org>

Switch to the modern form of the AM_INIT_AUTOMAKE macro and tell
automake that the librdmacm package does not follow the GNU
standards. This change makes it possible to use 'autoreconf' for the
librdmacm package.

Signed-off-by: Bart Van Assche <bvanassche-HInyCGIudOg@public.gmane.org>
Signed-off-by: Yann Droneaud <ydroneaud-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org>
---
 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 35d79dd..20c2f94 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6,7 +6,7 @@ AC_CONFIG_SRCDIR([src/cma.c])
 AC_CONFIG_AUX_DIR(config)
 AC_CONFIG_MACRO_DIR(config)
 AC_CONFIG_HEADERS(config.h)
-AM_INIT_AUTOMAKE(librdmacm, 1.0.17)
+AM_INIT_AUTOMAKE([foreign])
 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
 
 AM_PROG_LIBTOOL
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH librdmacm 2/8] Makefile.am: Fix an automake warning
       [not found] ` <cover.1374011243.git.ydroneaud-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org>
  2013-07-16 21:59   ` [PATCH librdmacm 1/8] Add "foreign" option to AM_INIT_AUTOMAKE Yann Droneaud
@ 2013-07-16 21:59   ` Yann Droneaud
  2013-07-16 21:59   ` [PATCH librdmacm 3/8] autogen.sh: Use autoreconf in autogen.sh Yann Droneaud
                     ` (5 subsequent siblings)
  7 siblings, 0 replies; 14+ messages in thread
From: Yann Droneaud @ 2013-07-16 21:59 UTC (permalink / raw)
  To: Sean Hefty, linux-rdma-u79uwXL29TY76Z2rM5mHXA
  Cc: Bart Van Assche, Yann Droneaud

From: Bart Van Assche <bvanassche-HInyCGIudOg@public.gmane.org>

Fix the following automake warning message:

    Makefile.am:1: `INCLUDES' is the old name for `AM_CPPFLAGS' (or `*_CPPFLAGS')

A quote from the automake manual:

    INCLUDES
        This does the same job as AM_CPPFLAGS (or any per-target _CPPFLAGS variable
        if it is used). It is an older name for the same functionality. This
        variable is deprecated; we suggest using AM_CPPFLAGS and per-target
        _CPPFLAGS instead.

Signed-off-by: Bart Van Assche <bvanassche-HInyCGIudOg@public.gmane.org>
Signed-off-by: Yann Droneaud <ydroneaud-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org>
---
 Makefile.am | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index 3198165..e1be9f3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,4 @@
-INCLUDES = -I$(srcdir)/include
+AM_CPPFLAGS = -I$(srcdir)/include
 
 rslibdir = $(libdir)/rsocket
 lib_LTLIBRARIES = src/librdmacm.la
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH librdmacm 3/8] autogen.sh: Use autoreconf in autogen.sh
       [not found] ` <cover.1374011243.git.ydroneaud-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org>
  2013-07-16 21:59   ` [PATCH librdmacm 1/8] Add "foreign" option to AM_INIT_AUTOMAKE Yann Droneaud
  2013-07-16 21:59   ` [PATCH librdmacm 2/8] Makefile.am: Fix an automake warning Yann Droneaud
@ 2013-07-16 21:59   ` Yann Droneaud
       [not found]     ` <317ae98daf0eec49ffb297a5fc59b3738366af6d.1374011243.git.ydroneaud-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org>
  2013-07-16 21:59   ` [PATCH librdmacm 4/8] configure: Apply updates proposed by autoupdate Yann Droneaud
                     ` (4 subsequent siblings)
  7 siblings, 1 reply; 14+ messages in thread
From: Yann Droneaud @ 2013-07-16 21:59 UTC (permalink / raw)
  To: Sean Hefty, linux-rdma-u79uwXL29TY76Z2rM5mHXA; +Cc: Jeff Squyres, Yann Droneaud

From: Jeff Squyres <jsquyres-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org>

The old sequence of Autotools commands listed in autogen.sh is no
longer correct.  Instead, just use the single "autoreconf" command,
which will invoke all the Right Autotools commands in the correct
order.

Signed-off-by: Jeff Squyres <jsquyres-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Yann Droneaud <ydroneaud-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org>
---
 autogen.sh | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/autogen.sh b/autogen.sh
index f433312..6c9233e 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -1,9 +1,4 @@
 #! /bin/sh
 
 set -x
-test -d ./config || mkdir ./config
-aclocal -I config
-libtoolize --force --copy
-autoheader
-automake --foreign --add-missing --copy
-autoconf
+autoreconf -ifv -I config
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH librdmacm 4/8] configure: Apply updates proposed by autoupdate
       [not found] ` <cover.1374011243.git.ydroneaud-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org>
                     ` (2 preceding siblings ...)
  2013-07-16 21:59   ` [PATCH librdmacm 3/8] autogen.sh: Use autoreconf in autogen.sh Yann Droneaud
@ 2013-07-16 21:59   ` Yann Droneaud
  2013-07-16 21:59   ` [PATCH librdmacm 5/8] configure: Use automake's option "subdir-objects" Yann Droneaud
                     ` (3 subsequent siblings)
  7 siblings, 0 replies; 14+ messages in thread
From: Yann Droneaud @ 2013-07-16 21:59 UTC (permalink / raw)
  To: Sean Hefty, linux-rdma-u79uwXL29TY76Z2rM5mHXA; +Cc: Yann Droneaud

'autoupdate' is a tool to help developer to update configure.ac.

This patch applies a few fixes as suggested by autoupdate.

Signed-off-by: Yann Droneaud <ydroneaud-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org>
---
 configure.ac | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/configure.ac b/configure.ac
index 20c2f94..a9e95c0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,18 +1,18 @@
 dnl Process this file with autoconf to produce a configure script.
 
-AC_PREREQ(2.57)
-AC_INIT(librdmacm, 1.0.17, linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org)
+AC_PREREQ([2.63])
+AC_INIT([librdmacm],[1.0.17],[linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org])
 AC_CONFIG_SRCDIR([src/cma.c])
 AC_CONFIG_AUX_DIR(config)
 AC_CONFIG_MACRO_DIR(config)
-AC_CONFIG_HEADERS(config.h)
+AC_CONFIG_HEADERS([config.h])
 AM_INIT_AUTOMAKE([foreign])
 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
 
-AM_PROG_LIBTOOL
+LT_INIT
 
 AC_ARG_WITH([valgrind],
-    AC_HELP_STRING([--with-valgrind],
+    AS_HELP_STRING([--with-valgrind],
 		   [Enable valgrind annotations - default NO]))
 
 if test "$with_valgrind" != "" && test "$with_valgrind" != "no"; then
@@ -50,8 +50,8 @@ AC_CHECK_MEMBER(struct ibv_path_record.service_id, [],
 
 dnl Check for gcc atomic intrinsics
 AC_MSG_CHECKING(compiler support for atomics)
-AC_TRY_LINK([int i = 0;],
-    [ return __sync_add_and_fetch(&i, 1) != __sync_sub_and_fetch(&i, 1); ],
+AC_LINK_IFELSE([AC_LANG_PROGRAM([[int i = 0;]],
+				[[ return __sync_add_and_fetch(&i, 1) != __sync_sub_and_fetch(&i, 1); ]])],
     [ AC_MSG_RESULT(yes) ],
     [
         AC_MSG_RESULT(no)
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH librdmacm 5/8] configure: Use automake's option "subdir-objects"
       [not found] ` <cover.1374011243.git.ydroneaud-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org>
                     ` (3 preceding siblings ...)
  2013-07-16 21:59   ` [PATCH librdmacm 4/8] configure: Apply updates proposed by autoupdate Yann Droneaud
@ 2013-07-16 21:59   ` Yann Droneaud
  2013-07-16 21:59   ` [PATCH librdmacm 6/8] Add .gitignore rules Yann Droneaud
                     ` (2 subsequent siblings)
  7 siblings, 0 replies; 14+ messages in thread
From: Yann Droneaud @ 2013-07-16 21:59 UTC (permalink / raw)
  To: Sean Hefty, linux-rdma-u79uwXL29TY76Z2rM5mHXA; +Cc: Yann Droneaud

Following advice in "Autotool Mythbuster" [1], option subdir-objects
can be used to have Makefiles create object files in the same
directory than theirs source files.

It reduces clobbering in the build directory.

[1] "Autotool Mythbuster", by Diego Elio "Flameeyes" Petten`o
http://www.flameeyes.eu/autotools-mythbuster/automake/nonrecursive.html

Signed-off-by: Yann Droneaud <ydroneaud-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org>
---
 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index a9e95c0..807470f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6,7 +6,7 @@ AC_CONFIG_SRCDIR([src/cma.c])
 AC_CONFIG_AUX_DIR(config)
 AC_CONFIG_MACRO_DIR(config)
 AC_CONFIG_HEADERS([config.h])
-AM_INIT_AUTOMAKE([foreign])
+AM_INIT_AUTOMAKE([foreign subdir-objects])
 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
 
 LT_INIT
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH librdmacm 6/8] Add .gitignore rules
       [not found] ` <cover.1374011243.git.ydroneaud-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org>
                     ` (4 preceding siblings ...)
  2013-07-16 21:59   ` [PATCH librdmacm 5/8] configure: Use automake's option "subdir-objects" Yann Droneaud
@ 2013-07-16 21:59   ` Yann Droneaud
  2013-07-16 21:59   ` [PATCH librdmacm 7/8] Remove executable mode bit on plain text files Yann Droneaud
  2013-07-16 21:59   ` [PATCH librdmacm 8/8] Open files with "close on exec" flag Yann Droneaud
  7 siblings, 0 replies; 14+ messages in thread
From: Yann Droneaud @ 2013-07-16 21:59 UTC (permalink / raw)
  To: Sean Hefty, linux-rdma-u79uwXL29TY76Z2rM5mHXA; +Cc: Yann Droneaud

Add the list of files/patterns to be exclueded from git status output.
Additionally it will prevent such files/patterns to be added and committed.

Signed-off-by: Yann Droneaud <ydroneaud-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org>
---
 .gitignore          | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 examples/.gitignore | 22 ++++++++++++++++++
 src/.gitignore      |  9 ++++++++
 3 files changed, 95 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 examples/.gitignore
 create mode 100644 src/.gitignore

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..cea1f71
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,64 @@
+# - see gitignore(5)
+#
+# http://www.kernel.org/pub/software/scm/git/docs/gitignore.html
+# http://git-scm.com/docs/gitignore.html
+#
+# - ignore files in this current directory with a leading /
+# so that files with the same name is a subdirectory
+# would not be ignored by mistake.
+#
+# per directory .gitignore would be used to ignore specific
+# files/patterns
+#
+# - more examples can be found at
+#
+# https://github.com/github/gitignore
+# http://git-scm.com/book/en/Git-Basics-Recording-Changes-to-the-Repository#Ignoring-Files
+#
+
+# global ignore rules:
+#
+# backup files
+#
+*~
+
+# local (eg. current directory) rules:
+#
+# /<pattern>
+
+#
+# files created by autoreconf (autoconf, automake, libtool)
+#
+
+/INSTALL
+/config.guess
+/config.sub
+/missing
+/depcomp
+/install-sh
+/configure
+/aclocal.m4
+/autom4te.cache/
+/config.h.in
+/Makefile.in
+/compile
+/config
+
+#
+# files created by autoscan
+#
+
+/autoscan.log
+/configure.scan
+
+#
+# files created by ./configure
+#
+
+/config.h
+/config.status
+/config.log
+/Makefile
+/stamp-h1
+/libtool
+/librdmacm.spec
diff --git a/examples/.gitignore b/examples/.gitignore
new file mode 100644
index 0000000..ed17494
--- /dev/null
+++ b/examples/.gitignore
@@ -0,0 +1,22 @@
+# files produced by ./configure
+/.deps
+
+# files produced by make (libtool)
+/*.o
+/*.lo
+/*.la
+/.libs
+/.dirstamp
+
+/mckey
+/rcopy
+/rdma_client
+/rdma_server
+/rdma_xclient
+/rdma_xserver
+/riostream
+/rping
+/rstream
+/ucmatose
+/udaddy
+/udpong
diff --git a/src/.gitignore b/src/.gitignore
new file mode 100644
index 0000000..139417a
--- /dev/null
+++ b/src/.gitignore
@@ -0,0 +1,9 @@
+# files produced by ./configure
+/.deps
+
+# files produced by make (libtool)
+/*.o
+/*.lo
+/*.la
+/.libs
+/.dirstamp
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH librdmacm 7/8] Remove executable mode bit on plain text files
       [not found] ` <cover.1374011243.git.ydroneaud-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org>
                     ` (5 preceding siblings ...)
  2013-07-16 21:59   ` [PATCH librdmacm 6/8] Add .gitignore rules Yann Droneaud
@ 2013-07-16 21:59   ` Yann Droneaud
  2013-07-16 21:59   ` [PATCH librdmacm 8/8] Open files with "close on exec" flag Yann Droneaud
  7 siblings, 0 replies; 14+ messages in thread
From: Yann Droneaud @ 2013-07-16 21:59 UTC (permalink / raw)
  To: Sean Hefty, linux-rdma-u79uwXL29TY76Z2rM5mHXA; +Cc: Yann Droneaud

Source code and man page should not be executable.

Signed-off-by: Yann Droneaud <ydroneaud-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org>
---
 include/rdma/rdma_cma.h   | 0
 man/rdma_accept.3         | 0
 man/rdma_connect.3        | 0
 man/rdma_create_qp.3      | 0
 man/rdma_getaddrinfo.3    | 0
 man/rdma_join_multicast.3 | 0
 man/rdma_notify.3         | 0
 src/acm.c                 | 0
 src/addrinfo.c            | 0
 src/cma.c                 | 0
 10 files changed, 0 insertions(+), 0 deletions(-)
 mode change 100755 => 100644 include/rdma/rdma_cma.h
 mode change 100755 => 100644 man/rdma_accept.3
 mode change 100755 => 100644 man/rdma_connect.3
 mode change 100755 => 100644 man/rdma_create_qp.3
 mode change 100755 => 100644 man/rdma_getaddrinfo.3
 mode change 100755 => 100644 man/rdma_join_multicast.3
 mode change 100755 => 100644 man/rdma_notify.3
 mode change 100755 => 100644 src/acm.c
 mode change 100755 => 100644 src/addrinfo.c
 mode change 100755 => 100644 src/cma.c

diff --git a/include/rdma/rdma_cma.h b/include/rdma/rdma_cma.h
old mode 100755
new mode 100644
diff --git a/man/rdma_accept.3 b/man/rdma_accept.3
old mode 100755
new mode 100644
diff --git a/man/rdma_connect.3 b/man/rdma_connect.3
old mode 100755
new mode 100644
diff --git a/man/rdma_create_qp.3 b/man/rdma_create_qp.3
old mode 100755
new mode 100644
diff --git a/man/rdma_getaddrinfo.3 b/man/rdma_getaddrinfo.3
old mode 100755
new mode 100644
diff --git a/man/rdma_join_multicast.3 b/man/rdma_join_multicast.3
old mode 100755
new mode 100644
diff --git a/man/rdma_notify.3 b/man/rdma_notify.3
old mode 100755
new mode 100644
diff --git a/src/acm.c b/src/acm.c
old mode 100755
new mode 100644
diff --git a/src/addrinfo.c b/src/addrinfo.c
old mode 100755
new mode 100644
diff --git a/src/cma.c b/src/cma.c
old mode 100755
new mode 100644
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH librdmacm 8/8] Open files with "close on exec" flag
       [not found] ` <cover.1374011243.git.ydroneaud-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org>
                     ` (6 preceding siblings ...)
  2013-07-16 21:59   ` [PATCH librdmacm 7/8] Remove executable mode bit on plain text files Yann Droneaud
@ 2013-07-16 21:59   ` Yann Droneaud
  7 siblings, 0 replies; 14+ messages in thread
From: Yann Droneaud @ 2013-07-16 21:59 UTC (permalink / raw)
  To: Sean Hefty, linux-rdma-u79uwXL29TY76Z2rM5mHXA; +Cc: Yann Droneaud

File opened by librdmacm are not supposed to be inherited across
exec*(), most of the files are of no use for another program, and
others cannot be used without the associated memory mapping.

This patch changes fopen() open() and socket() to always set
close on exec flag.

This patch also add checks to configure to guess if fopen() supports
"e" flag. If O_CLOEXEC and SOCK_CLOEXEC are supported, fopen() should
support "e". If not supported, its discarded according to POSIX. Many
operating systems have support for fopen("e").

You might find more information about close on exec in the following articles:

- "Excuse me son, but your code is leaking !!!" by Dan Walsh
  http://danwalsh.livejournal.com/53603.html

- "Secure File Descriptor Handling" by Ulrich Drepper
  http://udrepper.livejournal.com/20407.html

Note: this patch won't set close on exec flag on file descriptors
created by the kernel for completion channel and such.
This is addressed by another kernel patch.

Signed-off-by: Yann Droneaud <ydroneaud-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org>
---
 configure.ac | 24 ++++++++++++++++++++++++
 src/acm.c    |  4 ++--
 src/cma.c    |  2 +-
 3 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 807470f..31b1a0e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -78,6 +78,30 @@ AC_CHECK_HEADER(infiniband/acm.h,
 		AC_DEFINE(DEFINE_ACM_MSG, 1, [adding ACM message definition]),
 			[#include <infiniband/acm.h>]), [])
 
+dnl Checks close on exec support
+AC_CHECK_HEADERS([fcntl.h sys/socket.h])
+
+AC_CHECK_DECLS([O_CLOEXEC],,[AC_DEFINE([O_CLOEXEC],[0], [Defined to 0 if not provided])],
+[[
+#ifdef HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+]])
+AC_CHECK_DECLS([SOCK_CLOEXEC],,[AC_DEFINE([SOCK_CLOEXEC],[0],[Defined to 0 if not provided])],
+[[
+#ifdef HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
+#endif
+]])
+
+AC_CACHE_CHECK(for close on exec modifier for fopen(), ac_cv_feature_stream_cloexec_flag,
+   [if test $ac_cv_have_decl_O_CLOEXEC = yes ; then
+        if test $ac_cv_have_decl_SOCK_CLOEXEC = yes ; then
+            ac_cv_feature_stream_cloexec_flag="e"
+        fi
+    fi])
+AC_DEFINE_UNQUOTED([STREAM_CLOEXEC], "$ac_cv_feature_stream_cloexec_flag", [fopen() modifier for setting close on exec flag])
+
 AC_CACHE_CHECK(whether ld accepts --version-script, ac_cv_version_script,
     if test -n "`$LD --help < /dev/null 2>/dev/null | grep version-script`"; then
         ac_cv_version_script=yes
diff --git a/src/acm.c b/src/acm.c
index c9ca5b5..6e8e173 100644
--- a/src/acm.c
+++ b/src/acm.c
@@ -80,7 +80,7 @@ static int ucma_set_server_port(void)
 {
 	FILE *f;
 
-	if ((f = fopen("/var/run/ibacm.port", "r"))) {
+	if ((f = fopen("/var/run/ibacm.port", "r" STREAM_CLOEXEC))) {
 		fscanf(f, "%hu", (unsigned short *) &server_port);
 		fclose(f);
 	}
@@ -100,7 +100,7 @@ void ucma_ib_init(void)
 	if (!ucma_set_server_port())
 		goto out;
 
-	sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
+	sock = socket(AF_INET, SOCK_STREAM | SOCK_CLOEXEC, IPPROTO_TCP);
 	if (sock < 0)
 		goto out;
 
diff --git a/src/cma.c b/src/cma.c
index 2fb9913..baebecd 100644
--- a/src/cma.c
+++ b/src/cma.c
@@ -328,7 +328,7 @@ struct rdma_event_channel *rdma_create_event_channel(void)
 	if (!channel)
 		return NULL;
 
-	channel->fd = open("/dev/infiniband/rdma_cm", O_RDWR);
+	channel->fd = open("/dev/infiniband/rdma_cm", O_RDWR | O_CLOEXEC);
 	if (channel->fd < 0) {
 		fprintf(stderr, PFX "Fatal: unable to open /dev/infiniband/rdma_cm\n");
 		goto err;
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* RE: [PATCH librdmacm 3/8] autogen.sh: Use autoreconf in autogen.sh
       [not found]     ` <317ae98daf0eec49ffb297a5fc59b3738366af6d.1374011243.git.ydroneaud-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org>
@ 2013-07-17  4:22       ` Hefty, Sean
       [not found]         ` <1828884A29C6694DAF28B7E6B8A82373805AECD6-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
  0 siblings, 1 reply; 14+ messages in thread
From: Hefty, Sean @ 2013-07-17  4:22 UTC (permalink / raw)
  To: Yann Droneaud, linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
  Cc: Jeff Squyres

Thanks - I pulled in these patches, but see below:

> diff --git a/autogen.sh b/autogen.sh
> index f433312..6c9233e 100755
> --- a/autogen.sh
> +++ b/autogen.sh
> @@ -1,9 +1,4 @@
>  #! /bin/sh
> 
>  set -x
> -test -d ./config || mkdir ./config

Without the above line, the build fails.  I added it back in.  If there's some other way of ensuring that this directory exists, please let me know.

- Sean

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 14+ messages in thread

* RE: [PATCH librdmacm 3/8] autogen.sh: Use autoreconf in autogen.sh
       [not found]         ` <1828884A29C6694DAF28B7E6B8A82373805AECD6-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
@ 2013-07-17  6:21           ` Yann Droneaud
  2013-07-17  6:58           ` Or Gerlitz
  1 sibling, 0 replies; 14+ messages in thread
From: Yann Droneaud @ 2013-07-17  6:21 UTC (permalink / raw)
  To: Hefty, Sean; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Jeff Squyres

Hi,

Le 17.07.2013 06:22, Hefty, Sean a écrit :
> Thanks - I pulled in these patches, but see below:
> 

Thanks.

>> diff --git a/autogen.sh b/autogen.sh
>> index f433312..6c9233e 100755
>> --- a/autogen.sh
>> +++ b/autogen.sh
>> @@ -1,9 +1,4 @@
>>  #! /bin/sh
>> 
>>  set -x
>> -test -d ./config || mkdir ./config
> 
> Without the above line, the build fails.  I added it back in.  If
> there's some other way of ensuring that this directory exists, please
> let me know.
> 

Sorry for the inconvenience.

I've checked libibverbs: it has a .gitignore in ./config so that git 
kept the empty directory.

It's a different solution for the same problem, I'm not able to say if 
it's a better one.

Regards.

-- 
Yann Droneaud
OPTEYA

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH librdmacm 3/8] autogen.sh: Use autoreconf in autogen.sh
       [not found]         ` <1828884A29C6694DAF28B7E6B8A82373805AECD6-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
  2013-07-17  6:21           ` Yann Droneaud
@ 2013-07-17  6:58           ` Or Gerlitz
       [not found]             ` <51E640A6.9070902-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
  1 sibling, 1 reply; 14+ messages in thread
From: Or Gerlitz @ 2013-07-17  6:58 UTC (permalink / raw)
  To: Hefty, Sean
  Cc: Yann Droneaud, linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Jeff Squyres

On 17/07/2013 07:22, Hefty, Sean wrote:
> Thanks - I pulled in these patches, but see below:

Hi Sean,

If you do this house cleanup, could you also address the below build 
warnings. I can see them
when I build rpm from the 1.0.17 tar ball, but not when doing plain make 
on the latest git, probably
b/c the build through the spec uses some more build/warnings flags.

Or.


configure: creating ./config.status
config.status: creating Makefile
config.status: creating librdmacm.spec
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands
+ make -j2
make  all-am
make[1]: Entering directory `/usr/src/redhat/BUILD/librdmacm-1.0.17'
   CC     src_librdmacm_la-cma.lo
   CC     src_librdmacm_la-addrinfo.lo
src/addrinfo.c: In function 'ucma_convert_to_rai':
src/addrinfo.c:193: warning: dereferencing type-punned pointer will 
break strict-aliasing rules
src/addrinfo.c:210: warning: dereferencing type-punned pointer will 
break strict-aliasing rules
   CC     src_librdmacm_la-acm.lo
   CC     src_librdmacm_la-rsocket.lo
src/rsocket.c: In function 'rs_modify_svcs':
src/rsocket.c:403: warning: ignoring return value of 'write', declared 
with attribute warn_unused_result
src/rsocket.c:404: warning: ignoring return value of 'read', declared 
with attribute warn_unused_result
src/rsocket.c: In function 'rs_configure':
src/rsocket.c:460: warning: ignoring return value of 'fscanf', declared 
with attribute warn_unused_result
src/rsocket.c:465: warning: ignoring return value of 'fscanf', declared 
with attribute warn_unused_result
src/rsocket.c:473: warning: ignoring return value of 'fscanf', declared 
with attribute warn_unused_result
src/rsocket.c:478: warning: ignoring return value of 'fscanf', declared 
with attribute warn_unused_result
src/rsocket.c:483: warning: ignoring return value of 'fscanf', declared 
with attribute warn_unused_result
src/rsocket.c:491: warning: ignoring return value of 'fscanf', declared 
with attribute warn_unused_result
src/rsocket.c:498: warning: ignoring return value of 'fscanf', declared 
with attribute warn_unused_result
src/rsocket.c: In function 'rs_svc_process_sock':
src/rsocket.c:3623: warning: ignoring return value of 'read', declared 
with attribute warn_unused_result
src/rsocket.c:3632: warning: ignoring return value of 'write', declared 
with attribute warn_unused_result
src/rsocket.c: In function 'rs_svc_run':
src/rsocket.c:3805: warning: ignoring return value of 'write', declared 
with attribute warn_unused_result
src/rsocket.c: In function 'ds_get_dest':
src/rsocket.c:1451: warning: 'qp' may be used uninitialized in this function
src/rsocket.c: In function 'rs_send_iomaps':
src/rsocket.c:2305: warning: 'ret' may be used uninitialized in this 
function
   CC     src_librdmacm_la-indexer.lo
   CC     src_librspreload_la-preload.lo
src/preload.c: In function 'dup2':
src/preload.c:1020: warning: value computed is not used
   CC     src_librspreload_la-indexer.lo
   CC     cmatose.o
   CC     common.o
   CC     rping.o
   CC     udaddy.o
   CC     mckey.o
   CC     rdma_client.o
   CC     rdma_server.o
   CC     rdma_xclient.o
   CC     rdma_xserver.o
   CC     rstream.o
   CC     rcopy.o
   CC     riostream.o
   CC     udpong.o
   CCLD   src/librdmacm.la
   CCLD   src/librspreload.la
   CCLD   examples/ucmatose
   CCLD   examples/rping
   CCLD   examples/udaddy
   CCLD   examples/mckey
   CCLD   examples/rdma_client
   CCLD   examples/rdma_server
   CCLD   examples/rdma_xclient
   CCLD   examples/rdma_xserver
   CCLD   examples/rstream
   CCLD   examples/rcopy
   CCLD   examples/riostream
   CCLD   examples/udpong
make[1]: Leaving directory `/usr/src/redhat/BUILD/librdmacm-1.0.17'
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.10929

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH librdmacm 3/8] autogen.sh: Use autoreconf in autogen.sh
       [not found]             ` <51E640A6.9070902-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
@ 2013-07-31  6:58               ` Or Gerlitz
       [not found]                 ` <51F8B5B1.3010003-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 14+ messages in thread
From: Or Gerlitz @ 2013-07-31  6:58 UTC (permalink / raw)
  To: Hefty, Sean
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Bart Van Assche

On 17/07/2013 09:58, Or Gerlitz wrote:
> On 17/07/2013 07:22, Hefty, Sean wrote:
>> Thanks - I pulled in these patches, but see below:
>
> Hi Sean,
>
> If you do this house cleanup, could you also address the below build 
> warnings. I can see them
> when I build rpm from the 1.0.17 tar ball, but not when doing plain 
> make on the latest git, probably
> b/c the build through the spec uses some more build/warnings flags.
>
>

Hi Sean,

Did you had the chance to look on cleaning these warnings too? I don't 
think its the one Bart was fixing, correct?

Or.

>
> configure: creating ./config.status
> config.status: creating Makefile
> config.status: creating librdmacm.spec
> config.status: creating config.h
> config.status: executing depfiles commands
> config.status: executing libtool commands
> + make -j2
> make  all-am
> make[1]: Entering directory `/usr/src/redhat/BUILD/librdmacm-1.0.17'
>   CC     src_librdmacm_la-cma.lo
>   CC     src_librdmacm_la-addrinfo.lo
> src/addrinfo.c: In function 'ucma_convert_to_rai':
> src/addrinfo.c:193: warning: dereferencing type-punned pointer will 
> break strict-aliasing rules
> src/addrinfo.c:210: warning: dereferencing type-punned pointer will 
> break strict-aliasing rules
>   CC     src_librdmacm_la-acm.lo
>   CC     src_librdmacm_la-rsocket.lo
> src/rsocket.c: In function 'rs_modify_svcs':
> src/rsocket.c:403: warning: ignoring return value of 'write', declared 
> with attribute warn_unused_result
> src/rsocket.c:404: warning: ignoring return value of 'read', declared 
> with attribute warn_unused_result
> src/rsocket.c: In function 'rs_configure':
> src/rsocket.c:460: warning: ignoring return value of 'fscanf', 
> declared with attribute warn_unused_result
> src/rsocket.c:465: warning: ignoring return value of 'fscanf', 
> declared with attribute warn_unused_result
> src/rsocket.c:473: warning: ignoring return value of 'fscanf', 
> declared with attribute warn_unused_result
> src/rsocket.c:478: warning: ignoring return value of 'fscanf', 
> declared with attribute warn_unused_result
> src/rsocket.c:483: warning: ignoring return value of 'fscanf', 
> declared with attribute warn_unused_result
> src/rsocket.c:491: warning: ignoring return value of 'fscanf', 
> declared with attribute warn_unused_result
> src/rsocket.c:498: warning: ignoring return value of 'fscanf', 
> declared with attribute warn_unused_result
> src/rsocket.c: In function 'rs_svc_process_sock':
> src/rsocket.c:3623: warning: ignoring return value of 'read', declared 
> with attribute warn_unused_result
> src/rsocket.c:3632: warning: ignoring return value of 'write', 
> declared with attribute warn_unused_result
> src/rsocket.c: In function 'rs_svc_run':
> src/rsocket.c:3805: warning: ignoring return value of 'write', 
> declared with attribute warn_unused_result
> src/rsocket.c: In function 'ds_get_dest':
> src/rsocket.c:1451: warning: 'qp' may be used uninitialized in this 
> function
> src/rsocket.c: In function 'rs_send_iomaps':
> src/rsocket.c:2305: warning: 'ret' may be used uninitialized in this 
> function
>   CC     src_librdmacm_la-indexer.lo
>   CC     src_librspreload_la-preload.lo
> src/preload.c: In function 'dup2':
> src/preload.c:1020: warning: value computed is not used
>   CC     src_librspreload_la-indexer.lo
>   CC     cmatose.o
>   CC     common.o
>   CC     rping.o
>   CC     udaddy.o
>   CC     mckey.o
>   CC     rdma_client.o
>   CC     rdma_server.o
>   CC     rdma_xclient.o
>   CC     rdma_xserver.o
>   CC     rstream.o
>   CC     rcopy.o
>   CC     riostream.o
>   CC     udpong.o
>   CCLD   src/librdmacm.la
>   CCLD   src/librspreload.la
>   CCLD   examples/ucmatose
>   CCLD   examples/rping
>   CCLD   examples/udaddy
>   CCLD   examples/mckey
>   CCLD   examples/rdma_client
>   CCLD   examples/rdma_server
>   CCLD   examples/rdma_xclient
>   CCLD   examples/rdma_xserver
>   CCLD   examples/rstream
>   CCLD   examples/rcopy
>   CCLD   examples/riostream
>   CCLD   examples/udpong
> make[1]: Leaving directory `/usr/src/redhat/BUILD/librdmacm-1.0.17'
> + exit 0
> Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.10929
>
> -- 
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 14+ messages in thread

* RE: [PATCH librdmacm 3/8] autogen.sh: Use autoreconf in autogen.sh
       [not found]                 ` <51F8B5B1.3010003-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
@ 2013-07-31 20:20                   ` Hefty, Sean
  0 siblings, 0 replies; 14+ messages in thread
From: Hefty, Sean @ 2013-07-31 20:20 UTC (permalink / raw)
  To: Or Gerlitz
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Bart Van Assche

> Did you had the chance to look on cleaning these warnings too? I don't
> think its the one Bart was fixing, correct?

I have not.  I saved your email, but have not had time to try fixing the warnings.

- Sean
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2013-07-31 20:20 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-16 21:59 [PATCH librdmacm 0/8] librdmacm "synchronisation" against libibverbs Yann Droneaud
     [not found] ` <cover.1374011243.git.ydroneaud-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org>
2013-07-16 21:59   ` [PATCH librdmacm 1/8] Add "foreign" option to AM_INIT_AUTOMAKE Yann Droneaud
2013-07-16 21:59   ` [PATCH librdmacm 2/8] Makefile.am: Fix an automake warning Yann Droneaud
2013-07-16 21:59   ` [PATCH librdmacm 3/8] autogen.sh: Use autoreconf in autogen.sh Yann Droneaud
     [not found]     ` <317ae98daf0eec49ffb297a5fc59b3738366af6d.1374011243.git.ydroneaud-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org>
2013-07-17  4:22       ` Hefty, Sean
     [not found]         ` <1828884A29C6694DAF28B7E6B8A82373805AECD6-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2013-07-17  6:21           ` Yann Droneaud
2013-07-17  6:58           ` Or Gerlitz
     [not found]             ` <51E640A6.9070902-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2013-07-31  6:58               ` Or Gerlitz
     [not found]                 ` <51F8B5B1.3010003-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2013-07-31 20:20                   ` Hefty, Sean
2013-07-16 21:59   ` [PATCH librdmacm 4/8] configure: Apply updates proposed by autoupdate Yann Droneaud
2013-07-16 21:59   ` [PATCH librdmacm 5/8] configure: Use automake's option "subdir-objects" Yann Droneaud
2013-07-16 21:59   ` [PATCH librdmacm 6/8] Add .gitignore rules Yann Droneaud
2013-07-16 21:59   ` [PATCH librdmacm 7/8] Remove executable mode bit on plain text files Yann Droneaud
2013-07-16 21:59   ` [PATCH librdmacm 8/8] Open files with "close on exec" flag Yann Droneaud

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox