# endif
#endif
+/* In many, many places we play fast and loose and use
+ * tprintf("%d", (int) tcp->u_arg[N]) to print fds, pids etc.
+ * We probably need to use widen_to_long() instead:
+ */
+#if SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4
+# define widen_to_long(v) (current_wordsize == 4 ? (long)(int32_t)(v) : (long)(v))
+#else
+# define widen_to_long(v) ((long)(v))
+#endif
+
struct sysent {
unsigned nargs;
int sys_flags;
{
if (!addr)
tprints("NULL");
- else if (!verbose(tcp) ||
- (exiting(tcp) && syserror(tcp)))
+ else if (!verbose(tcp) || (exiting(tcp) && syserror(tcp)))
tprintf("%#lx", addr);
else {
# if SIZEOF_RLIM_T == 4
sys_kill(struct tcb *tcp)
{
if (entering(tcp)) {
- long pid = tcp->u_arg[0];
-#if SUPPORTED_PERSONALITIES > 1
- /* Sign-extend a 32-bit value when that's what it is. */
- if (current_wordsize < sizeof pid)
- pid = (long) (int) pid;
-#endif
- tprintf("%ld, %s", pid, signame(tcp->u_arg[1]));
+ tprintf("%ld, %s",
+ widen_to_long(tcp->u_arg[0]),
+ signame(tcp->u_arg[1])
+ );
}
return 0;
}
{
if (entering(tcp)) {
tprintf("%ld, %ld, %s",
- tcp->u_arg[0], tcp->u_arg[1], signame(tcp->u_arg[2]));
+ widen_to_long(tcp->u_arg[0]),
+ widen_to_long(tcp->u_arg[1]),
+ signame(tcp->u_arg[2])
+ );
}
return 0;
}