From 9134aab4073a8be6bb529aeb05e8c5f4be69540f Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Sat, 14 May 2016 21:46:05 +0000 Subject: [PATCH] Prepare for transition from xlookup64 to xlookup * fcntl.c (print_fcntl, SYS_FUNC(fcntl), SYS_FUNC(fcntl64)): Cast 2nd argument of xlookup to unsigned long. * prctl.c (SYS_FUNC(prctl)): Likewise. * sched.c (SYS_FUNC(sched_getscheduler)): Likewise. * time.c (do_adjtimex): Likewise. * ioprio.c (sprint_ioprio): Change type of the argument and local variables from int to unsigned int. * keyctl.c (print_keyring_serial_number): Cast 2nd argument of xlookup to unsigned int. * net.c (tprint_sock_type): Change type of the argument to unsigned int. * printmode.c (sprintmode): Likewise. * printsiginfo.c (printsigval): Change type of si_code argument to unsigned int. --- defs.h | 2 +- fcntl.c | 8 +++++--- ioprio.c | 8 ++++---- keyctl.c | 2 +- net.c | 2 +- prctl.c | 3 ++- printmode.c | 2 +- printsiginfo.c | 2 +- sched.c | 2 +- time.c | 2 +- 10 files changed, 18 insertions(+), 15 deletions(-) diff --git a/defs.h b/defs.h index a3b1ddaa..04dcb83c 100644 --- a/defs.h +++ b/defs.h @@ -579,7 +579,7 @@ extern int printargs_d(struct tcb *); extern void addflags(const struct xlat *, uint64_t); extern int printflags64(const struct xlat *, uint64_t, const char *); extern const char *sprintflags64(const char *, const struct xlat *, uint64_t); -extern const char *sprintmode(int); +extern const char *sprintmode(unsigned int); extern const char *sprinttime(time_t); extern void dumpiov_in_msghdr(struct tcb *, long, unsigned long); extern void dumpiov_in_mmsghdr(struct tcb *, long); diff --git a/fcntl.c b/fcntl.c index 561c164e..b30fc17b 100644 --- a/fcntl.c +++ b/fcntl.c @@ -168,7 +168,7 @@ print_fcntl(struct tcb *tcp) case F_GETLEASE: if (entering(tcp) || syserror(tcp)) return 0; - tcp->auxstr = xlookup(lockfcmds, tcp->u_rval); + tcp->auxstr = xlookup(lockfcmds, (unsigned long) tcp->u_rval); return RVAL_HEX | RVAL_STR; case F_GET_SEALS: if (entering(tcp) || syserror(tcp) || tcp->u_rval == 0) @@ -192,7 +192,8 @@ SYS_FUNC(fcntl) if (entering(tcp)) { printfd(tcp, tcp->u_arg[0]); tprints(", "); - const char *str = xlookup(fcntlcmds, tcp->u_arg[1]); + const char *str = + xlookup(fcntlcmds, (unsigned long) tcp->u_arg[1]); if (str) { tprints(str); } else { @@ -212,7 +213,8 @@ SYS_FUNC(fcntl64) if (entering(tcp)) { printfd(tcp, tcp->u_arg[0]); tprints(", "); - const char *str = xlookup(fcntl64cmds, tcp->u_arg[1]); + const char *str = + xlookup(fcntl64cmds, (unsigned long) tcp->u_arg[1]); if (str) { tprints(str); } else { diff --git a/ioprio.c b/ioprio.c index 0a1a5967..0b83be7a 100644 --- a/ioprio.c +++ b/ioprio.c @@ -51,19 +51,19 @@ enum { #define IOPRIO_PRIO_DATA(mask) ((mask) & IOPRIO_PRIO_MASK) static const char * -sprint_ioprio(int ioprio) +sprint_ioprio(unsigned int ioprio) { static char outstr[256]; const char *str; - int class, data; + unsigned int class, data; class = IOPRIO_PRIO_CLASS(ioprio); data = IOPRIO_PRIO_DATA(ioprio); str = xlookup(ioprio_class, class); if (str) - sprintf(outstr, "IOPRIO_PRIO_VALUE(%s,%d)", str, data); + sprintf(outstr, "IOPRIO_PRIO_VALUE(%s, %d)", str, data); else - sprintf(outstr, "IOPRIO_PRIO_VALUE(%#x /* %s */,%d)", + sprintf(outstr, "IOPRIO_PRIO_VALUE(%#x /* %s */, %d)", class, "IOPRIO_CLASS_???", data); return outstr; diff --git a/keyctl.c b/keyctl.c index 81391a37..50d6fb48 100644 --- a/keyctl.c +++ b/keyctl.c @@ -34,7 +34,7 @@ typedef int32_t key_serial_t; static void print_keyring_serial_number(key_serial_t id) { - const char *str = xlookup(key_spec, id); + const char *str = xlookup(key_spec, (unsigned int) id); if (str) tprints(str); diff --git a/net.c b/net.c index c34b6aaf..3349758e 100644 --- a/net.c +++ b/net.c @@ -770,7 +770,7 @@ dumpiov_in_mmsghdr(struct tcb *tcp, long addr) * other bits are socket type flags. */ static void -tprint_sock_type(int flags) +tprint_sock_type(unsigned int flags) { const char *str = xlookup(socktypes, flags & SOCK_TYPE_MASK); diff --git a/prctl.c b/prctl.c index da7d265b..4ddd0b91 100644 --- a/prctl.c +++ b/prctl.c @@ -292,7 +292,8 @@ SYS_FUNC(prctl) } if (syserror(tcp)) return 0; - tcp->auxstr = xlookup(pr_mce_kill_policy, tcp->u_rval); + tcp->auxstr = xlookup(pr_mce_kill_policy, + (unsigned long) tcp->u_rval); return tcp->auxstr ? RVAL_STR : RVAL_UDECIMAL; case PR_GET_NO_NEW_PRIVS: diff --git a/printmode.c b/printmode.c index 8ff05fcf..ad875078 100644 --- a/printmode.c +++ b/printmode.c @@ -37,7 +37,7 @@ #include "xlat/modetypes.h" const char * -sprintmode(int mode) +sprintmode(unsigned int mode) { static char buf[sizeof("S_IFSOCK|S_ISUID|S_ISGID|S_ISVTX|%o") + sizeof(int)*3 diff --git a/printsiginfo.c b/printsiginfo.c index 3e3fb501..78508df3 100644 --- a/printsiginfo.c +++ b/printsiginfo.c @@ -81,7 +81,7 @@ printsigval(const siginfo_t *sip) } static void -print_si_code(int si_signo, int si_code) +print_si_code(int si_signo, unsigned int si_code) { const char *code = xlookup(siginfo_codes, si_code); diff --git a/sched.c b/sched.c index e193498c..bdf97073 100644 --- a/sched.c +++ b/sched.c @@ -39,7 +39,7 @@ SYS_FUNC(sched_getscheduler) if (entering(tcp)) { tprintf("%d", (int) tcp->u_arg[0]); } else if (!syserror(tcp)) { - tcp->auxstr = xlookup(schedulers, tcp->u_rval); + tcp->auxstr = xlookup(schedulers, (unsigned long) tcp->u_rval); if (tcp->auxstr != NULL) return RVAL_STR; } diff --git a/time.c b/time.c index 4c218936..963d0ea2 100644 --- a/time.c +++ b/time.c @@ -171,7 +171,7 @@ do_adjtimex(struct tcb *tcp, long addr) { if (print_timex(tcp, addr)) return 0; - tcp->auxstr = xlookup(adjtimex_state, tcp->u_rval); + tcp->auxstr = xlookup(adjtimex_state, (unsigned long) tcp->u_rval); if (tcp->auxstr) return RVAL_STR; return 0; -- 2.40.0