EPICS Multi-Core Utilities  1.2.1
Real-Time Utilities for EPICS IOCs on Multi-Core Linux
 All Files Functions Variables Typedefs Macros Modules Pages
utils.h
Go to the documentation of this file.
1 /********************************************/
12 #ifndef UTILS_H
13 #define UTILS_H
14 
15 #include <sched.h>
16 #include <unistd.h>
17 
18 #include <errlog.h>
19 
20 // TODO: Use libCom call when get-cpus branch is merged
21 #define NO_OF_CPUS sysconf(_SC_NPROCESSORS_CONF)
22 
23 #define checkStatus(status,message) \
24 if((status)) {\
25  errlogPrintf("%s error %s\n", (message), strerror((status))); \
26 }
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
37 extern int cpuDigits;
38 
39 void strToCpuset(cpu_set_t *cpuset, const char *spec);
40 void cpusetToStr(char *set, size_t len, const cpu_set_t *cpuset);
41 const char *policyToStr(const int policy);
42 int strToPolicy(const char *string);
43 
44 #ifdef __cplusplus
45 }
46 #endif
47 
48 #endif // UTILS_H
void cpusetToStr(char *set, size_t len, const cpu_set_t *cpuset)
Convert a cpuset into its string specification (e.g. "0,2-3").
Definition: utils.c:59
const char * policyToStr(const int policy)
Convert scheduling policy to string.
Definition: utils.c:96
void strToCpuset(cpu_set_t *cpuset, const char *spec)
Convert a cpuset string specification (e.g. "0,2-3") to a cpuset.
Definition: utils.c:29
int cpuDigits
Number of digits needed for a single CPU spec.
Definition: utils.c:21
int strToPolicy(const char *string)
Convert string policy specification to policy.
Definition: utils.c:124