Implement ioprio_get and ioprio_set decoding
* ioprio.c: New file. * Makefile.am (strace_SOURCES): Add ioprio.c. * linux/dummy.h (sys_ioprio_get, sys_ioprio_set): Remove. * linux/syscall.h (sys_ioprio_get, sys_ioprio_set): New prototypes.
This commit is contained in:
parent
f67502e404
commit
fc4727de60
@ -25,6 +25,7 @@ strace_SOURCES = \
|
||||
inotify.c \
|
||||
io.c \
|
||||
ioctl.c \
|
||||
ioprio.c \
|
||||
ipc.c \
|
||||
kexec.c \
|
||||
loop.c \
|
||||
|
86
ioprio.c
Normal file
86
ioprio.c
Normal file
@ -0,0 +1,86 @@
|
||||
#include "defs.h"
|
||||
|
||||
enum {
|
||||
IOPRIO_WHO_PROCESS = 1,
|
||||
IOPRIO_WHO_PGRP,
|
||||
IOPRIO_WHO_USER
|
||||
};
|
||||
|
||||
static const struct xlat ioprio_who[] = {
|
||||
XLAT(IOPRIO_WHO_PROCESS),
|
||||
XLAT(IOPRIO_WHO_PGRP),
|
||||
XLAT(IOPRIO_WHO_USER),
|
||||
XLAT_END
|
||||
};
|
||||
|
||||
enum {
|
||||
IOPRIO_CLASS_NONE,
|
||||
IOPRIO_CLASS_RT,
|
||||
IOPRIO_CLASS_BE,
|
||||
IOPRIO_CLASS_IDLE
|
||||
};
|
||||
|
||||
static const struct xlat ioprio_class[] = {
|
||||
XLAT(IOPRIO_CLASS_NONE),
|
||||
XLAT(IOPRIO_CLASS_RT),
|
||||
XLAT(IOPRIO_CLASS_BE),
|
||||
XLAT(IOPRIO_CLASS_IDLE),
|
||||
XLAT_END
|
||||
};
|
||||
|
||||
#define IOPRIO_CLASS_SHIFT (13)
|
||||
#define IOPRIO_PRIO_MASK ((1ul << IOPRIO_CLASS_SHIFT) - 1)
|
||||
|
||||
#define IOPRIO_PRIO_CLASS(mask) ((mask) >> IOPRIO_CLASS_SHIFT)
|
||||
#define IOPRIO_PRIO_DATA(mask) ((mask) & IOPRIO_PRIO_MASK)
|
||||
|
||||
static const char *
|
||||
sprint_ioprio(int ioprio)
|
||||
{
|
||||
static char outstr[256];
|
||||
const char *str;
|
||||
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);
|
||||
else
|
||||
sprintf(outstr, "IOPRIO_PRIO_VALUE(%#x /* %s */,%d)",
|
||||
class, "IOPRIO_CLASS_???", data);
|
||||
|
||||
return outstr;
|
||||
}
|
||||
|
||||
int
|
||||
sys_ioprio_get(struct tcb *tcp)
|
||||
{
|
||||
if (entering(tcp)) {
|
||||
/* int which */
|
||||
printxval(ioprio_who, tcp->u_arg[0], "IOPRIO_WHO_???");
|
||||
/* int who */
|
||||
tprintf(", %d", (int) tcp->u_arg[1]);
|
||||
return 0;
|
||||
} else {
|
||||
if (syserror(tcp))
|
||||
return 0;
|
||||
|
||||
tcp->auxstr = sprint_ioprio(tcp->u_rval);
|
||||
return RVAL_STR;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
sys_ioprio_set(struct tcb *tcp)
|
||||
{
|
||||
if (entering(tcp)) {
|
||||
/* int which */
|
||||
printxval(ioprio_who, tcp->u_arg[0], "IOPRIO_WHO_???");
|
||||
/* int who */
|
||||
tprintf(", %d, ", (int) tcp->u_arg[1]);
|
||||
/* int ioprio */
|
||||
tprints(sprint_ioprio(tcp->u_arg[2]));
|
||||
}
|
||||
return 0;
|
||||
}
|
@ -35,8 +35,6 @@
|
||||
#define sys_add_key printargs
|
||||
#define sys_ioperm printargs
|
||||
#define sys_iopl printargs
|
||||
#define sys_ioprio_get printargs
|
||||
#define sys_ioprio_set printargs
|
||||
#define sys_kcmp printargs
|
||||
#define sys_keyctl printargs
|
||||
#define sys_lookup_dcookie printargs
|
||||
|
@ -121,6 +121,8 @@ int sys_io_getevents();
|
||||
int sys_io_setup();
|
||||
int sys_io_submit();
|
||||
int sys_ioctl();
|
||||
int sys_ioprio_get();
|
||||
int sys_ioprio_set();
|
||||
int sys_ipc();
|
||||
int sys_kexec_load();
|
||||
int sys_kill();
|
||||
|
Loading…
x
Reference in New Issue
Block a user