idset_add(3)

SYNOPSIS

#include <flux/idset.h>

bool idset_equal (const struct idset *a,
                  const struct idset *b);

struct idset *idset_union (const struct idset *a,
                           const struct idset *b);

struct idset *idset_difference (const struct idset *a,
                                const struct idset *b);

struct idset *idset_intersect (const struct idset *a,
                               const struct idset *b);

int idset_add (struct idset *a, const struct idset *b);

int idset_subtract (struct idset *a, const struct idset *b);

bool idset_has_intersection (const struct idset *a,
                             const struct idset *b);

#define idset_clear_all (x) idset_subtract (x, x)

Link with -lflux-idset.

DESCRIPTION

Refer to idset_create(3) for a general description of idsets.

idset_equal() returns true if the two idset objects a and b are equal sets, i.e. the sets contain the same set of integers.

idset_union() creates a new idset that is the union of a and b.

idset_difference() creates a new idset that is a with the members of b removed.

idset_intersect() creates a new idset containing only members of a and b that are in both sets.

idset_add() adds the members of b to a.

idset_subtract() removes the members of b from a.

idset_has_intersection() tests whether a and b have any members in common.

idset_clear_all() removes all members of x.

RETURN VALUE

idset_union(), idset_difference(), and idset_intersect() return an idset on success which must be freed with idset_destroy(3). On error, NULL is returned with errno set.

idset_add(), idset_subtract(), and idset_clear_all() return 0 on success. On error, -1 is returned with errno set.

idset_equal() and idset_has_intersection() return true or false.

ERRORS

EINVAL

One or more arguments were invalid.

ENOMEM

Out of memory.

RESOURCES

Flux: http://flux-framework.org

Flux RFC: https://flux-framework.readthedocs.io/projects/flux-rfc

FLUX RFC

22/Idset String Representation

SEE ALSO

idset_create(3), idset_encode(3)