2 # if STRACE_UID_SIZE != 16
3 # error invalid STRACE_UID_SIZE
6 # define SIZEIFY(x) SIZEIFY_(x,STRACE_UID_SIZE)
7 # define SIZEIFY_(x,size) SIZEIFY__(x,size)
8 # define SIZEIFY__(x,size) x ## size
10 # define printuid SIZEIFY(printuid)
11 # define sys_chown SIZEIFY(sys_chown)
12 # define sys_fchown SIZEIFY(sys_fchown)
13 # define sys_getgroups SIZEIFY(sys_getgroups)
14 # define sys_getresuid SIZEIFY(sys_getresuid)
15 # define sys_getuid SIZEIFY(sys_getuid)
16 # define sys_setfsuid SIZEIFY(sys_setfsuid)
17 # define sys_setgroups SIZEIFY(sys_setgroups)
18 # define sys_setresuid SIZEIFY(sys_setresuid)
19 # define sys_setreuid SIZEIFY(sys_setreuid)
20 # define sys_setuid SIZEIFY(sys_setuid)
21 #endif /* STRACE_UID_SIZE */
25 #ifdef STRACE_UID_SIZE
26 # if !NEED_UID16_PARSERS
27 # undef STRACE_UID_SIZE
30 # define STRACE_UID_SIZE 32
33 #ifdef STRACE_UID_SIZE
36 # define uid_t uid_t_(STRACE_UID_SIZE)
37 # define uid_t_(size) uid_t__(size)
38 # define uid_t__(size) uint ## size ## _t
41 sys_getuid(struct tcb *tcp)
44 tcp->u_rval = (uid_t) tcp->u_rval;
49 sys_setfsuid(struct tcb *tcp)
52 tprintf("%u", (uid_t) tcp->u_arg[0]);
54 tcp->u_rval = (uid_t) tcp->u_rval;
59 sys_setuid(struct tcb *tcp)
62 tprintf("%u", (uid_t) tcp->u_arg[0]);
68 get_print_uid(struct tcb *tcp, const char *prefix, const long addr)
72 if (umove(tcp, addr, &uid) < 0)
73 tprintf("%s%#lx", prefix, addr);
75 tprintf("%s[%u]", prefix, uid);
79 sys_getresuid(struct tcb *tcp)
83 tprintf("%#lx, %#lx, %#lx", tcp->u_arg[0],
84 tcp->u_arg[1], tcp->u_arg[2]);
86 get_print_uid(tcp, "", tcp->u_arg[0]);
87 get_print_uid(tcp, ", ", tcp->u_arg[1]);
88 get_print_uid(tcp, ", ", tcp->u_arg[2]);
95 sys_setreuid(struct tcb *tcp)
98 printuid("", tcp->u_arg[0]);
99 printuid(", ", tcp->u_arg[1]);
105 sys_setresuid(struct tcb *tcp)
108 printuid("", tcp->u_arg[0]);
109 printuid(", ", tcp->u_arg[1]);
110 printuid(", ", tcp->u_arg[2]);
116 sys_chown(struct tcb *tcp)
119 printpath(tcp, tcp->u_arg[0]);
120 printuid(", ", tcp->u_arg[1]);
121 printuid(", ", tcp->u_arg[2]);
127 sys_fchown(struct tcb *tcp)
130 printfd(tcp, tcp->u_arg[0]);
131 printuid(", ", tcp->u_arg[1]);
132 printuid(", ", tcp->u_arg[2]);
138 printuid(const char *text, const unsigned int uid)
140 if ((unsigned int) -1 == uid || (uid_t) -1 == uid)
141 tprintf("%s-1", text);
143 tprintf("%s%u", text, uid);
147 sys_setgroups(struct tcb *tcp)
150 unsigned long len, size, start, cur, end, abbrev_end;
155 tprintf("%lu, ", len);
160 start = tcp->u_arg[1];
165 size = len * sizeof(gid);
167 if (!verbose(tcp) || size / sizeof(gid) != len || end < start) {
168 tprintf("%#lx", start);
172 abbrev_end = start + max_strlen * sizeof(gid);
173 if (abbrev_end < start)
179 for (cur = start; cur < end; cur += sizeof(gid)) {
182 if (cur >= abbrev_end) {
186 if (umoven(tcp, cur, sizeof(gid), (char *) &gid) < 0) {
191 tprintf("%u", (unsigned int) gid);
195 tprintf(" %#lx", tcp->u_arg[1]);
201 sys_getgroups(struct tcb *tcp)
207 tprintf("%lu, ", len);
209 unsigned long size, start, cur, end, abbrev_end;
213 start = tcp->u_arg[1];
223 size = len * sizeof(gid);
225 if (!verbose(tcp) || tcp->u_arg[0] == 0 ||
226 size / sizeof(gid) != len || end < start) {
227 tprintf("%#lx", start);
231 abbrev_end = start + max_strlen * sizeof(gid);
232 if (abbrev_end < start)
238 for (cur = start; cur < end; cur += sizeof(gid)) {
241 if (cur >= abbrev_end) {
245 if (umoven(tcp, cur, sizeof(gid), (char *) &gid) < 0) {
250 tprintf("%u", (unsigned int) gid);
254 tprintf(" %#lx", tcp->u_arg[1]);
259 #endif /* STRACE_UID_SIZE */