[hwloc-devel] Create success (hwloc git 1.7.2-26-gaaaf369)

2014-04-23 Thread MPI Team
Creating nightly hwloc snapshot git tarball was a success.

Snapshot:   hwloc 1.7.2-26-gaaaf369
Start time: Wed Apr 23 21:03:25 EDT 2014
End time:   Wed Apr 23 21:05:43 EDT 2014

Your friendly daemon,
Cyrador


[hwloc-devel] Create success (hwloc git dev-156-g7489287)

2014-04-23 Thread MPI Team
Creating nightly hwloc snapshot git tarball was a success.

Snapshot:   hwloc dev-156-g7489287
Start time: Wed Apr 23 21:01:01 EDT 2014
End time:   Wed Apr 23 21:03:24 EDT 2014

Your friendly daemon,
Cyrador


Re: [hwloc-devel] PATCH: Mark fd as close-on-exec

2014-04-23 Thread Paul Hargrove
On Wed, Apr 23, 2014 at 4:14 PM, Brice Goglin  wrote:

> This code is only built on Linux


Yes, of course!
I neglected to look at the name of the file in question.

No guard is needed for even my oldest Linux systems.

-Paul

-- 
Paul H. Hargrove  phhargr...@lbl.gov
Future Technologies Group
Computer and Data Sciences Department Tel: +1-510-495-2352
Lawrence Berkeley National Laboratory Fax: +1-510-486-6900


Re: [hwloc-devel] PATCH: Mark fd as close-on-exec

2014-04-23 Thread Brice Goglin
This code is only built on Linux so I am not sure we're more portable than OMPI 
here. The oldest Linux we've tested bwloc on is likely your machines ;)
Brice


