1
1

hwloc: ensure that an internal fd is marked as close-on-exec

Make sure that an internal, long-lived hwloc fd is marked as
close-on-exec so that children don't inherit it.  This patch is
committed upstream in the hwloc master and v1.9 branches as 7489287
and b654e19, respectively.  The patch applied here is the exact same
logic, but the surrounding code changed slightly since the hwloc v1.7
series, so the patch doesn't apply cleanly.

Refs trac:4550

This commit was SVN r31511.

The following Trac tickets were found above:
  Ticket 4550 --> https://svn.open-mpi.org/trac/ompi/ticket/4550
Этот коммит содержится в:
Jeff Squyres 2014-04-23 21:36:38 +00:00
родитель 0cba0b95b8
Коммит 67bb0c261a
2 изменённых файлов: 13 добавлений и 1 удалений

Просмотреть файл

@ -4,3 +4,7 @@ the v1.7.2 release:
5198d4c Only include <malloc.h> if necessary
438d9ed linux/NUMA: Work around buggy NUMA node cpusets
Applied this from the upstream hwloc master, slightly modified for this
local version of v1.7 that we have:
7489287 topology-linux.c: ensure fd is marked as close-on-exec

Просмотреть файл

@ -2,7 +2,7 @@
* Copyright © 2009 CNRS
* Copyright © 2009-2014 Inria. All rights reserved.
* Copyright © 2009-2013 Université Bordeaux 1
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
* Copyright © 2009-2014 Cisco Systems, Inc. All rights reserved.
* Copyright © 2010 IBM
* See COPYING in top-level directory.
*/
@ -4323,6 +4323,14 @@ hwloc_linux_component_instantiate(struct hwloc_disc_component *component,
if (root < 0)
goto out_with_data;
/* 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;
}
if (strcmp(fsroot_path, "/"))
backend->is_thissystem = 0;