eliminate explicit (long) casts when making syscalls
authorRich Felker <dalias@aerifal.cx>
Tue, 7 Jan 2014 03:05:54 +0000 (22:05 -0500)
committerRich Felker <dalias@aerifal.cx>
Tue, 7 Jan 2014 03:05:54 +0000 (22:05 -0500)
this practice came from very early, before internal/syscall.h defined
macros that could accept pointer arguments directly and handle them
correctly. aside from being ugly and unnecessary, it looks like it
will be problematic when we add support for 32-bit ABIs on archs where
registers (and syscall arguments) are 64-bit, e.g. x32 and mips n32.

src/thread/__wait.c
src/time/timer_delete.c
src/time/timer_getoverrun.c
src/time/timer_gettime.c
src/time/timer_settime.c

index 041a0669a0587644e4f8347d8d8a76866b8a9672..a1e47804b4416a8ed02e888ebd3757c43381661f 100644 (file)
@@ -10,6 +10,6 @@ void __wait(volatile int *addr, volatile int *waiters, int val, int priv)
        }
        if (waiters) a_inc(waiters);
        while (*addr==val)
-               __syscall(SYS_futex, (long)addr, FUTEX_WAIT|priv, val, 0);
+               __syscall(SYS_futex, addr, FUTEX_WAIT|priv, val, 0);
        if (waiters) a_dec(waiters);
 }
index c81f921a4164ca0c795f15da014e9393c1673f9c..7c97eeb1a1d8340fd07f9f045f1964680a18697d 100644 (file)
@@ -10,5 +10,5 @@ int timer_delete(timer_t t)
                __wake(&td->timer_id, 1, 1);
                return 0;
        }
-       return __syscall(SYS_timer_delete, (long)t);
+       return __syscall(SYS_timer_delete, t);
 }
index 53361285f3ee028d223cabb3cb08037d1b89ec7d..e7f891e4040fe3ff3117a15dec1bbab70cc75ad1 100644 (file)
@@ -8,5 +8,5 @@ int timer_getoverrun(timer_t t)
                pthread_t td = (void *)((uintptr_t)t << 1);
                t = (void *)(uintptr_t)(td->timer_id & INT_MAX);
        }
-       return syscall(SYS_timer_getoverrun, (long)t);
+       return syscall(SYS_timer_getoverrun, t);
 }
index 1d902075c4354e52fd54dd2bf3fd75029c9c5676..ed6d8d65ce1ac0b488002e5a9503b1fbd84ddea3 100644 (file)
@@ -8,5 +8,5 @@ int timer_gettime(timer_t t, struct itimerspec *val)
                pthread_t td = (void *)((uintptr_t)t << 1);
                t = (void *)(uintptr_t)(td->timer_id & INT_MAX);
        }
-       return syscall(SYS_timer_gettime, (long)t, val);
+       return syscall(SYS_timer_gettime, t, val);
 }
index f5f36feb2896c013362e197715b56f7969d5f800..62631aa49cda75f49fba047163747cd29faa60e3 100644 (file)
@@ -8,5 +8,5 @@ int timer_settime(timer_t t, int flags, const struct itimerspec *restrict val, s
                pthread_t td = (void *)((uintptr_t)t << 1);
                t = (void *)(uintptr_t)(td->timer_id & INT_MAX);
        }
-       return syscall(SYS_timer_settime, (long)t, flags, val, old);
+       return syscall(SYS_timer_settime, t, flags, val, old);
 }