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

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

cpusetops(3)

Contents


NAME    [Toc]    [Back]

       cpusetops,  cpuaddset, cpuandset, cpucopyset, cpucountset,
       cpudelset, cpudiffset, cpuemptyset, cpufillset,  cpuisemptyset,
 cpuismember, cpuorset, cpusetcreate, cpusetdestroy,
       cpuxorset - Perform operations on CPU sets (libc library)

SYNOPSIS    [Toc]    [Back]

       #include <cpuset.h>

       int cpuaddset(
               cpuset_t set,
               cpuid_t cpuid ); int cpuandset(
               cpuset_t set_src1,
               cpuset_t set_src2,
               cpuset_t set_dst ); int cpucopyset(
               cpuset_t set_src,
               cpuset_t set_dst ); int cpucountset(
               cpuset_t set ); int cpudelset(
               cpuset_t set,
               cpuid_t cpuid ); int cpudiffset(
               cpuset_t set_src1,
               cpuset_t set_src2,
               cpuset_t set_dst ); int cpuemptyset(
               cpuset_t set ); int cpufillset(
               cpuset_t set ); int cpuisemptyset(
               cpuset_t set ); int cpuismember(
               cpuset_t set,
               cpuid_t cpuid ); int cpuorset(
               cpuset_t set_src1,
               cpuset_t set_src2,
               cpuset_t set_dst ); int cpusetcreate(
               cpuset_t *set ); int cpusetdestroy(
               cpuset_t *set ); int cpuxorset(
               cpuset_t set_src1,
               cpuset_t set_src2,
               cpuset_t set_dst );

PARAMETERS    [Toc]    [Back]

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

DESCRIPTION    [Toc]    [Back]

       The cpusetops primitives manipulate sets of CPUs, by operating
 on data objects (of type cpuset_t) that are  created
       by cpusetcreate().

       The  cpusetcreate() function allocates, and sets to empty,
       a CPU set pointed to by set.

       The cpusetdestroy() function releases the memory that  was
       obtained  by  cpusetcreate()  for  the  specified  CPU set
       pointed to by set.

       The cpucountset() function returns the number  of  members
       in the CPU set specified by set.

       The  cpuemptyset() function initializes the CPU set specified
 by set, such that no CPUs are included in the set.

       The cpufillset() function initializes the CPU  set  specified
  by  set, such that as many CPUs as the system architecture
 is capable of supporting are included in the  set.
       Note  that  this  platform  maximum might be more than the
       number of CPUs that are available on the system.

       The cpuismember() function tests whether the CPU specified
       by the value of cpuid is a member of the CPU set specified
       by set.

       The cpuisemptyset() function tests  whether  the  CPU  set
       specified by the set is empty.

       The  cpucopyset()  function copies the contents of the CPU
       set specified by set_src to  the   CPU  set  specified  by
       set_dst.

       The cpuaddset() and cpudelset() functions respectively add
       or delete the individual CPU specified  by  the  value  of
       cpuid to or from the CPU set specified by set.

       The  cpuandset(),  cpuorset(),  and  cpuxorset() functions
       perform a logical AND, OR, or XOR operation, respectively,
       on  the CPU sets specified by set_src1 and set_src2, storing
 the result in the CPU set specified by set_dst.

       The cpudiffset() function  finds  the  logical  difference
       between  the  CPU sets specified by set_src1 and set_src2,
       storing the result in the CPU 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  cpuisemptyset() and cpuismember() only, 0 also
              means the condition being tested is false; that is,
              the specified CPU set is not empty or does not contain
 the specified member.   Success  (returned  by
              cpuisemptyset()   and   cpuismember()only).    This
              return value also means the condition being  tested
              is true; that is, the specified CPU 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 cpuaddset(), cpuandset(), cpucopyset(), cpucountset(),
       cpudelset(),  cpudiffset(),  cpuemptyset(),  cpufillset(),
       cpuisemptyset(),  cpuismember(),  cpuorset(),  and   cpuxorset()
 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 CPU set created bycpusetcreate()).


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

       If  the  cpuaddset(),   cpudelset(),   and   cpuismember()
       functions  fail, they set errno to the following value for
       the reason specified: The value of cpuid is an invalid  or
       unsupported CPU identifier.

EXAMPLES    [Toc]    [Back]

       The  following  example  demonstrates a variety of CPU set
       operations:

       #include <cpuset.h>

       int main() {
               cpuset_t cpuset, cpuset2;

               /* Create cpusets - initialized as empty */
               cpusetcreate(&cpuset);
               cpusetcreate(&cpuset2);
               /* demonstrate cpuset operations */

               /* add cpu 0 to cpuset */
               if (cpuaddset(cpuset, 0) == -1) {
                       perror("cpuaddset");
                       return 0;
               }

               /* copy cpuset to cpuset2 */
               if (cpucopyset(cpuset, cpuset2) == -1) {
                       perror("cpucopyset");
                       return 0;
               }

               if (cpuaddset(cpuset, 1) == -1) {
                       /* add cpu 1 to cpuset */
                       perror("cpuaddset");
                       return 0;
               }

               /* difference of  cpuset  and  cpuset2,  store  in
       cpuset */
               if (cpudiffset(cpuset, cpuset2, cpuset) == -1) {
                       perror("cpudiffset");
                       return 0;
               }

               /* Enumerate cpuset. */
               while (1) {
                       cpuid_t id;
                       int flags = SET_CURSOR_CONSUME;
                       cpu_cursor_t cpu_cursor = SET_CURSOR_INIT;

                       id = cpu_foreach(cpuset, flags,  &cpu_cursor);


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

               /* Destroy cpuset */
               cpusetdestroy(&cpuset);
               cpusetdestroy(&cpuset2);
               return 0; }


SEE ALSO    [Toc]    [Back]

      
      
       Functions: cpu_foreach(3), numa_intro(3)

       Files: numa_types(4)



                                                     cpusetops(3)
[ Back ]
 Similar pages
Name OS Title
idandset Tru64 Perform operations on ID sets (libc library)
idaddset Tru64 Perform operations on ID sets (libc library)
idisemptyset Tru64 Perform operations on ID sets (libc library)
idorset Tru64 Perform operations on ID sets (libc library)
idsetcreate Tru64 Perform operations on ID sets (libc library)
idcopyset Tru64 Perform operations on ID sets (libc library)
idcountset Tru64 Perform operations on ID sets (libc library)
iddelset Tru64 Perform operations on ID sets (libc library)
idismember Tru64 Perform operations on ID sets (libc library)
idfillset Tru64 Perform operations on ID sets (libc library)
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service