Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions src/rtapi/uspace_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -354,22 +354,15 @@ static int _rtapi_is_realtime = -1;
#ifdef __linux__
static int detect_preempt_rt() {
struct utsname u;
int crit1, crit2 = 0;
FILE *fd;
int crit1 = 0;

uname(&u);
crit1 = strcasestr (u.version, "PREEMPT RT") != 0;

//"PREEMPT_RT" is used in the version string instead of "PREEMPT RT" starting with kernel version 5.4
crit1 = crit1 || (strcasestr(u.version, "PREEMPT_RT") != 0);

if ((fd = fopen("/sys/kernel/realtime","r")) != NULL) {
int flag;
crit2 = ((fscanf(fd, "%d", &flag) == 1) && (flag == 1));
fclose(fd);
}

return crit1 && crit2;
return crit1;
}
#else
static int detect_preempt_rt() {
Expand Down