[PATCH 5/7] Use sched_getcpu - sched_getcpu is available since glibc 2.6 - the current tests were broken in anycase.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: John Kacur <jkacur@xxxxxxxxxx>
---
 src/ptsematest/ptsematest.c   |   18 +-----------------
 src/sigwaittest/sigwaittest.c |   18 +-----------------
 2 files changed, 2 insertions(+), 34 deletions(-)

diff --git a/src/ptsematest/ptsematest.c b/src/ptsematest/ptsematest.c
index e040417..c4426f3 100644
--- a/src/ptsematest/ptsematest.c
+++ b/src/ptsematest/ptsematest.c
@@ -33,17 +33,13 @@
 #include <sys/time.h>
 #include <sys/mman.h>
 #include <linux/unistd.h>
+#include <utmpx.h>
 #include "rt-utils.h"
 
 #define __USE_GNU
 #include <pthread.h>
 
-#undef HAS_SCHED_GETCPU
-
 #define gettid() syscall(__NR_gettid)
-#ifndef HAS_SCHED_GETCPU
-#define getcpu(cpu, node, cache) syscall(__NR_getcpu, cpu, node, cache)
-#endif
 
 #define USEC_PER_SEC 1000000
 
@@ -112,13 +108,7 @@ void *semathread(void *param)
 			if(par->max_cycles && par->samples >= par->max_cycles)
 				par->shutdown = 1;
 			if (mustgetcpu) {
-#ifdef HAS_SCHED_GETCPU
 				par->cpu = sched_getcpu();
-#else
-				int c, s;
-	                        s = getcpu(&c, NULL, NULL);
-			        par->cpu = (s == -1) ? s : c;
-#endif
 			}
 		} else {
 			/* Receiver */
@@ -160,13 +150,7 @@ void *semathread(void *param)
 			if (par->max_cycles && par->samples >= par->max_cycles)
 				par->shutdown = 1;
 			if (mustgetcpu) {
-#ifdef HAS_SCHED_GETCPU
 				par->cpu = sched_getcpu();
-#else
-				int c, s;
-	                        s = getcpu(&c, NULL, NULL);
-			        par->cpu = (s == -1) ? s : c;
-#endif
 		        }
 			nanosleep(&par->delay, NULL);
 			pthread_mutex_unlock(&syncmutex[par->num]);
diff --git a/src/sigwaittest/sigwaittest.c b/src/sigwaittest/sigwaittest.c
index a3bbebc..740e13d 100644
--- a/src/sigwaittest/sigwaittest.c
+++ b/src/sigwaittest/sigwaittest.c
@@ -35,17 +35,13 @@
 #include <sys/types.h>
 #include <sys/time.h>
 #include <linux/unistd.h>
+#include <utmpx.h>
 #include "rt-utils.h"
 
 #define __USE_GNU
 #include <pthread.h>
 
-#undef HAS_SCHED_GETCPU
-
 #define gettid() syscall(__NR_gettid)
-#ifndef HAS_SCHED_GETCPU
-#define getcpu(cpu, node, cache) syscall(__NR_getcpu, cpu, node, cache)
-#endif
 
 #define USEC_PER_SEC 1000000
 
@@ -143,13 +139,7 @@ void *semathread(void *param)
 				par->shutdown = 1;
 
 			if (mustgetcpu) {
-#ifdef HAS_SCHED_GETCPU
 				par->cpu = sched_getcpu();
-#else
-				int c, s;
-	                        s = getcpu(&c, NULL, NULL);
-			        par->cpu = (s == -1) ? s : c;
-#endif
 			}
 			sigwait(&sigset, &sig);
 		} else {
@@ -173,13 +163,7 @@ void *semathread(void *param)
 				par->shutdown = 1;
 
 			if (mustgetcpu) {
-#ifdef HAS_SCHED_GETCPU
 				par->cpu = sched_getcpu();
-#else
-				int c, s;
-	                        s = getcpu(&c, NULL, NULL);
-			        par->cpu = (s == -1) ? s : c;
-#endif
 		        }
 			/*
 			 * Latency is the time spent between sending and
-- 
1.6.5.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux