Deleted Added
full compact
amd64-linux32.c (106713) amd64-linux32.c (122348)
1/*
2 * Copryight 1997 Sean Eric Fagan
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.

--- 17 unchanged lines hidden (view full) ---

26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 */
31
32#ifndef lint
33static const char rcsid[] =
1/*
2 * Copryight 1997 Sean Eric Fagan
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.

--- 17 unchanged lines hidden (view full) ---

26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 */
31
32#ifndef lint
33static const char rcsid[] =
34 "$FreeBSD: head/usr.bin/truss/amd64-linux32.c 106713 2002-11-09 22:46:51Z dwmalone $";
34 "$FreeBSD: head/usr.bin/truss/amd64-linux32.c 122348 2003-11-09 03:48:13Z marcel $";
35#endif /* not lint */
36
37/*
38 * Linux/i386-specific system call handling. Given how much of this code
39 * is taken from the freebsd equivalent, I can probably put even more of
40 * it in support routines that can be used by any personality support.
41 */
42

--- 213 unchanged lines hidden (view full) ---

256 -30, -31, -32, -33, -34, -11,-115,-114, -88, -89,
257 -90, -91, -92, -93, -94, -95, -96, -97, -98, -99,
258 -100,-101,-102,-103,-104,-105,-106,-107,-108,-109,
259 -110,-111, -40, -36,-112,-113, -39, -11, -87,-122,
260 -116, -66, -6, -6, -6, -6, -6, -37, -38, -9,
261 -6,
262};
263
35#endif /* not lint */
36
37/*
38 * Linux/i386-specific system call handling. Given how much of this code
39 * is taken from the freebsd equivalent, I can probably put even more of
40 * it in support routines that can be used by any personality support.
41 */
42

--- 213 unchanged lines hidden (view full) ---

256 -30, -31, -32, -33, -34, -11,-115,-114, -88, -89,
257 -90, -91, -92, -93, -94, -95, -96, -97, -98, -99,
258 -100,-101,-102,-103,-104,-105,-106,-107,-108,-109,
259 -110,-111, -40, -36,-112,-113, -39, -11, -87,-122,
260 -116, -66, -6, -6, -6, -6, -6, -37, -38, -9,
261 -6,
262};
263
264int
265i386_linux_syscall_exit(struct trussinfo *trussinfo, int syscall_num __unused) {
264long
265i386_linux_syscall_exit(struct trussinfo *trussinfo, int syscall_num __unused)
266{
266 char buf[32];
267 struct reg regs;
267 char buf[32];
268 struct reg regs;
268 int retval;
269 long retval;
269 int i;
270 int errorp;
271 struct syscall *sc;
272
273 if (fd == -1 || trussinfo->pid != cpid) {
274 sprintf(buf, "/proc/%d/regs", trussinfo->pid);
275 fd = open(buf, O_RDONLY);
276 if (fd == -1) {

--- 13 unchanged lines hidden (view full) ---

290
291 /*
292 * This code, while simpler than the initial versions I used, could
293 * stand some significant cleaning.
294 */
295
296 sc = fsc.sc;
297 if (!sc) {
270 int i;
271 int errorp;
272 struct syscall *sc;
273
274 if (fd == -1 || trussinfo->pid != cpid) {
275 sprintf(buf, "/proc/%d/regs", trussinfo->pid);
276 fd = open(buf, O_RDONLY);
277 if (fd == -1) {

--- 13 unchanged lines hidden (view full) ---

291
292 /*
293 * This code, while simpler than the initial versions I used, could
294 * stand some significant cleaning.
295 */
296
297 sc = fsc.sc;
298 if (!sc) {
298 for (i = 0; i < fsc.nargs; i++) {
299 fsc.s_args[i] = malloc(12);
300 sprintf(fsc.s_args[i], "0x%lx", fsc.args[i]);
301 }
299 for (i = 0; i < fsc.nargs; i++)
300 asprintf(&fsc.s_args[i], "0x%lx", fsc.args[i]);
302 } else {
303 /*
304 * Here, we only look for arguments that have OUT masked in --
305 * otherwise, they were handled in the syscall_entry function.
306 */
307 for (i = 0; i < sc->nargs; i++) {
308 char *temp;
309 if (sc->args[i].type & OUT) {
310 /*
311 * If an error occurred, than don't bothe getting the data;
312 * it may not be valid.
313 */
301 } else {
302 /*
303 * Here, we only look for arguments that have OUT masked in --
304 * otherwise, they were handled in the syscall_entry function.
305 */
306 for (i = 0; i < sc->nargs; i++) {
307 char *temp;
308 if (sc->args[i].type & OUT) {
309 /*
310 * If an error occurred, than don't bothe getting the data;
311 * it may not be valid.
312 */
314 if (errorp) {
315 temp = malloc(12);
316 sprintf(temp, "0x%lx", fsc.args[sc->args[i].offset]);
317 } else {
313 if (errorp)
314 asprintf(&temp, "0x%lx", fsc.args[sc->args[i].offset]);
315 else
318 temp = print_arg(Procfd, &sc->args[i], fsc.args);
316 temp = print_arg(Procfd, &sc->args[i], fsc.args);
319 }
320 fsc.s_args[i] = temp;
321 }
322 }
323 }
324
325 /*
326 * It would probably be a good idea to merge the error handling,
327 * but that complicates things considerably.

--- 12 unchanged lines hidden ---
317 fsc.s_args[i] = temp;
318 }
319 }
320 }
321
322 /*
323 * It would probably be a good idea to merge the error handling,
324 * but that complicates things considerably.

--- 12 unchanged lines hidden ---