On 24 avril 2014 00:48:46 UTC+02:00, Paul Hargrove  wrote:
>Since I suspect hwloc may run on *more* platforms than ompi, I'd
>recommend
>the guards.
>The X11 sources actually go as far as the following (Stevens notes that
>older systems used '1' before FD_CLOEXEC was specified).
>
>#ifdef F_SETFD
>#ifdef FD_CLOEXEC
>ret = fcntl (fd, F_SETFD, FD_CLOEXEC);
>#else
>ret = fcntl (fd, F_SETFD, 1);
>#endif /* FD_CLOEXEC */
>#endif /* F_SETFD */
>
>-Paul
>
>
>On Wed, Apr 23, 2014 at 3:07 PM, Jeff Squyres (jsquyres)
>> wrote:
>
>> Actually, I just checked around: we have some unprotected FD_CLOEXEC
>code
>> in OMPI was that committed 2010-08-24 that has never caused a
>problem.
>>
>> So I'm not thinking it should be necessary here, either.
>>
>>
>> On Apr 23, 2014, at 5:55 PM, Jeff Squyres (jsquyres)
>
>> wrote:
>>
>> > Will do.
>> >
>> > On Apr 23, 2014, at 5:52 PM, Samuel Thibault
>
>> wrote:
>> >
>> >> Jeff Squyres (jsquyres), le Wed 23 Apr 2014 21:05:55 +, a
>écrit :
>> >>> Any objections to this patch?  In OMPI, we're seeing this fd leak
>into
>> child processes.
>> >>>
>> >>> diff --git a/src/topology-linux.c b/src/topology-linux.c
>> >>> index e934d4c..8c5fba1 100644
>> >>> --- a/src/topology-linux.c
>> >>> +++ b/src/topology-linux.c
>> >>> @@ -4601,6 +4601,13 @@ hwloc_linux_component_instantiate(struct
>> hwloc_disc_compo
>> >>>data->is_real_fsroot = 0;
>> >>>  }
>> >>>
>> >>
>> >> We probably want an #ifdef FD_CLOEXEC here, not all systems have
>it.
>> >>
>> >>> +  /* Since this fd stays open after hwloc returns, mark it as
>> >>> + close-on-exec so that children don't inherit it */
>> >>> +  if (fcntl(root, F_SETFD, FD_CLOEXEC) == -1) {
>> >>> +  close(root);
>> >>> +  root = -1;
>> >>> +  goto out_with_data;
>> >>> +  }
>> >>> #else
>> >>>  if (strcmp(fsroot_path, "/")) {
>> >>>errno = ENOSYS;
>> >>>
>> >>> --
>> >>> Jeff Squyres
>> >>> jsquy...@cisco.com
>> >>> For corporate legal information go to:
>> http://www.cisco.com/web/about/doing_business/legal/cri/
>> >>>
>> >>> ___
>> >>> hwloc-devel mailing list
>> >>> hwloc-de...@open-mpi.org
>> >>> http://www.open-mpi.org/mailman/listinfo.cgi/hwloc-devel
>> >>>
>> >>
>> >> --
>> >> Samuel
>> >> Je suis maintenant possesseur d'un ordinateur portable Compaq
>Armada
>> >> 1592DT avec port infra-rouge. Auriez-vous connaissance de
>programmes
>> >> suceptibles d'utiliser ce port afin de servir de télécommande ?
>> >> -+- JN in NPC : ben quoi, c'est pas à ça que ça sert ?
>> >> ___
>> >> hwloc-devel mailing list
>> >> hwloc-de...@open-mpi.org
>> >> http://www.open-mpi.org/mailman/listinfo.cgi/hwloc-devel
>> >
>> >
>> > --
>> > Jeff Squyres
>> > jsquy...@cisco.com
>> > For corporate legal information go to:
>> http://www.cisco.com/web/about/doing_business/legal/cri/
>> >
>> > ___
>> > hwloc-devel mailing list
>> > hwloc-de...@open-mpi.org
>> > http://www.open-mpi.org/mailman/listinfo.cgi/hwloc-devel
>>
>>
>> --
>> Jeff Squyres
>> jsquy...@cisco.com
>> For corporate legal information go to:
>> http://www.cisco.com/web/about/doing_business/legal/cri/
>>
>> ___
>> hwloc-devel mailing list
>> hwloc-de...@open-mpi.org
>> http://www.open-mpi.org/mailman/listinfo.cgi/hwloc-devel
>>
>
>
>
>-- 
>Paul H. Hargrove  phhargr...@lbl.gov
>Future Technologies Group
>Computer and Data Sciences Department Tel: +1-510-495-2352
>Lawrence Berkeley National Laboratory Fax: +1-510-486-6900
>
>
>
>
>___
>hwloc-devel mailing list
>hwloc-de...@open-mpi.org
>http://www.open-mpi.org/mailman/listinfo.cgi/hwloc-devel


Re: [hwloc-devel] PATCH: Mark fd as close-on-exec

2014-04-23 Thread Paul Hargrove
Currently, POSIX defines exactly one flag accessed via F_GETFD/F_SETFD and
that is FD_CLOEXEC.
However, it does not prohibit a conforming implementation from defining
additional bits.

So, a portable program should assume other bits may be set and try to
preserve them.

Quoting from section 3.14 of Steven's Advanced Programming in the UNIX
Environment:

When we modify either the file descriptor flags or the file status flags,
we must be
careful to fetch the existing value, modify it as desired, and then set the
new flag
value.  We can't simply issue an F_SETFD or F_SETFL command, as this could
turn
off flag bits that were previously set.

See also the example in
http://www.gnu.org/software/libc/manual/html_node/Descriptor-Flags.html

-Paul [Who always does what the late W. Richard Stevens says to.]


On Wed, Apr 23, 2014 at 3:11 PM, Jeff Squyres (jsquyres)  wrote:

> We opened the fd a few lines above with default flags -- is the addition
> GETFD necessary?
>
>
> https://github.com/open-mpi/hwloc/blob/master/src/topology-linux.c#L4595
>
>
> On Apr 23, 2014, at 6:04 PM, Paul Hargrove  wrote:
>
> > In order to preserve any existing flags, shouldn't this be more like:
> >   int prev;
> >   if ((-1 == (prev =  fcntl(root, F_GETFD, 0)) ||
> >   (-1 == fcntl(root, F_SETFD, FD_CLOEXEC | prev)))
> >
> >
> >
> >
> > On Wed, Apr 23, 2014 at 2:55 PM, Jeff Squyres (jsquyres) <
> jsquy...@cisco.com> wrote:
> > Will do.
> >
> > On Apr 23, 2014, at 5:52 PM, Samuel Thibault 
> wrote:
> >
> > > Jeff Squyres (jsquyres), le Wed 23 Apr 2014 21:05:55 +, a écrit :
> > >> Any objections to this patch?  In OMPI, we're seeing this fd leak
> into child processes.
> > >>
> > >> diff --git a/src/topology-linux.c b/src/topology-linux.c
> > >> index e934d4c..8c5fba1 100644
> > >> --- a/src/topology-linux.c
> > >> +++ b/src/topology-linux.c
> > >> @@ -4601,6 +4601,13 @@ hwloc_linux_component_instantiate(struct
> hwloc_disc_compo
> > >> data->is_real_fsroot = 0;
> > >>   }
> > >>
> > >
> > > We probably want an #ifdef FD_CLOEXEC here, not all systems have it.
> > >
> > >> +  /* Since this fd stays open after hwloc returns, mark it as
> > >> + close-on-exec so that children don't inherit it */
> > >> +  if (fcntl(root, F_SETFD, FD_CLOEXEC) == -1) {
> > >> +  close(root);
> > >> +  root = -1;
> > >> +  goto out_with_data;
> > >> +  }
> > >> #else
> > >>   if (strcmp(fsroot_path, "/")) {
> > >> errno = ENOSYS;
> > >>
> > >> --
> > >> Jeff Squyres
> > >> jsquy...@cisco.com
> > >> For corporate legal information go to:
> http://www.cisco.com/web/about/doing_business/legal/cri/
> > >>
> > >> ___
> > >> hwloc-devel mailing list
> > >> hwloc-de...@open-mpi.org
> > >> http://www.open-mpi.org/mailman/listinfo.cgi/hwloc-devel
> > >>
> > >
> > > --
> > > Samuel
> > > Je suis maintenant possesseur d'un ordinateur portable Compaq Armada
> > > 1592DT avec port infra-rouge. Auriez-vous connaissance de programmes
> > > suceptibles d'utiliser ce port afin de servir de télécommande ?
> > > -+- JN in NPC : ben quoi, c'est pas à ça que ça sert ?
> > > ___
> > > hwloc-devel mailing list
> > > hwloc-de...@open-mpi.org
> > > http://www.open-mpi.org/mailman/listinfo.cgi/hwloc-devel
> >
> >
> > --
> > Jeff Squyres
> > jsquy...@cisco.com
> > For corporate legal information go to:
> http://www.cisco.com/web/about/doing_business/legal/cri/
> >
> > ___
> > hwloc-devel mailing list
> > hwloc-de...@open-mpi.org
> > http://www.open-mpi.org/mailman/listinfo.cgi/hwloc-devel
> >
> >
> >
> > --
> > Paul H. Hargrove  phhargr...@lbl.gov
> > Future Technologies Group
> > Computer and Data Sciences Department Tel: +1-510-495-2352
> > Lawrence Berkeley National Laboratory Fax: +1-510-486-6900
> > ___
> > hwloc-devel mailing list
> > hwloc-de...@open-mpi.org
> > http://www.open-mpi.org/mailman/listinfo.cgi/hwloc-devel
>
>
> --
> Jeff Squyres
> jsquy...@cisco.com
> For corporate legal information go to:
> http://www.cisco.com/web/about/doing_business/legal/cri/
>
> ___
> hwloc-devel mailing list
> hwloc-de...@open-mpi.org
> http://www.open-mpi.org/mailman/listinfo.cgi/hwloc-devel
>



-- 
Paul H. Hargrove  phhargr...@lbl.gov
Future Technologies Group
Computer and Data Sciences Department Tel: +1-510-495-2352
Lawrence Berkeley National Laboratory Fax: +1-510-486-6900


[hwloc-devel] PATCH: Mark fd as close-on-exec

2014-04-23 Thread Jeff Squyres (jsquyres)
Any objections to this patch?  In OMPI, we're seeing this fd leak into child 
processes.

diff --git a/src/topology-linux.c b/src/topology-linux.c
index e934d4c..8c5fba1 100644
--- a/src/topology-linux.c
+++ b/src/topology-linux.c
@@ -4601,6 +4601,13 @@ hwloc_linux_component_instantiate(struct hwloc_disc_compo
 data->is_real_fsroot = 0;
   }
 
+  /* Since this fd stays open after hwloc returns, mark it as
+ close-on-exec so that children don't inherit it */
+  if (fcntl(root, F_SETFD, FD_CLOEXEC) == -1) {
+  close(root);
+  root = -1;
+  goto out_with_data;
+  }
 #else
   if (strcmp(fsroot_path, "/")) {
 errno = ENOSYS;

-- 
Jeff Squyres
jsquy...@cisco.com
For corporate legal information go to: 
http://www.cisco.com/web/about/doing_business/legal/cri/