On Tue, 18 Jun 2019, Kurt Kanzenbach wrote: > gettid() is already implemented in the library code. Use that code instead. > > Signed-off-by: Kurt Kanzenbach <kurt@xxxxxxxxxxxxx> > --- > src/sched_deadline/cyclicdeadline.c | 6 ++---- > src/sched_deadline/deadline_test.c | 6 ++---- > 2 files changed, 4 insertions(+), 8 deletions(-) > > diff --git a/src/sched_deadline/cyclicdeadline.c b/src/sched_deadline/cyclicdeadline.c > index 2b83665cab66..17786db45612 100644 > --- a/src/sched_deadline/cyclicdeadline.c > +++ b/src/sched_deadline/cyclicdeadline.c > @@ -33,8 +33,6 @@ > #define CPUSET_ALL "my_cpuset_all" > #define CPUSET_LOCAL "my_cpuset" > > -#define gettid() syscall(__NR_gettid) > - > typedef unsigned long long u64; > typedef unsigned int u32; > typedef int s32; > @@ -755,7 +753,7 @@ void *run_deadline(void *data) > attr.sched_runtime = sd->runtime_us * 1000; > attr.sched_deadline = sd->deadline_us * 1000; > > - printf("thread[%ld] runtime=%lldus deadline=%lldus\n", > + printf("thread[%d] runtime=%lldus deadline=%lldus\n", > gettid(), sd->runtime_us, sd->deadline_us); > > pthread_barrier_wait(&barrier); > @@ -1195,7 +1193,7 @@ int main (int argc, char **argv) > system("cat /sys/fs/cgroup/cpuset/my_cpuset/tasks"); > } > > - printf("main thread %ld\n", gettid()); > + printf("main thread %d\n", gettid()); > > pthread_barrier_wait(&barrier); > printf("fail 2 %d\n", fail); > diff --git a/src/sched_deadline/deadline_test.c b/src/sched_deadline/deadline_test.c > index c3b9dceb5209..e2898de328bb 100644 > --- a/src/sched_deadline/deadline_test.c > +++ b/src/sched_deadline/deadline_test.c > @@ -51,6 +51,7 @@ > #include <linux/unistd.h> > #include <linux/magic.h> > > +#include <rt-utils.h> > #include <rt-sched.h> > > /** > @@ -103,9 +104,6 @@ static void usage(char **argv) > #define CPUSET_ALL "my_cpuset_all" > #define CPUSET_LOCAL "my_cpuset" > > -/* Define the system call interfaces */ > -#define gettid() syscall(__NR_gettid) > - > typedef unsigned long long u64; > typedef unsigned int u32; > typedef int s32; > @@ -1267,7 +1265,7 @@ void *run_deadline(void *data) > attr.sched_runtime = sched_data->runtime_us * 1000; > attr.sched_deadline = sched_data->deadline_us * 1000; > > - printf("thread[%ld] runtime=%lldus deadline=%lldus loops=%lld\n", > + printf("thread[%d] runtime=%lldus deadline=%lldus loops=%lld\n", > gettid(), sched_data->runtime_us, > sched_data->deadline_us, sched_data->loops_per_period); > > -- > 2.11.0 > > If anyone objects because they are actively using systems that don't have gettid() in the library, please speak-up, for now this is in unstable/devel/latest-devel Signed-off-by: John Kacur <jkacur@xxxxxxxxxx>