*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->Tru64 Unix man pages -> idismember (3)              
Title
Content
Arch
Section
 

idsetops(3)

Contents


NAME    [Toc]    [Back]

       idsetops,   idaddset,   idandset,  idcopyset,  idcountset,
       iddelset, iddiffset, idemptyset, idfillset,  idisemptyset,
       idismember, idorset, idsetcreate, idsetdestroy, idxorset -
       Perform operations on ID sets (libc library)

SYNOPSIS    [Toc]    [Back]

       #include <idset.h>

       int idaddset(
               idset_t set,
               idid_t member_id ); int idandset(
               idset_t set_src1,
               idset_t set_src2,
               idset_t set_dst ); int idcopyset(
               idset_t set_src,
               idset_t set_dst ); int idcountset(
               idset_t set ); int iddelset(
               idset_t set,
               idid_t member_id ); int iddiffset(
               idset_t set_src1,
               idset_t set_src2,
               idset_t set_dst ); int idemptyset(
               idset_t set ); int idfillset(
               idset_t set ); int idisemptyset(
               idset_t set ); int idismember(
               idset_t set,
               idid_t member_id ); int idorset(
               idset_t set_src1,
               idset_t set_src2,
               idset_t set_dst ); int idsetcreate(
               idset_t *set,
               int max_id_val ); int idsetdestroy(
               idset_t *set ); int idxorset(
               idset_t set_src1,
               idset_t set_src2,
               idset_t set_dst );

PARAMETERS    [Toc]    [Back]

       Specifies the largest member_id value.  Identifies a  member
  of  an  ID  set.   Specifies  or points to an ID set.
       Specifies an ID set that is being copied to or that is the
       result of a logical OR, XOR, or AND operation on two other
       ID sets.  Specifies a ID  set  that  is  being  copied  to
       another  ID  set  or that is part of a logical OR, XOR, or
       AND operation with another ID set.

DESCRIPTION    [Toc]    [Back]

       The ID set operation primitives manipulate sets of  member
       IDs  by  operating  on  objects (of type idset_t) that are
       created by idsetcreate(). Unlike a CPU  set  or  RAD  set,
       whose  members  are  CPU  or RAD identifiers, an ID set is
       generic and can be created  for  any  type  of  identifier
       (process,  thread,  file,  and  so  forth). The max_id_val
       argument specifies the maximum value for any member_id, as
       appropriate  for  the  type of identifier contained by the
       set.

       The idsetcreate() function allocates, and sets  to  empty,
       an ID set pointed to by set.

       The  idsetdestroy()  function releases the memory that was
       obtained by idsetcreate() for the specified ID set pointed
       to by set.

       The idcountset() function returns the number of members in
       the ID set specified by set.

       The idemptyset() function initializes the ID set specified
       by set, such that no members are included in the set.

       The  idfillset() function initializes the ID set specified
       by set, such that all members that are  currently  configured
 in the caller's partition are included in the set.

       The  idismember() function tests whether the ID set member
       specified by the value of member_id is a member of the  ID
       set specified by set.

       The idisemptyset() function tests whether the ID set specified
 by the set is empty.

       The idcopyset() function copies the contents of the ID set
       specified  by set_src to the  ID set specified by set_dst.

       The idaddset() and iddelset() functions  respectively  add
       or  delete the members specified by the value of member_id
       to or from the ID set specified by set.

       The idandset(), idorset(), and idxorset()  functions  perform
 a logical AND, OR, or XOR operation, respectively, on
       the ID sets specified by set_src1  and  set_src2,  storing
       the result in the ID set specified by set_dst.

       The  iddiffset()  function  finds  the  logical difference
       between the ID sets specified by  set_src1  and  set_src2,
       storing  the  result  in  the ID set specified by set_dst.
       (The result is made up of members  that  are  included  in
       set_src1 but not in

       set_src2.)

