12 #include <core/types.h> 21 #define BIT_PER_CPU (1) 31 #define BITS_TO_CPU_MASK(bits) (((bits) + BITS_PER_LONG - 1) / BITS_PER_LONG) 36 # define BITMAP_ELT(cpu) ((cpu) / BITS_PER_LONG) 41 # define __CPUMASK(cpu) (1L << ((cpu) % BITS_PER_LONG)) 46 #define DECLARE_BITMAP(name, bits) \ 47 unsigned long name[BITS_TO_CPU_MASK(bits)] 58 #define CPU_ZERO(cpusetp) \ 61 size_t imax = (sizeof(cpu_set_t)) / sizeof (unsigned long); \ 62 unsigned long *bits = (cpusetp)->bits; \ 63 for (i = 0; i < imax; ++i) \ 70 #define CPU_SET(cpu, cpusetp) \ 72 size_t __cpu = (cpu); \ 73 __cpu < CHAR_BIT * (sizeof(cpu_set_t)) \ 74 ? (((cpusetp)->bits)[BITMAP_ELT(__cpu)] |= __CPUMASK (__cpu)) \ 81 #define CPU_CLR(cpu, cpusetp) \ 83 size_t __cpu = (cpu); \ 84 __cpu < CHAR_BIT * (sizeof(cpu_set_t)) \ 85 ? (((cpusetp)->bits)[BITMAP_ELT(__cpu)] &= ~__CPUMASK (__cpu)) \ 92 # define CPU_ISSET(cpu, cpusetp) \ 94 size_t __cpu = (cpu); \ 95 __cpu < CHAR_BIT * (sizeof(cpu_set_t)) \ 96 ? ((((cpusetp)->bits)[BITMAP_ELT(__cpu)] & __CPUMASK (__cpu))) != 0 \ 112 #ifndef __HIDE_INTERNAL_FUNCTIONS__ 116 #define SCHED_CLASS_FIFO (0) 117 #define SCHED_CLASS_NORMAL (1) 122 unsigned int class_id;
123 unsigned int priority;
133 int set_priority(
int prio);
141 int get_priority(
void);
150 int set_scheduler(
struct sched_param *param);
158 int get_scheduler(
struct sched_param *param);
Wrapper for kernel types.h header.
int pid_t
Definition: types.h:21
#define MAX_CPUS
Definition: sched.h:26
int sched_setaffinity(pid_t pid, size_t cpusetsize, cpu_set_t *mask)
Sets the CPU affinity mask of the process whose ID is pid to the value specified by mask...
int sched_getaffinity(pid_t pid, size_t cpusetsize, cpu_set_t *mask)
Writes the affinity mask of the process whose ID is pid into the cpu_set_t structure pointed to by ma...
Implementation-defined constants.
#define BIT_PER_CPU
Definition: sched.h:21
#define DECLARE_BITMAP(name, bits)
Definition: sched.h:46
int sched_yield(void)
Causes the calling thread to relinquish the CPU. The thread is moved to the end of the queue for its ...