18.2.143. PMIx_Proc_info_create

PMIx_Proc_info_create — Allocate and initialize an array of pmix_proc_info_t(5) structures.

18.2.143.1. SYNOPSIS

#include <pmix.h>

pmix_proc_info_t* PMIx_Proc_info_create(size_t n);

18.2.143.1.1. Python Syntax

No Python equivalent

18.2.143.2. INPUT PARAMETERS

18.2.143.3. DESCRIPTION

Allocate a contiguous array of n pmix_proc_info_t structures on the heap and construct each element — zeroing the structure and setting state to PMIX_PROC_STATE_UNDEF — exactly as PMIx_Proc_info_construct(3) would.

The returned array is owned by the caller and must be released with PMIx_Proc_info_free(3), which destructs each element (freeing any hostname and executable_name strings) and frees the underlying storage.

18.2.143.4. RETURN VALUE

Returns a pointer to the newly allocated array of pmix_proc_info_t structures, or NULL if n is zero or the allocation fails.

18.2.143.5. NOTES

PMIx_Proc_info_create is an OpenPMIx convenience routine. The corresponding PMIX_PROC_INFO_CREATE macro assigns the returned pointer to its first argument and is implemented as a call to this function.

18.2.143.6. EXAMPLES

Allocate an array of proc info structures and release it when done:

pmix_proc_info_t *pinfo;
size_t ninfo = 2;

pinfo = PMIx_Proc_info_create(ninfo);

/* ... populate and use the array ... */

PMIx_Proc_info_free(pinfo, ninfo);