RETURN VALUES    [Toc]    [Back]

       These  functions  return  the  following  values:  Success
       (returned by all functions).

              For idisemptyset() and idismember()  only,  0  also
              means the condition being tested is false; that is,
              the specified ID set is not empty or does not  contain
  the  specified  member.  Success (returned by
              idisemptyset() and idismember()only).  This  return
              value  also  means  the  condition  being tested is
              true; that is, the specified ID  set  is  empty  or
              contains  the  specified member.  Failure (returned
              by all functions). In this case, errno  is  set  to
              indicate the error.

ERRORS    [Toc]    [Back]

       The  idaddset(),  idandset(),  idcopyset(),  idcountset(),
       iddelset(), iddiffset(), idemptyset(), idfillset(),  idisemptyset(),
  idismember(), idorset(), and idxorset() functions
 set errno to the following value for the corresponding
  condition:  The  value  of a set or set_* argument is
       invalid (possibly is not a ID  set  created  by  idsetcreate()).


       The  idsetcreate()  and idsetdestroy() functions set errno
       to one of the the following values for  the  corresponding
       condition: The address of the specified ID set is invalid.
       For idsetcreate() only, no memory could be  allocated  for
       the specified ID set.

       If  the idaddset(), iddelset(), and idismember() functions
       fail, they set errno to the following value for the reason
       specified:  The value of member_id is an invalid or unsupported
 ID identifier.

EXAMPLES    [Toc]    [Back]

       The following example demonstrates a  variety  of  ID  set
       operations. This program arbitrarily specifies INT_MAX for
       the idsetcreate() function's max_id_val argument.  INT_MAX
       is  the  largest  value  currently supported by the idid_t
       type and would result in a very large ID index  structure.
       For  set  operations  on  a specific type of ID, such as a
       process ID, you would specify the largest  expected  value
       for  that  type of identifier. Creating an index structure
       that can access larger ID values than will  occur  on  the
       system wastes memory.

       #include <idset.h>

       int main() {
               idset_t idset, idset2;

               /* Create idsets - initialized as empty */
               idsetcreate(&idset, INT_MAX);
               idsetcreate(&idset2, INT_MAX);
               /* demonstrate idset operations */

               /* add id 0 to idset */
               if (idaddset(idset, 0) == -1) {
                       perror("idaddset");
                       return 0;
               }

               /* copy idset to idset2 */
               if (idcopyset(idset, idset2) == -1) {
                       perror("idcopyset");
                       return 0;
               }

               if (idaddset(idset, 1) == -1) {
                       /* add id 1 to idset */
                       perror("idaddset");
                       return 0;
               }

               /*  difference of idset and idset2, store in idset
       */
               if (iddiffset(idset, idset2, idset) == -1) {
                       perror("iddiffset");
                       return 0;
               }

               /* Enumerate idset. */
               while (1) {
                       idid_t id;
                       int flags = SET_CURSOR_CONSUME;
                       id_cursor_t id_cursor = SET_CURSOR_INIT;

                       id = id_foreach(idset, flags, &id_cursor);

                       if (id == ID_NONE) {
                               printf("\n");
                               break;
                       } else {
                               printf("%3d ", id);
                       }
               }

               /* Destroy idset */
               idsetdestroy(&idset);
               idsetdestroy(&idset2);
               return 0; }

SEE ALSO    [Toc]    [Back]

      
      
       Functions: id_foreach(3)



                                                      idsetops(3)
[ Back ]
 Similar pages
Name OS Title
cpuisemptyset Tru64 Perform operations on CPU sets (libc library)
cpufillset Tru64 Perform operations on CPU sets (libc library)
cpudelset Tru64 Perform operations on CPU sets (libc library)
cpucountset Tru64 Perform operations on CPU sets (libc library)
cpucopyset Tru64 Perform operations on CPU sets (libc library)
cpuaddset Tru64 Perform operations on CPU sets (libc library)
cpuismember Tru64 Perform operations on CPU sets (libc library)
cpusetdestroy Tru64 Perform operations on CPU sets (libc library)
cpusetcreate Tru64 Perform operations on CPU sets (libc library)
cpusetops Tru64 Perform operations on CPU sets (libc library)
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service