From a25b209e7f98f1bf8d0aaf9d0c2cf5ccb365f4ab Mon Sep 17 00:00:00 2001
From: Robert Schmidt <robert.schmidt@openairinterface.org>
Date: Mon, 11 Mar 2024 19:10:30 +0100
Subject: [PATCH] Remove Check if fedora and inside kernel

It's completely unclear what this is supposed to do.
---
 common/utils/system.c        | 21 ---------------------
 common/utils/system.h        |  3 ---
 executables/lte-ue.c         |  5 -----
 executables/nr-uesoftmodem.c |  4 ----
 4 files changed, 33 deletions(-)

diff --git a/common/utils/system.c b/common/utils/system.c
index 7cdeb5a21d4..d8570fe14e6 100644
--- a/common/utils/system.c
+++ b/common/utils/system.c
@@ -95,17 +95,6 @@ static void read_pipe(int p, char *b, int size) {
     size -= ret;
   }
 }
-int checkIfFedoraDistribution(void) {
-  return !system("grep -iq 'ID_LIKE.*fedora' /etc/os-release ");
-}
-
-int checkIfGenericKernelOnFedora(void) {
-  return system("uname -a | grep -q rt");
-}
-
-int checkIfInsideContainer(void) {
-  return !system("egrep -q 'libpod|podman|kubepods'  /proc/self/cgroup");
-}
 
 /********************************************************************/
 /* background process                                               */
@@ -234,11 +223,6 @@ void threadCreate(pthread_t* t, void * (*func)(void*), void * param, char* name,
 
   LOG_I(UTIL,"Creating thread %s with affinity %d and priority %d\n",name,affinity,priority);
 
-  if (checkIfFedoraDistribution())
-    if (checkIfGenericKernelOnFedora())
-      if (checkIfInsideContainer())
-        settingPriority = 0;
-  
   if (settingPriority) {
     ret=pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);
     AssertFatal(ret == 0, "Error in pthread_attr_setinheritsched(): ret: %d, errno: %d\n", ret, errno);
@@ -314,11 +298,6 @@ void thread_top_init(char *thread_name,
     }
   }
 
-  if (checkIfFedoraDistribution())
-    if (checkIfGenericKernelOnFedora())
-      if (checkIfInsideContainer())
-        settingPriority = 0;
-
   if (settingPriority) {
     memset(&sparam, 0, sizeof(sparam));
     sparam.sched_priority = sched_get_priority_max(SCHED_FIFO);
diff --git a/common/utils/system.h b/common/utils/system.h
index c25c2a6f1f7..1b7c0c570fe 100644
--- a/common/utils/system.h
+++ b/common/utils/system.h
@@ -61,9 +61,6 @@ void thread_top_init(char *thread_name,
  * Functions to check system at runtime.
  ****************************************************/
 
-int checkIfFedoraDistribution(void);
-int checkIfGenericKernelOnFedora(void);
-int checkIfInsideContainer(void);
 int rt_sleep_ns (uint64_t x);
 #ifdef __cplusplus
 }
diff --git a/executables/lte-ue.c b/executables/lte-ue.c
index 5176533b8eb..df5c47c3ca8 100644
--- a/executables/lte-ue.c
+++ b/executables/lte-ue.c
@@ -195,11 +195,6 @@ void init_thread(int sched_runtime,
                  char *name) {
   int settingPriority = 1;
 
-  if (checkIfFedoraDistribution())
-    if (checkIfGenericKernelOnFedora())
-      if (checkIfInsideContainer())
-        settingPriority = 0;
-
   if (settingPriority) {
     if (CPU_COUNT(cpuset) > 0)
       AssertFatal( 0 == pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), cpuset), "");
diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c
index 6199abf0707..0676dd2e18c 100644
--- a/executables/nr-uesoftmodem.c
+++ b/executables/nr-uesoftmodem.c
@@ -457,10 +457,6 @@ ldpc_interface_t ldpc_interface = {0}, ldpc_interface_offload = {0};
 int main(int argc, char **argv)
 {
   int set_exe_prio = 1;
-  if (checkIfFedoraDistribution())
-    if (checkIfGenericKernelOnFedora())
-      if (checkIfInsideContainer())
-        set_exe_prio = 0;
   if (set_exe_prio)
     set_priority(79);
 
-- 
GitLab