---
name: "hwloc_topology_insert_misc_object_by_parent"
section: "3"
platform: "linux"
package: "libhwloc-doc"
version: "1.11.12-3"
release: "Debian 10 (Buster)"
platforms: ["linux"]
url: "https://new.carta.tech/hwlocality_tinker"
---

# hwloc\_topology\_insert\_misc\_object\_by\_parent(3)

Part of [hwlocality\_tinker(3)](/hwlocality_tinker/3.md).

## NAME

hwlocality\_tinker

## SYNOPSIS

### Enumerations

enum **hwloc\_restrict\_flags\_e** { **HWLOC\_RESTRICT\_FLAG\_ADAPT\_DISTANCES**, **HWLOC\_RESTRICT\_FLAG\_ADAPT\_MISC**, **HWLOC\_RESTRICT\_FLAG\_ADAPT\_IO** }\

### Functions

**hwloc\_obj\_t** **hwloc\_topology\_insert\_misc\_object\_by\_cpuset** (**hwloc\_topology\_t** topology, **hwloc\_const\_cpuset\_t** cpuset, const char \*name)\
 **hwloc\_obj\_t** **hwloc\_topology\_insert\_misc\_object\_by\_parent** (**hwloc\_topology\_t** topology, **hwloc\_obj\_t** parent, const char \*name)\
 int **hwloc\_topology\_restrict** (**hwloc\_topology\_t** restrict topology, **hwloc\_const\_cpuset\_t** cpuset, unsigned long flags)\

## Detailed Description

## Enumeration Type Documentation

### enum hwloc\_restrict\_flags\_e

Flags to be given to **hwloc\_topology\_restrict()**.

**Enumerator**

- *HWLOC\_RESTRICT\_FLAG\_ADAPT\_DISTANCES*

  *Adapt distance matrices according to objects being removed during restriction. If this flag is not set, distance matrices are removed.*

- *HWLOC\_RESTRICT\_FLAG\_ADAPT\_MISC*

  *Move Misc objects to ancestors if their parents are removed during restriction. If this flag is not set, Misc objects are removed when their parents are removed.*

- *HWLOC\_RESTRICT\_FLAG\_ADAPT\_IO*

  *Move I/O objects to ancestors if their parents are removed during restriction. If this flag is not set, I/O devices and bridges are removed when their parents are removed.*

## Function Documentation

### hwloc\_obj\_t hwloc\_topology\_insert\_misc\_object\_by\_cpuset (hwloc\_topology\_t topology, hwloc\_const\_cpuset\_t cpuset, const char \* name)

*Add a MISC object to the topology. A new MISC object will be created and inserted into the topology at the position given by bitmap* `cpuset`*. This offers a way to add new intermediate levels to the topology hierarchy.*

`cpuset` *and* `name` *will be copied to setup the new object attributes.*

**Returns:**

*the newly-created object.*

`NULL` *if the insertion conflicts with the existing topology tree.*

**Note:**

*If* `name` *contains some non-printable characters, they will be dropped when exporting to XML, see* **hwloc\_topology\_export\_xml()***.*

### hwloc\_obj\_t hwloc\_topology\_insert\_misc\_object\_by\_parent (hwloc\_topology\_t topology, hwloc\_obj\_t parent, const char \* name)

*Add a MISC object as a leaf of the topology. A new MISC object will be created and inserted into the topology at the position given by parent. It is appended to the list of existing children, without ever adding any intermediate hierarchy level. This is useful for annotating the topology without actually changing the hierarchy.*

`name` *will be copied to the setup the new object attributes. However, the new leaf object will not have any* `cpuset`*.*

**Returns:**

*the newly-created object*

**Note:**

*If* `name` *contains some non-printable characters, they will be dropped when exporting to XML, see* **hwloc\_topology\_export\_xml()***.*

### int hwloc\_topology\_restrict (hwloc\_topology\_t restrict topology, hwloc\_const\_cpuset\_t cpuset, unsigned long flags)

*Restrict the topology to the given CPU set. Topology* `topology` *is modified so as to remove all objects that are not included (or partially included) in the CPU set* `cpuset`*. All objects CPU and node sets are restricted accordingly.*

`flags` *is a OR'ed set of* **hwloc\_restrict\_flags\_e***.*

**Note:**

*This call may not be reverted by restricting back to a larger cpuset. Once dropped during restriction, objects may not be brought back, except by loading another topology with* **hwloc\_topology\_load()***.*

**Returns:**

*0 on success.*

*-1 with errno set to EINVAL if the input cpuset is invalid. The topology is not modified in this case.*

*-1 with errno set to ENOMEM on failure to allocate internal data. The topology is reinitialized in this case. It should be either destroyed with* **hwloc\_topology\_destroy()** *or configured and loaded again.*

## Author

*Generated automatically by Doxygen for Hardware Locality (hwloc) from the source code.*
