Commit 74d753ac86c525380513dc57a2ab319606c7c07c
Committed by
Riku Voipio
1 parent
9edc5d79
linux-user: strace now handles guest strings correctly [v2]
- to not to break strace with GUEST_BASE is set: - Strace now can load and print guest strings correctly. - Added printing support for commonly used flags in some syscalls (e.g open, creat, mmap etc.) v2: - fix strace.c build on etch - add futex print to strace Signed-off-by: Mika Westerberg <mika.westerberg@iki.fi> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
Showing
4 changed files
with
1118 additions
and
77 deletions
linux-user/strace.c
| ... | ... | @@ -6,6 +6,9 @@ |
| 6 | 6 | #include <sys/shm.h> |
| 7 | 7 | #include <sys/select.h> |
| 8 | 8 | #include <sys/types.h> |
| 9 | +#include <sys/mount.h> | |
| 10 | +#include <sys/mman.h> | |
| 11 | +#include <linux/futex.h> | |
| 9 | 12 | #include <unistd.h> |
| 10 | 13 | #include "qemu.h" |
| 11 | 14 | |
| ... | ... | @@ -21,6 +24,47 @@ struct syscallname { |
| 21 | 24 | void (*result)(const struct syscallname *, abi_long); |
| 22 | 25 | }; |
| 23 | 26 | |
| 27 | +#ifdef __GNUC__ | |
| 28 | +/* | |
| 29 | + * It is possible that target doesn't have syscall that uses | |
| 30 | + * following flags but we don't want the compiler to warn | |
| 31 | + * us about them being unused. Same applies to utility print | |
| 32 | + * functions. It is ok to keep them while not used. | |
| 33 | + */ | |
| 34 | +#define UNUSED __attribute__ ((unused)) | |
| 35 | +#else | |
| 36 | +#define UNUSED | |
| 37 | +#endif | |
| 38 | + | |
| 39 | +/* | |
| 40 | + * Structure used to translate flag values into strings. This is | |
| 41 | + * similar that is in the actual strace tool. | |
| 42 | + */ | |
| 43 | +struct flags { | |
| 44 | + abi_long f_value; /* flag */ | |
| 45 | + const char *f_string; /* stringified flag */ | |
| 46 | +}; | |
| 47 | + | |
| 48 | +/* common flags for all architectures */ | |
| 49 | +#define FLAG_GENERIC(name) { name, #name } | |
| 50 | +/* target specific flags (syscall_defs.h has TARGET_<flag>) */ | |
| 51 | +#define FLAG_TARGET(name) { TARGET_ ## name, #name } | |
| 52 | +/* end of flags array */ | |
| 53 | +#define FLAG_END { 0, NULL } | |
| 54 | + | |
| 55 | +UNUSED static const char *get_comma(int); | |
| 56 | +UNUSED static void print_pointer(abi_long, int); | |
| 57 | +UNUSED static void print_flags(const struct flags *, abi_long, int); | |
| 58 | +UNUSED static void print_at_dirfd(abi_long, int); | |
| 59 | +UNUSED static void print_file_mode(abi_long, int); | |
| 60 | +UNUSED static void print_open_flags(abi_long, int); | |
| 61 | +UNUSED static void print_syscall_prologue(const struct syscallname *); | |
| 62 | +UNUSED static void print_syscall_epilogue(const struct syscallname *); | |
| 63 | +UNUSED static void print_string(abi_long, int); | |
| 64 | +UNUSED static void print_raw_param(const char *, abi_long, int); | |
| 65 | +UNUSED static void print_timeval(abi_ulong, int); | |
| 66 | +UNUSED static void print_number(abi_long, int); | |
| 67 | + | |
| 24 | 68 | /* |
| 25 | 69 | * Utility functions |
| 26 | 70 | */ |
| ... | ... | @@ -100,22 +144,6 @@ print_fdset(int n, abi_ulong target_fds_addr) |
| 100 | 144 | } |
| 101 | 145 | gemu_log("]"); |
| 102 | 146 | } |
| 103 | - | |
| 104 | -static void | |
| 105 | -print_timeval(abi_ulong tv_addr) | |
| 106 | -{ | |
| 107 | - if( tv_addr ) { | |
| 108 | - struct target_timeval *tv; | |
| 109 | - | |
| 110 | - tv = lock_user(VERIFY_READ, tv_addr, sizeof(*tv), 1); | |
| 111 | - if (!tv) | |
| 112 | - return; | |
| 113 | - gemu_log("{" TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld "}", | |
| 114 | - tv->tv_sec, tv->tv_usec); | |
| 115 | - unlock_user(tv, tv_addr, 0); | |
| 116 | - } else | |
| 117 | - gemu_log("NULL"); | |
| 118 | -} | |
| 119 | 147 | #endif |
| 120 | 148 | |
| 121 | 149 | /* |
| ... | ... | @@ -142,7 +170,7 @@ print_newselect(const struct syscallname *name, |
| 142 | 170 | gemu_log(","); |
| 143 | 171 | print_fdset(arg1, arg4); |
| 144 | 172 | gemu_log(","); |
| 145 | - print_timeval(arg5); | |
| 173 | + print_timeval(arg5, 1); | |
| 146 | 174 | gemu_log(")"); |
| 147 | 175 | |
| 148 | 176 | /* save for use in the return output function below */ |
| ... | ... | @@ -250,11 +278,1019 @@ print_syscall_ret_newselect(const struct syscallname *name, abi_long ret) |
| 250 | 278 | gemu_log(","); |
| 251 | 279 | print_fdset(newselect_arg1,newselect_arg4); |
| 252 | 280 | gemu_log(","); |
| 253 | - print_timeval(newselect_arg5); | |
| 281 | + print_timeval(newselect_arg5, 1); | |
| 254 | 282 | gemu_log(")\n"); |
| 255 | 283 | } |
| 256 | 284 | #endif |
| 257 | 285 | |
| 286 | +UNUSED static struct flags access_flags[] = { | |
| 287 | + FLAG_GENERIC(F_OK), | |
| 288 | + FLAG_GENERIC(R_OK), | |
| 289 | + FLAG_GENERIC(W_OK), | |
| 290 | + FLAG_GENERIC(X_OK), | |
| 291 | + FLAG_END, | |
| 292 | +}; | |
| 293 | + | |
| 294 | +UNUSED static struct flags at_file_flags[] = { | |
| 295 | +#ifdef AT_EACCESS | |
| 296 | + FLAG_GENERIC(AT_EACCESS), | |
| 297 | +#endif | |
| 298 | +#ifdef AT_SYMLINK_NOFOLLOW | |
| 299 | + FLAG_GENERIC(AT_SYMLINK_NOFOLLOW), | |
| 300 | +#endif | |
| 301 | + FLAG_END, | |
| 302 | +}; | |
| 303 | + | |
| 304 | +UNUSED static struct flags unlinkat_flags[] = { | |
| 305 | +#ifdef AT_REMOVEDIR | |
| 306 | + FLAG_GENERIC(AT_REMOVEDIR), | |
| 307 | +#endif | |
| 308 | + FLAG_END, | |
| 309 | +}; | |
| 310 | + | |
| 311 | +UNUSED static struct flags mode_flags[] = { | |
| 312 | + FLAG_GENERIC(S_IFSOCK), | |
| 313 | + FLAG_GENERIC(S_IFLNK), | |
| 314 | + FLAG_GENERIC(S_IFREG), | |
| 315 | + FLAG_GENERIC(S_IFBLK), | |
| 316 | + FLAG_GENERIC(S_IFDIR), | |
| 317 | + FLAG_GENERIC(S_IFCHR), | |
| 318 | + FLAG_GENERIC(S_IFIFO), | |
| 319 | + FLAG_END, | |
| 320 | +}; | |
| 321 | + | |
| 322 | +UNUSED static struct flags open_access_flags[] = { | |
| 323 | + FLAG_TARGET(O_RDONLY), | |
| 324 | + FLAG_TARGET(O_WRONLY), | |
| 325 | + FLAG_TARGET(O_RDWR), | |
| 326 | + FLAG_END, | |
| 327 | +}; | |
| 328 | + | |
| 329 | +UNUSED static struct flags open_flags[] = { | |
| 330 | + FLAG_TARGET(O_APPEND), | |
| 331 | + FLAG_TARGET(O_CREAT), | |
| 332 | + FLAG_TARGET(O_DIRECTORY), | |
| 333 | + FLAG_TARGET(O_EXCL), | |
| 334 | + FLAG_TARGET(O_LARGEFILE), | |
| 335 | + FLAG_TARGET(O_NOCTTY), | |
| 336 | + FLAG_TARGET(O_NOFOLLOW), | |
| 337 | + FLAG_TARGET(O_NONBLOCK), /* also O_NDELAY */ | |
| 338 | + FLAG_TARGET(O_SYNC), | |
| 339 | + FLAG_TARGET(O_TRUNC), | |
| 340 | +#ifdef O_DIRECT | |
| 341 | + FLAG_TARGET(O_DIRECT), | |
| 342 | +#endif | |
| 343 | + FLAG_END, | |
| 344 | +}; | |
| 345 | + | |
| 346 | +UNUSED static struct flags mount_flags[] = { | |
| 347 | +#ifdef MS_BIND | |
| 348 | + FLAG_GENERIC(MS_BIND), | |
| 349 | +#endif | |
| 350 | +#ifdef MS_DIRSYNC | |
| 351 | + FLAG_GENERIC(MS_DIRSYNC), | |
| 352 | +#endif | |
| 353 | + FLAG_GENERIC(MS_MANDLOCK), | |
| 354 | +#ifdef MS_MOVE | |
| 355 | + FLAG_GENERIC(MS_MOVE), | |
| 356 | +#endif | |
| 357 | + FLAG_GENERIC(MS_NOATIME), | |
| 358 | + FLAG_GENERIC(MS_NODEV), | |
| 359 | + FLAG_GENERIC(MS_NODIRATIME), | |
| 360 | + FLAG_GENERIC(MS_NOEXEC), | |
| 361 | + FLAG_GENERIC(MS_NOSUID), | |
| 362 | + FLAG_GENERIC(MS_RDONLY), | |
| 363 | +#ifdef MS_RELATIME | |
| 364 | + FLAG_GENERIC(MS_RELATIME), | |
| 365 | +#endif | |
| 366 | + FLAG_GENERIC(MS_REMOUNT), | |
| 367 | + FLAG_GENERIC(MS_SYNCHRONOUS), | |
| 368 | + FLAG_END, | |
| 369 | +}; | |
| 370 | + | |
| 371 | +UNUSED static struct flags umount2_flags[] = { | |
| 372 | +#ifdef MNT_FORCE | |
| 373 | + FLAG_GENERIC(MNT_FORCE), | |
| 374 | +#endif | |
| 375 | +#ifdef MNT_DETACH | |
| 376 | + FLAG_GENERIC(MNT_DETACH), | |
| 377 | +#endif | |
| 378 | +#ifdef MNT_EXPIRE | |
| 379 | + FLAG_GENERIC(MNT_EXPIRE), | |
| 380 | +#endif | |
| 381 | + FLAG_END, | |
| 382 | +}; | |
| 383 | + | |
| 384 | +UNUSED static struct flags mmap_prot_flags[] = { | |
| 385 | + FLAG_GENERIC(PROT_NONE), | |
| 386 | + FLAG_GENERIC(PROT_EXEC), | |
| 387 | + FLAG_GENERIC(PROT_READ), | |
| 388 | + FLAG_GENERIC(PROT_WRITE), | |
| 389 | + FLAG_END, | |
| 390 | +}; | |
| 391 | + | |
| 392 | +UNUSED static struct flags mmap_flags[] = { | |
| 393 | + FLAG_TARGET(MAP_SHARED), | |
| 394 | + FLAG_TARGET(MAP_PRIVATE), | |
| 395 | + FLAG_TARGET(MAP_ANONYMOUS), | |
| 396 | + FLAG_TARGET(MAP_DENYWRITE), | |
| 397 | + FLAG_TARGET(MAP_FIXED), | |
| 398 | + FLAG_TARGET(MAP_GROWSDOWN), | |
| 399 | +#ifdef MAP_LOCKED | |
| 400 | + FLAG_TARGET(MAP_LOCKED), | |
| 401 | +#endif | |
| 402 | +#ifdef MAP_NONBLOCK | |
| 403 | + FLAG_TARGET(MAP_NONBLOCK), | |
| 404 | +#endif | |
| 405 | + FLAG_TARGET(MAP_NORESERVE), | |
| 406 | +#ifdef MAP_POPULATE | |
| 407 | + FLAG_TARGET(MAP_POPULATE), | |
| 408 | +#endif | |
| 409 | + FLAG_END, | |
| 410 | +}; | |
| 411 | + | |
| 412 | +UNUSED static struct flags fcntl_flags[] = { | |
| 413 | + FLAG_TARGET(F_DUPFD), | |
| 414 | + FLAG_TARGET(F_GETFD), | |
| 415 | + FLAG_TARGET(F_SETFD), | |
| 416 | + FLAG_TARGET(F_GETFL), | |
| 417 | + FLAG_TARGET(F_SETFL), | |
| 418 | + FLAG_TARGET(F_GETLK), | |
| 419 | + FLAG_TARGET(F_SETLK), | |
| 420 | + FLAG_TARGET(F_SETLKW), | |
| 421 | + FLAG_END, | |
| 422 | +}; | |
| 423 | + | |
| 424 | +/* | |
| 425 | + * print_xxx utility functions. These are used to print syscall | |
| 426 | + * parameters in certain format. All of these have parameter | |
| 427 | + * named 'last'. This parameter is used to add comma to output | |
| 428 | + * when last == 0. | |
| 429 | + */ | |
| 430 | + | |
| 431 | +static const char * | |
| 432 | +get_comma(int last) | |
| 433 | +{ | |
| 434 | + return ((last) ? "" : ","); | |
| 435 | +} | |
| 436 | + | |
| 437 | +static void | |
| 438 | +print_flags(const struct flags *f, abi_long tflags, int last) | |
| 439 | +{ | |
| 440 | + const char *sep = ""; | |
| 441 | + int flags; | |
| 442 | + int n; | |
| 443 | + | |
| 444 | + flags = (int)tswap32(tflags); | |
| 445 | + | |
| 446 | + if ((flags == 0) && (f->f_value == 0)) { | |
| 447 | + gemu_log("%s%s", f->f_string, get_comma(last)); | |
| 448 | + return; | |
| 449 | + } | |
| 450 | + for (n = 0; f->f_string != NULL; f++) { | |
| 451 | + if ((f->f_value != 0) && ((flags & f->f_value) == f->f_value)) { | |
| 452 | + gemu_log("%s%s", sep, f->f_string); | |
| 453 | + flags &= ~f->f_value; | |
| 454 | + sep = "|"; | |
| 455 | + n++; | |
| 456 | + } | |
| 457 | + } | |
| 458 | + | |
| 459 | + if (n > 0) { | |
| 460 | + /* print rest of the flags as numeric */ | |
| 461 | + if (flags != 0) { | |
| 462 | + gemu_log("%s%#x%s", sep, flags, get_comma(last)); | |
| 463 | + } else { | |
| 464 | + gemu_log("%s", get_comma(last)); | |
| 465 | + } | |
| 466 | + } else { | |
| 467 | + /* no string version of flags found, print them in hex then */ | |
| 468 | + gemu_log("%#x%s", flags, get_comma(last)); | |
| 469 | + } | |
| 470 | +} | |
| 471 | + | |
| 472 | +static void | |
| 473 | +print_at_dirfd(abi_long tdirfd, int last) | |
| 474 | +{ | |
| 475 | + int dirfd = tswap32(tdirfd); | |
| 476 | + | |
| 477 | +#ifdef AT_FDCWD | |
| 478 | + if (dirfd == AT_FDCWD) { | |
| 479 | + gemu_log("AT_FDCWD%s", get_comma(last)); | |
| 480 | + return; | |
| 481 | + } | |
| 482 | +#endif | |
| 483 | + gemu_log("%d%s", dirfd, get_comma(last)); | |
| 484 | +} | |
| 485 | + | |
| 486 | +static void | |
| 487 | +print_file_mode(abi_long tmode, int last) | |
| 488 | +{ | |
| 489 | + const char *sep = ""; | |
| 490 | + const struct flags *m; | |
| 491 | + mode_t mode = (mode_t)tswap32(tmode); | |
| 492 | + | |
| 493 | + for (m = &mode_flags[0]; m->f_string != NULL; m++) { | |
| 494 | + if ((m->f_value & mode) == m->f_value) { | |
| 495 | + gemu_log("%s%s", m->f_string, sep); | |
| 496 | + sep = "|"; | |
| 497 | + mode &= ~m->f_value; | |
| 498 | + break; | |
| 499 | + } | |
| 500 | + } | |
| 501 | + | |
| 502 | + mode &= ~S_IFMT; | |
| 503 | + /* print rest of the mode as octal */ | |
| 504 | + if (mode != 0) | |
| 505 | + gemu_log("%s%#o", sep, mode); | |
| 506 | + | |
| 507 | + gemu_log("%s", get_comma(last)); | |
| 508 | +} | |
| 509 | + | |
| 510 | +static void | |
| 511 | +print_open_flags(abi_long tflags, int last) | |
| 512 | +{ | |
| 513 | + int flags = tswap32(tflags); | |
| 514 | + | |
| 515 | + print_flags(open_access_flags, flags & TARGET_O_ACCMODE, 1); | |
| 516 | + flags &= ~TARGET_O_ACCMODE; | |
| 517 | + if (flags == 0) { | |
| 518 | + gemu_log("%s", get_comma(last)); | |
| 519 | + return; | |
| 520 | + } | |
| 521 | + gemu_log("|"); | |
| 522 | + print_flags(open_flags, flags, last); | |
| 523 | +} | |
| 524 | + | |
| 525 | +static void | |
| 526 | +print_syscall_prologue(const struct syscallname *sc) | |
| 527 | +{ | |
| 528 | + gemu_log("%s(", sc->name); | |
| 529 | +} | |
| 530 | + | |
| 531 | +/*ARGSUSED*/ | |
| 532 | +static void | |
| 533 | +print_syscall_epilogue(const struct syscallname *sc) | |
| 534 | +{ | |
| 535 | + (void)sc; | |
| 536 | + gemu_log(")"); | |
| 537 | +} | |
| 538 | + | |
| 539 | +static void | |
| 540 | +print_string(abi_long addr, int last) | |
| 541 | +{ | |
| 542 | + char *s; | |
| 543 | + | |
| 544 | + if ((s = lock_user_string(addr)) != NULL) { | |
| 545 | + gemu_log("\"%s\"%s", s, get_comma(last)); | |
| 546 | + unlock_user(s, addr, 0); | |
| 547 | + } else { | |
| 548 | + /* can't get string out of it, so print it as pointer */ | |
| 549 | + print_pointer(addr, last); | |
| 550 | + } | |
| 551 | +} | |
| 552 | + | |
| 553 | +/* | |
| 554 | + * Prints out raw parameter using given format. Caller needs | |
| 555 | + * to do byte swapping if needed. | |
| 556 | + */ | |
| 557 | +static void | |
| 558 | +print_raw_param(const char *fmt, abi_long param, int last) | |
| 559 | +{ | |
| 560 | + char format[64]; | |
| 561 | + | |
| 562 | + (void) snprintf(format, sizeof (format), "%s%s", fmt, get_comma(last)); | |
| 563 | + gemu_log(format, param); | |
| 564 | +} | |
| 565 | + | |
| 566 | +static void | |
| 567 | +print_pointer(abi_long p, int last) | |
| 568 | +{ | |
| 569 | + if (p == 0) | |
| 570 | + gemu_log("NULL%s", get_comma(last)); | |
| 571 | + else | |
| 572 | + gemu_log("0x" TARGET_ABI_FMT_lx "%s", p, get_comma(last)); | |
| 573 | +} | |
| 574 | + | |
| 575 | +/* | |
| 576 | + * Reads 32-bit (int) number from guest address space from | |
| 577 | + * address 'addr' and prints it. | |
| 578 | + */ | |
| 579 | +static void | |
| 580 | +print_number(abi_long addr, int last) | |
| 581 | +{ | |
| 582 | + if (addr == 0) { | |
| 583 | + gemu_log("NULL%s", get_comma(last)); | |
| 584 | + } else { | |
| 585 | + int num; | |
| 586 | + | |
| 587 | + get_user_s32(num, addr); | |
| 588 | + gemu_log("[%d]%s", num, get_comma(last)); | |
| 589 | + } | |
| 590 | +} | |
| 591 | + | |
| 592 | +static void | |
| 593 | +print_timeval(abi_ulong tv_addr, int last) | |
| 594 | +{ | |
| 595 | + if( tv_addr ) { | |
| 596 | + struct target_timeval *tv; | |
| 597 | + | |
| 598 | + tv = lock_user(VERIFY_READ, tv_addr, sizeof(*tv), 1); | |
| 599 | + if (!tv) | |
| 600 | + return; | |
| 601 | + gemu_log("{" TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld "}%s", | |
| 602 | + tv->tv_sec, tv->tv_usec, get_comma(last)); | |
| 603 | + unlock_user(tv, tv_addr, 0); | |
| 604 | + } else | |
| 605 | + gemu_log("NULL%s", get_comma(last)); | |
| 606 | +} | |
| 607 | + | |
| 608 | +#undef UNUSED | |
| 609 | + | |
| 610 | +#ifdef TARGET_NR_accept | |
| 611 | +static void | |
| 612 | +print_accept(const struct syscallname *name, | |
| 613 | + abi_long arg0, abi_long arg1, abi_long arg2, | |
| 614 | + abi_long arg3, abi_long arg4, abi_long arg5) | |
| 615 | +{ | |
| 616 | + print_syscall_prologue(name); | |
| 617 | + print_raw_param("%d", tswap32(arg0), 0); | |
| 618 | + print_pointer(arg1, 0); | |
| 619 | + print_number(arg2, 1); | |
| 620 | + print_syscall_epilogue(name); | |
| 621 | +} | |
| 622 | +#endif | |
| 623 | + | |
| 624 | +#ifdef TARGET_NR_access | |
| 625 | +static void | |
| 626 | +print_access(const struct syscallname *name, | |
| 627 | + abi_long arg0, abi_long arg1, abi_long arg2, | |
| 628 | + abi_long arg3, abi_long arg4, abi_long arg5) | |
| 629 | +{ | |
| 630 | + print_syscall_prologue(name); | |
| 631 | + print_string(arg0, 0); | |
| 632 | + print_flags(access_flags, arg1, 1); | |
| 633 | + print_syscall_epilogue(name); | |
| 634 | +} | |
| 635 | +#endif | |
| 636 | + | |
| 637 | +#ifdef TARGET_NR_brk | |
| 638 | +static void | |
| 639 | +print_brk(const struct syscallname *name, | |
| 640 | + abi_long arg0, abi_long arg1, abi_long arg2, | |
| 641 | + abi_long arg3, abi_long arg4, abi_long arg5) | |
| 642 | +{ | |
| 643 | + print_syscall_prologue(name); | |
| 644 | + print_pointer(arg0, 1); | |
| 645 | + print_syscall_epilogue(name); | |
| 646 | +} | |
| 647 | +#endif | |
| 648 | + | |
| 649 | +#ifdef TARGET_NR_chdir | |
| 650 | +static void | |
| 651 | +print_chdir(const struct syscallname *name, | |
| 652 | + abi_long arg0, abi_long arg1, abi_long arg2, | |
| 653 | + abi_long arg3, abi_long arg4, abi_long arg5) | |
| 654 | +{ | |
| 655 | + print_syscall_prologue(name); | |
| 656 | + print_string(arg0, 1); | |
| 657 | + print_syscall_epilogue(name); | |
| 658 | +} | |
| 659 | +#endif | |
| 660 | + | |
| 661 | +#ifdef TARGET_NR_chmod | |
| 662 | +static void | |
| 663 | +print_chmod(const struct syscallname *name, | |
| 664 | + abi_long arg0, abi_long arg1, abi_long arg2, | |
| 665 | + abi_long arg3, abi_long arg4, abi_long arg5) | |
| 666 | +{ | |
| 667 | + print_syscall_prologue(name); | |
| 668 | + print_string(arg0, 0); | |
| 669 | + print_file_mode(arg1, 1); | |
| 670 | + print_syscall_epilogue(name); | |
| 671 | +} | |
| 672 | +#endif | |
| 673 | + | |
| 674 | +#ifdef TARGET_NR_creat | |
| 675 | +static void | |
| 676 | +print_creat(const struct syscallname *name, | |
| 677 | + abi_long arg0, abi_long arg1, abi_long arg2, | |
| 678 | + abi_long arg3, abi_long arg4, abi_long arg5) | |
| 679 | +{ | |
| 680 | + print_syscall_prologue(name); | |
| 681 | + print_string(arg0, 0); | |
| 682 | + print_file_mode(arg1, 1); | |
| 683 | + print_syscall_epilogue(name); | |
| 684 | +} | |
| 685 | +#endif | |
| 686 | + | |
| 687 | +#ifdef TARGET_NR_execv | |
| 688 | +static void | |
| 689 | +print_execv(const struct syscallname *name, | |
| 690 | + abi_long arg0, abi_long arg1, abi_long arg2, | |
| 691 | + abi_long arg3, abi_long arg4, abi_long arg5) | |
| 692 | +{ | |
| 693 | + print_syscall_prologue(name); | |
| 694 | + print_string(arg0, 0); | |
| 695 | + print_raw_param("0x" TARGET_ABI_FMT_lx, tswapl(arg1), 1); | |
| 696 | + print_syscall_epilogue(name); | |
| 697 | +} | |
| 698 | +#endif | |
| 699 | + | |
| 700 | +#ifdef TARGET_NR_faccessat | |
| 701 | +static void | |
| 702 | +print_faccessat(const struct syscallname *name, | |
| 703 | + abi_long arg0, abi_long arg1, abi_long arg2, | |
| 704 | + abi_long arg3, abi_long arg4, abi_long arg5) | |
| 705 | +{ | |
| 706 | + print_syscall_prologue(name); | |
| 707 | + print_at_dirfd(arg0, 0); | |
| 708 | + print_string(arg1, 0); | |
| 709 | + print_flags(access_flags, arg2, 0); | |
| 710 | + print_flags(at_file_flags, arg3, 1); | |
| 711 | + print_syscall_epilogue(name); | |
| 712 | +} | |
| 713 | +#endif | |
| 714 | + | |
| 715 | +#ifdef TARGET_NR_fchmodat | |
| 716 | +static void | |
| 717 | +print_fchmodat(const struct syscallname *name, | |
| 718 | + abi_long arg0, abi_long arg1, abi_long arg2, | |
| 719 | + abi_long arg3, abi_long arg4, abi_long arg5) | |
| 720 | +{ | |
| 721 | + print_syscall_prologue(name); | |
| 722 | + print_at_dirfd(arg0, 0); | |
| 723 | + print_string(arg1, 0); | |
| 724 | + print_file_mode(arg2, 0); | |
| 725 | + print_flags(at_file_flags, arg3, 1); | |
| 726 | + print_syscall_epilogue(name); | |
| 727 | +} | |
| 728 | +#endif | |
| 729 | + | |
| 730 | +#ifdef TARGET_NR_fchownat | |
| 731 | +static void | |
| 732 | +print_fchownat(const struct syscallname *name, | |
| 733 | + abi_long arg0, abi_long arg1, abi_long arg2, | |
| 734 | + abi_long arg3, abi_long arg4, abi_long arg5) | |
| 735 | +{ | |
| 736 | + print_syscall_prologue(name); | |
| 737 | + print_at_dirfd(arg0, 0); | |
| 738 | + print_string(arg1, 0); | |
| 739 | +#ifdef USE_UID16 | |
| 740 | + print_raw_param("%d", tswap16(arg2), 0); | |
| 741 | + print_raw_param("%d", tswap16(arg3), 0); | |
| 742 | +#else | |
| 743 | + print_raw_param("%d", tswap32(arg2), 0); | |
| 744 | + print_raw_param("%d", tswap32(arg3), 0); | |
| 745 | +#endif | |
| 746 | + print_flags(at_file_flags, arg4, 1); | |
| 747 | + print_syscall_epilogue(name); | |
| 748 | +} | |
| 749 | +#endif | |
| 750 | + | |
| 751 | +#if defined(TARGET_NR_fcntl) || defined(TARGET_NR_fcntl64) | |
| 752 | +static void | |
| 753 | +print_fcntl(const struct syscallname *name, | |
| 754 | + abi_long arg0, abi_long arg1, abi_long arg2, | |
| 755 | + abi_long arg3, abi_long arg4, abi_long arg5) | |
| 756 | +{ | |
| 757 | + print_syscall_prologue(name); | |
| 758 | + print_raw_param("%d", tswap32(arg0), 0); | |
| 759 | + print_flags(fcntl_flags, arg1, 0); | |
| 760 | + /* | |
| 761 | + * TODO: check flags and print following argument only | |
| 762 | + * when needed. | |
| 763 | + */ | |
| 764 | + print_pointer(arg2, 1); | |
| 765 | + print_syscall_epilogue(name); | |
| 766 | +} | |
| 767 | +#define print_fcntl64 print_fcntl | |
| 768 | +#endif | |
| 769 | + | |
| 770 | + | |
| 771 | +#ifdef TARGET_NR_futimesat | |
| 772 | +static void | |
| 773 | +print_futimesat(const struct syscallname *name, | |
| 774 | + abi_long arg0, abi_long arg1, abi_long arg2, | |
| 775 | + abi_long arg3, abi_long arg4, abi_long arg5) | |
| 776 | +{ | |
| 777 | + print_syscall_prologue(name); | |
| 778 | + print_at_dirfd(arg0, 0); | |
| 779 | + print_string(arg1, 0); | |
| 780 | + print_timeval(arg2, 0); | |
| 781 | + print_timeval(arg2 + sizeof (struct target_timeval), 1); | |
| 782 | + print_syscall_epilogue(name); | |
| 783 | +} | |
| 784 | +#endif | |
| 785 | + | |
| 786 | +#ifdef TARGET_NR_link | |
| 787 | +static void | |
| 788 | +print_link(const struct syscallname *name, | |
| 789 | + abi_long arg0, abi_long arg1, abi_long arg2, | |
| 790 | + abi_long arg3, abi_long arg4, abi_long arg5) | |
| 791 | +{ | |
| 792 | + print_syscall_prologue(name); | |
| 793 | + print_string(arg0, 0); | |
| 794 | + print_string(arg1, 1); | |
| 795 | + print_syscall_epilogue(name); | |
| 796 | +} | |
| 797 | +#endif | |
| 798 | + | |
| 799 | +#ifdef TARGET_NR_linkat | |
| 800 | +static void | |
| 801 | +print_linkat(const struct syscallname *name, | |
| 802 | + abi_long arg0, abi_long arg1, abi_long arg2, | |
| 803 | + abi_long arg3, abi_long arg4, abi_long arg5) | |
| 804 | +{ | |
| 805 | + print_syscall_prologue(name); | |
| 806 | + print_at_dirfd(arg0, 0); | |
| 807 | + print_string(arg1, 0); | |
| 808 | + print_at_dirfd(arg2, 0); | |
| 809 | + print_string(arg3, 0); | |
| 810 | + print_flags(at_file_flags, arg4, 1); | |
| 811 | + print_syscall_epilogue(name); | |
| 812 | +} | |
| 813 | +#endif | |
| 814 | + | |
| 815 | +#if defined(TARGET_NR_stat) || defined(TARGET_NR_stat64) || \ | |
| 816 | + defined(TARGET_NR_lstat) || defined(TARGET_NR_lstat64) | |
| 817 | +static void | |
| 818 | +print_stat(const struct syscallname *name, | |
| 819 | + abi_long arg0, abi_long arg1, abi_long arg2, | |
| 820 | + abi_long arg3, abi_long arg4, abi_long arg5) | |
| 821 | +{ | |
| 822 | + print_syscall_prologue(name); | |
| 823 | + print_string(arg0, 0); | |
| 824 | + print_pointer(arg1, 1); | |
| 825 | + print_syscall_epilogue(name); | |
| 826 | +} | |
| 827 | +#define print_lstat print_stat | |
| 828 | +#define print_stat64 print_stat | |
| 829 | +#define print_lstat64 print_stat | |
| 830 | +#endif | |
| 831 | + | |
| 832 | +#if defined(TARGET_NR_fstat) || defined(TARGET_NR_fstat64) | |
| 833 | +static void | |
| 834 | +print_fstat(const struct syscallname *name, | |
| 835 | + abi_long arg0, abi_long arg1, abi_long arg2, | |
| 836 | + abi_long arg3, abi_long arg4, abi_long arg5) | |
| 837 | +{ | |
| 838 | + print_syscall_prologue(name); | |
| 839 | + print_raw_param("%d", tswap32(arg0), 0); | |
| 840 | + print_pointer(arg1, 1); | |
| 841 | + print_syscall_epilogue(name); | |
| 842 | +} | |
| 843 | +#define print_fstat64 print_fstat | |
| 844 | +#endif | |
| 845 | + | |
| 846 | +#ifdef TARGET_NR_mkdir | |
| 847 | +static void | |
| 848 | +print_mkdir(const struct syscallname *name, | |
| 849 | + abi_long arg0, abi_long arg1, abi_long arg2, | |
| 850 | + abi_long arg3, abi_long arg4, abi_long arg5) | |
| 851 | +{ | |
| 852 | + print_syscall_prologue(name); | |
| 853 | + print_string(arg0, 0); | |
| 854 | + print_file_mode(arg1, 1); | |
| 855 | + print_syscall_epilogue(name); | |
| 856 | +} | |
| 857 | +#endif | |
| 858 | + | |
| 859 | +#ifdef TARGET_NR_mkdirat | |
| 860 | +static void | |
| 861 | +print_mkdirat(const struct syscallname *name, | |
| 862 | + abi_long arg0, abi_long arg1, abi_long arg2, | |
| 863 | + abi_long arg3, abi_long arg4, abi_long arg5) | |
| 864 | +{ | |
| 865 | + print_syscall_prologue(name); | |
| 866 | + print_at_dirfd(arg0, 0); | |
| 867 | + print_string(arg1, 0); | |
| 868 | + print_file_mode(arg2, 1); | |
| 869 | + print_syscall_epilogue(name); | |
| 870 | +} | |
| 871 | +#endif | |
| 872 | + | |
| 873 | +#ifdef TARGET_NR_mknod | |
| 874 | +static void | |
| 875 | +print_mknod(const struct syscallname *name, | |
| 876 | + abi_long arg0, abi_long arg1, abi_long arg2, | |
| 877 | + abi_long arg3, abi_long arg4, abi_long arg5) | |
| 878 | +{ | |
| 879 | + int hasdev = (tswapl(arg1) & (S_IFCHR|S_IFBLK)); | |
| 880 | + | |
| 881 | + print_syscall_prologue(name); | |
| 882 | + print_string(arg0, 0); | |
| 883 | + print_file_mode(arg1, (hasdev == 0)); | |
| 884 | + if (hasdev) { | |
| 885 | + print_raw_param("makedev(%d", major(tswapl(arg2)), 0); | |
| 886 | + print_raw_param("%d)", minor(tswapl(arg2)), 1); | |
| 887 | + } | |
| 888 | + print_syscall_epilogue(name); | |
| 889 | +} | |
| 890 | +#endif | |
| 891 | + | |
| 892 | +#ifdef TARGET_NR_mknodat | |
| 893 | +static void | |
| 894 | +print_mknodat(const struct syscallname *name, | |
| 895 | + abi_long arg0, abi_long arg1, abi_long arg2, | |
| 896 | + abi_long arg3, abi_long arg4, abi_long arg5) | |
| 897 | +{ | |
| 898 | + int hasdev = (tswapl(arg2) & (S_IFCHR|S_IFBLK)); | |
| 899 | + | |
| 900 | + print_syscall_prologue(name); | |
| 901 | + print_at_dirfd(arg0, 0); | |
| 902 | + print_string(arg1, 0); | |
| 903 | + print_file_mode(arg2, (hasdev == 0)); | |
| 904 | + if (hasdev) { | |
| 905 | + print_raw_param("makedev(%d", major(tswapl(arg3)), 0); | |
| 906 | + print_raw_param("%d)", minor(tswapl(arg3)), 1); | |
| 907 | + } | |
| 908 | + print_syscall_epilogue(name); | |
| 909 | +} | |
| 910 | +#endif | |
| 911 | + | |
| 912 | +#ifdef TARGET_NR_mq_open | |
| 913 | +static void | |
| 914 | +print_mq_open(const struct syscallname *name, | |
| 915 | + abi_long arg0, abi_long arg1, abi_long arg2, | |
| 916 | + abi_long arg3, abi_long arg4, abi_long arg5) | |
| 917 | +{ | |
| 918 | + int is_creat = (tswapl(arg1) & TARGET_O_CREAT); | |
| 919 | + | |
| 920 | + print_syscall_prologue(name); | |
| 921 | + print_string(arg0, 0); | |
| 922 | + print_open_flags(arg1, (is_creat == 0)); | |
| 923 | + if (is_creat) { | |
| 924 | + print_file_mode(arg2, 0); | |
| 925 | + print_pointer(arg3, 1); | |
| 926 | + } | |
| 927 | + print_syscall_epilogue(name); | |
| 928 | +} | |
| 929 | +#endif | |
| 930 | + | |
| 931 | +#ifdef TARGET_NR_open | |
| 932 | +static void | |
| 933 | +print_open(const struct syscallname *name, | |
| 934 | + abi_long arg0, abi_long arg1, abi_long arg2, | |
| 935 | + abi_long arg3, abi_long arg4, abi_long arg5) | |
| 936 | +{ | |
| 937 | + int is_creat = (tswap32(arg1) & TARGET_O_CREAT); | |
| 938 | + | |
| 939 | + print_syscall_prologue(name); | |
| 940 | + print_string(arg0, 0); | |
| 941 | + print_open_flags(arg1, (is_creat == 0)); | |
| 942 | + if (is_creat) | |
| 943 | + print_file_mode(arg2, 1); | |
| 944 | + print_syscall_epilogue(name); | |
| 945 | +} | |
| 946 | +#endif | |
| 947 | + | |
| 948 | +#ifdef TARGET_NR_openat | |
| 949 | +static void | |
| 950 | +print_openat(const struct syscallname *name, | |
| 951 | + abi_long arg0, abi_long arg1, abi_long arg2, | |
| 952 | + abi_long arg3, abi_long arg4, abi_long arg5) | |
| 953 | +{ | |
| 954 | + int is_creat = (tswap32(arg2) & TARGET_O_CREAT); | |
| 955 | + | |
| 956 | + print_syscall_prologue(name); | |
| 957 | + print_at_dirfd(arg0, 0); | |
| 958 | + print_string(arg1, 0); | |
| 959 | + print_open_flags(arg2, (is_creat == 0)); | |
| 960 | + if (is_creat) | |
| 961 | + print_file_mode(arg3, 1); | |
| 962 | + print_syscall_epilogue(name); | |
| 963 | +} | |
| 964 | +#endif | |
| 965 | + | |
| 966 | +#ifdef TARGET_NR_mq_unlink | |
| 967 | +static void | |
| 968 | +print_mq_unlink(const struct syscallname *name, | |
| 969 | + abi_long arg0, abi_long arg1, abi_long arg2, | |
| 970 | + abi_long arg3, abi_long arg4, abi_long arg5) | |
| 971 | +{ | |
| 972 | + print_syscall_prologue(name); | |
| 973 | + print_string(arg0, 1); | |
| 974 | + print_syscall_epilogue(name); | |
| 975 | +} | |
| 976 | +#endif | |
| 977 | + | |
| 978 | +#if defined(TARGET_NR_fstatat64) || defined(TARGET_NR_newfstatat) | |
| 979 | +static void | |
| 980 | +print_fstatat64(const struct syscallname *name, | |
| 981 | + abi_long arg0, abi_long arg1, abi_long arg2, | |
| 982 | + abi_long arg3, abi_long arg4, abi_long arg5) | |
| 983 | +{ | |
| 984 | + print_syscall_prologue(name); | |
| 985 | + print_at_dirfd(arg0, 0); | |
| 986 | + print_string(arg1, 0); | |
| 987 | + print_pointer(arg2, 0); | |
| 988 | + print_flags(at_file_flags, arg3, 1); | |
| 989 | + print_syscall_epilogue(name); | |
| 990 | +} | |
| 991 | +#define print_newfstatat print_fstatat64 | |
| 992 | +#endif | |
| 993 | + | |
| 994 | +#ifdef TARGET_NR_readlink | |
| 995 | +static void | |
| 996 | +print_readlink(const struct syscallname *name, | |
| 997 | + abi_long arg0, abi_long arg1, abi_long arg2, | |
| 998 | + abi_long arg3, abi_long arg4, abi_long arg5) | |
| 999 | +{ | |
| 1000 | + print_syscall_prologue(name); | |
| 1001 | + print_string(arg0, 0); | |
| 1002 | + print_pointer(arg1, 0); | |
| 1003 | + print_raw_param("%u", tswapl(arg2), 1); | |
| 1004 | + print_syscall_epilogue(name); | |
| 1005 | +} | |
| 1006 | +#endif | |
| 1007 | + | |
| 1008 | +#ifdef TARGET_NR_readlinkat | |
| 1009 | +static void | |
| 1010 | +print_readlinkat(const struct syscallname *name, | |
| 1011 | + abi_long arg0, abi_long arg1, abi_long arg2, | |
| 1012 | + abi_long arg3, abi_long arg4, abi_long arg5) | |
| 1013 | +{ | |
| 1014 | + print_syscall_prologue(name); | |
| 1015 | + print_at_dirfd(arg0, 0); | |
| 1016 | + print_string(arg1, 0); | |
| 1017 | + print_pointer(arg2, 0); | |
| 1018 | + print_raw_param("%u", tswapl(arg3), 1); | |
| 1019 | + print_syscall_epilogue(name); | |
| 1020 | +} | |
| 1021 | +#endif | |
| 1022 | + | |
| 1023 | +#ifdef TARGET_NR_rename | |
| 1024 | +static void | |
| 1025 | +print_rename(const struct syscallname *name, | |
| 1026 | + abi_long arg0, abi_long arg1, abi_long arg2, | |
| 1027 | + abi_long arg3, abi_long arg4, abi_long arg5) | |
| 1028 | +{ | |
| 1029 | + print_syscall_prologue(name); | |
| 1030 | + print_string(arg0, 0); | |
| 1031 | + print_string(arg1, 1); | |
| 1032 | + print_syscall_epilogue(name); | |
| 1033 | +} | |
| 1034 | +#endif | |
| 1035 | + | |
| 1036 | +#ifdef TARGET_NR_renameat | |
| 1037 | +static void | |
| 1038 | +print_renameat(const struct syscallname *name, | |
| 1039 | + abi_long arg0, abi_long arg1, abi_long arg2, | |
| 1040 | + abi_long arg3, abi_long arg4, abi_long arg5) | |
| 1041 | +{ | |
| 1042 | + print_syscall_prologue(name); | |
| 1043 | + print_at_dirfd(arg0, 0); | |
| 1044 | + print_string(arg1, 0); | |
| 1045 | + print_at_dirfd(arg2, 0); | |
| 1046 | + print_string(arg3, 1); | |
| 1047 | + print_syscall_epilogue(name); | |
| 1048 | +} | |
| 1049 | +#endif | |
| 1050 | + | |
| 1051 | +#ifdef TARGET_NR_statfs | |
| 1052 | +static void | |
| 1053 | +print_statfs(const struct syscallname *name, | |
| 1054 | + abi_long arg0, abi_long arg1, abi_long arg2, | |
| 1055 | + abi_long arg3, abi_long arg4, abi_long arg5) | |
| 1056 | +{ | |
| 1057 | + print_syscall_prologue(name); | |
| 1058 | + print_string(arg0, 0); | |
| 1059 | + print_pointer(arg1, 1); | |
| 1060 | + print_syscall_epilogue(name); | |
| 1061 | +} | |
| 1062 | +#define print_statfs64 print_statfs | |
| 1063 | +#endif | |
| 1064 | + | |
| 1065 | +#ifdef TARGET_NR_symlink | |
| 1066 | +static void | |
| 1067 | +print_symlink(const struct syscallname *name, | |
| 1068 | + abi_long arg0, abi_long arg1, abi_long arg2, | |
| 1069 | + abi_long arg3, abi_long arg4, abi_long arg5) | |
| 1070 | +{ | |
| 1071 | + print_syscall_prologue(name); | |
| 1072 | + print_string(arg0, 0); | |
| 1073 | + print_string(arg1, 1); | |
| 1074 | + print_syscall_epilogue(name); | |
| 1075 | +} | |
| 1076 | +#endif | |
| 1077 | + | |
| 1078 | +#ifdef TARGET_NR_symlinkat | |
| 1079 | +static void | |
| 1080 | +print_symlinkat(const struct syscallname *name, | |
| 1081 | + abi_long arg0, abi_long arg1, abi_long arg2, | |
| 1082 | + abi_long arg3, abi_long arg4, abi_long arg5) | |
| 1083 | +{ | |
| 1084 | + print_syscall_prologue(name); | |
| 1085 | + print_string(arg0, 0); | |
| 1086 | + print_at_dirfd(arg1, 0); | |
| 1087 | + print_string(arg2, 1); | |
| 1088 | + print_syscall_epilogue(name); | |
| 1089 | +} | |
| 1090 | +#endif | |
| 1091 | + | |
| 1092 | +#ifdef TARGET_NR_mount | |
| 1093 | +static void | |
| 1094 | +print_mount(const struct syscallname *name, | |
| 1095 | + abi_long arg0, abi_long arg1, abi_long arg2, | |
| 1096 | + abi_long arg3, abi_long arg4, abi_long arg5) | |
| 1097 | +{ | |
| 1098 | + print_syscall_prologue(name); | |
| 1099 | + print_string(arg0, 0); | |
| 1100 | + print_string(arg1, 0); | |
| 1101 | + print_string(arg2, 0); | |
| 1102 | + print_flags(mount_flags, arg3, 0); | |
| 1103 | + print_pointer(arg4, 1); | |
| 1104 | + print_syscall_epilogue(name); | |
| 1105 | +} | |
| 1106 | +#endif | |
| 1107 | + | |
| 1108 | +#ifdef TARGET_NR_umount | |
| 1109 | +static void | |
| 1110 | +print_umount(const struct syscallname *name, | |
| 1111 | + abi_long arg0, abi_long arg1, abi_long arg2, | |
| 1112 | + abi_long arg3, abi_long arg4, abi_long arg5) | |
| 1113 | +{ | |
| 1114 | + print_syscall_prologue(name); | |
| 1115 | + print_string(arg0, 1); | |
| 1116 | + print_syscall_epilogue(name); | |
| 1117 | +} | |
| 1118 | +#endif | |
| 1119 | + | |
| 1120 | +#ifdef TARGET_NR_umount2 | |
| 1121 | +static void | |
| 1122 | +print_umount2(const struct syscallname *name, | |
| 1123 | + abi_long arg0, abi_long arg1, abi_long arg2, | |
| 1124 | + abi_long arg3, abi_long arg4, abi_long arg5) | |
| 1125 | +{ | |
| 1126 | + print_syscall_prologue(name); | |
| 1127 | + print_string(arg0, 0); | |
| 1128 | + print_flags(umount2_flags, arg1, 1); | |
| 1129 | + print_syscall_epilogue(name); | |
| 1130 | +} | |
| 1131 | +#endif | |
| 1132 | + | |
| 1133 | +#ifdef TARGET_NR_unlink | |
| 1134 | +static void | |
| 1135 | +print_unlink(const struct syscallname *name, | |
| 1136 | + abi_long arg0, abi_long arg1, abi_long arg2, | |
| 1137 | + abi_long arg3, abi_long arg4, abi_long arg5) | |
| 1138 | +{ | |
| 1139 | + print_syscall_prologue(name); | |
| 1140 | + print_string(arg0, 1); | |
| 1141 | + print_syscall_epilogue(name); | |
| 1142 | +} | |
| 1143 | +#endif | |
| 1144 | + | |
| 1145 | +#ifdef TARGET_NR_unlinkat | |
| 1146 | +static void | |
| 1147 | +print_unlinkat(const struct syscallname *name, | |
| 1148 | + abi_long arg0, abi_long arg1, abi_long arg2, | |
| 1149 | + abi_long arg3, abi_long arg4, abi_long arg5) | |
| 1150 | +{ | |
| 1151 | + print_syscall_prologue(name); | |
| 1152 | + print_at_dirfd(arg0, 0); | |
| 1153 | + print_string(arg1, 0); | |
| 1154 | + print_flags(unlinkat_flags, arg2, 1); | |
| 1155 | + print_syscall_epilogue(name); | |
| 1156 | +} | |
| 1157 | +#endif | |
| 1158 | + | |
| 1159 | +#ifdef TARGET_NR_utime | |
| 1160 | +static void | |
| 1161 | +print_utime(const struct syscallname *name, | |
| 1162 | + abi_long arg0, abi_long arg1, abi_long arg2, | |
| 1163 | + abi_long arg3, abi_long arg4, abi_long arg5) | |
| 1164 | +{ | |
| 1165 | + print_syscall_prologue(name); | |
| 1166 | + print_string(arg0, 0); | |
| 1167 | + print_pointer(arg1, 1); | |
| 1168 | + print_syscall_epilogue(name); | |
| 1169 | +} | |
| 1170 | +#endif | |
| 1171 | + | |
| 1172 | +#ifdef TARGET_NR_utimes | |
| 1173 | +static void | |
| 1174 | +print_utimes(const struct syscallname *name, | |
| 1175 | + abi_long arg0, abi_long arg1, abi_long arg2, | |
| 1176 | + abi_long arg3, abi_long arg4, abi_long arg5) | |
| 1177 | +{ | |
| 1178 | + print_syscall_prologue(name); | |
| 1179 | + print_string(arg0, 0); | |
| 1180 | + print_pointer(arg1, 1); | |
| 1181 | + print_syscall_epilogue(name); | |
| 1182 | +} | |
| 1183 | +#endif | |
| 1184 | + | |
| 1185 | +#ifdef TARGET_NR_utimensat | |
| 1186 | +static void | |
| 1187 | +print_utimensat(const struct syscallname *name, | |
| 1188 | + abi_long arg0, abi_long arg1, abi_long arg2, | |
| 1189 | + abi_long arg3, abi_long arg4, abi_long arg5) | |
| 1190 | +{ | |
| 1191 | + print_syscall_prologue(name); | |
| 1192 | + print_at_dirfd(arg0, 0); | |
| 1193 | + print_string(arg1, 0); | |
| 1194 | + print_pointer(arg2, 0); | |
| 1195 | + print_flags(at_file_flags, arg3, 1); | |
| 1196 | + print_syscall_epilogue(name); | |
| 1197 | +} | |
| 1198 | +#endif | |
| 1199 | + | |
| 1200 | +#ifdef TARGET_NR_mmap | |
| 1201 | +static void | |
| 1202 | +print_mmap(const struct syscallname *name, | |
| 1203 | + abi_long arg0, abi_long arg1, abi_long arg2, | |
| 1204 | + abi_long arg3, abi_long arg4, abi_long arg5) | |
| 1205 | +{ | |
| 1206 | + print_syscall_prologue(name); | |
| 1207 | + print_pointer(arg0, 0); | |
| 1208 | + print_raw_param("%d", tswapl(arg1), 0); | |
| 1209 | + print_flags(mmap_prot_flags, arg2, 0); | |
| 1210 | + print_flags(mmap_flags, arg3, 0); | |
| 1211 | + print_raw_param("%d", tswapl(arg4), 0); | |
| 1212 | + print_raw_param("%#x", tswapl(arg5), 1); | |
| 1213 | + print_syscall_epilogue(name); | |
| 1214 | +} | |
| 1215 | +#define print_mmap2 print_mmap | |
| 1216 | +#endif | |
| 1217 | + | |
| 1218 | +#ifdef TARGET_NR_mprotect | |
| 1219 | +static void | |
| 1220 | +print_mprotect(const struct syscallname *name, | |
| 1221 | + abi_long arg0, abi_long arg1, abi_long arg2, | |
| 1222 | + abi_long arg3, abi_long arg4, abi_long arg5) | |
| 1223 | +{ | |
| 1224 | + print_syscall_prologue(name); | |
| 1225 | + print_pointer(arg0, 0); | |
| 1226 | + print_raw_param("%d", tswapl(arg1), 0); | |
| 1227 | + print_flags(mmap_prot_flags, arg2, 1); | |
| 1228 | + print_syscall_epilogue(name); | |
| 1229 | +} | |
| 1230 | +#endif | |
| 1231 | + | |
| 1232 | +#ifdef TARGET_NR_munmap | |
| 1233 | +static void | |
| 1234 | +print_munmap(const struct syscallname *name, | |
| 1235 | + abi_long arg0, abi_long arg1, abi_long arg2, | |
| 1236 | + abi_long arg3, abi_long arg4, abi_long arg5) | |
| 1237 | +{ | |
| 1238 | + print_syscall_prologue(name); | |
| 1239 | + print_pointer(arg0, 0); | |
| 1240 | + print_raw_param("%d", tswapl(arg1), 1); | |
| 1241 | + print_syscall_epilogue(name); | |
| 1242 | +} | |
| 1243 | +#endif | |
| 1244 | + | |
| 1245 | +#ifdef TARGET_NR_futex | |
| 1246 | +static void print_futex_op(abi_long tflag, int last) | |
| 1247 | +{ | |
| 1248 | +#define print_op(val) \ | |
| 1249 | +if( cmd == val ) { \ | |
| 1250 | + gemu_log(#val); \ | |
| 1251 | + return; \ | |
| 1252 | +} | |
| 1253 | + | |
| 1254 | + int cmd = (int)tswap32(tflag); | |
| 1255 | +#ifdef FUTEX_PRIVATE_FLAG | |
| 1256 | + if (cmd == FUTEX_PRIVATE_FLAG) | |
| 1257 | + gemu_log("FUTEX_PRIVATE_FLAG|"); | |
| 1258 | +#endif | |
| 1259 | + print_op(FUTEX_WAIT) | |
| 1260 | + print_op(FUTEX_WAKE) | |
| 1261 | + print_op(FUTEX_FD) | |
| 1262 | + print_op(FUTEX_REQUEUE) | |
| 1263 | + print_op(FUTEX_CMP_REQUEUE) | |
| 1264 | + print_op(FUTEX_WAKE_OP) | |
| 1265 | + print_op(FUTEX_LOCK_PI) | |
| 1266 | + print_op(FUTEX_UNLOCK_PI) | |
| 1267 | + print_op(FUTEX_TRYLOCK_PI) | |
| 1268 | +#ifdef FUTEX_WAIT_BITSET | |
| 1269 | + print_op(FUTEX_WAIT_BITSET) | |
| 1270 | +#endif | |
| 1271 | +#ifdef FUTEX_WAKE_BITSET | |
| 1272 | + print_op(FUTEX_WAKE_BITSET) | |
| 1273 | +#endif | |
| 1274 | + /* unknown values */ | |
| 1275 | + gemu_log("%d",cmd); | |
| 1276 | +} | |
| 1277 | + | |
| 1278 | +static void | |
| 1279 | +print_futex(const struct syscallname *name, | |
| 1280 | + abi_long arg0, abi_long arg1, abi_long arg2, | |
| 1281 | + abi_long arg3, abi_long arg4, abi_long arg5) | |
| 1282 | +{ | |
| 1283 | + print_syscall_prologue(name); | |
| 1284 | + print_pointer(arg0, 0); | |
| 1285 | + print_futex_op(arg1, 0); | |
| 1286 | + print_raw_param(",%d", tswapl(arg2), 0); | |
| 1287 | + print_pointer(arg3, 0); /* struct timespec */ | |
| 1288 | + print_pointer(arg4, 0); | |
| 1289 | + print_raw_param("%d", tswapl(arg4), 1); | |
| 1290 | + print_syscall_epilogue(name); | |
| 1291 | +} | |
| 1292 | +#endif | |
| 1293 | + | |
| 258 | 1294 | /* |
| 259 | 1295 | * An array of all of the syscalls we know about |
| 260 | 1296 | */ | ... | ... |
linux-user/strace.list
| 1 | +/* | |
| 2 | + * Note that if you change format strings in these, check also | |
| 3 | + * that corresponding print functions are able to handle string | |
| 4 | + * locking correctly (see strace.c). | |
| 5 | + */ | |
| 1 | 6 | #ifdef TARGET_NR_accept |
| 2 | -{ TARGET_NR_accept, "accept" , "%s(%d,%#x,%#x)", NULL, NULL }, | |
| 7 | +{ TARGET_NR_accept, "accept" , NULL, print_accept, NULL }, | |
| 3 | 8 | #endif |
| 4 | 9 | #ifdef TARGET_NR_access |
| 5 | -{ TARGET_NR_access, "access" , "%s(\"%s\",%#o)", NULL, NULL }, | |
| 10 | +{ TARGET_NR_access, "access" , NULL, print_access, NULL }, | |
| 6 | 11 | #endif |
| 7 | 12 | #ifdef TARGET_NR_acct |
| 8 | 13 | { TARGET_NR_acct, "acct" , NULL, NULL, NULL }, |
| ... | ... | @@ -38,7 +43,7 @@ |
| 38 | 43 | { TARGET_NR_break, "break" , NULL, NULL, NULL }, |
| 39 | 44 | #endif |
| 40 | 45 | #ifdef TARGET_NR_brk |
| 41 | -{ TARGET_NR_brk, "brk" , NULL, NULL, print_syscall_ret_addr }, | |
| 46 | +{ TARGET_NR_brk, "brk" , NULL, print_brk, print_syscall_ret_addr }, | |
| 42 | 47 | #endif |
| 43 | 48 | #ifdef TARGET_NR_cachectl |
| 44 | 49 | { TARGET_NR_cachectl, "cachectl" , NULL, NULL, NULL }, |
| ... | ... | @@ -53,10 +58,10 @@ |
| 53 | 58 | { TARGET_NR_capset, "capset" , NULL, NULL, NULL }, |
| 54 | 59 | #endif |
| 55 | 60 | #ifdef TARGET_NR_chdir |
| 56 | -{ TARGET_NR_chdir, "chdir" , "%s(\"%s\")", NULL, NULL }, | |
| 61 | +{ TARGET_NR_chdir, "chdir" , NULL, print_chdir, NULL }, | |
| 57 | 62 | #endif |
| 58 | 63 | #ifdef TARGET_NR_chmod |
| 59 | -{ TARGET_NR_chmod, "chmod" , "%s(\"%s\",%#o)", NULL, NULL }, | |
| 64 | +{ TARGET_NR_chmod, "chmod" , NULL, print_chmod, NULL }, | |
| 60 | 65 | #endif |
| 61 | 66 | #ifdef TARGET_NR_chown |
| 62 | 67 | { TARGET_NR_chown, "chown" , NULL, NULL, NULL }, |
| ... | ... | @@ -89,7 +94,7 @@ |
| 89 | 94 | { TARGET_NR_connect, "connect" , "%s(%d,%#x,%d)", NULL, NULL }, |
| 90 | 95 | #endif |
| 91 | 96 | #ifdef TARGET_NR_creat |
| 92 | -{ TARGET_NR_creat, "creat" , "%s(\"%s\",%#o)", NULL, NULL }, | |
| 97 | +{ TARGET_NR_creat, "creat" , NULL, print_creat, NULL }, | |
| 93 | 98 | #endif |
| 94 | 99 | #ifdef TARGET_NR_create_module |
| 95 | 100 | { TARGET_NR_create_module, "create_module" , NULL, NULL, NULL }, |
| ... | ... | @@ -122,7 +127,7 @@ |
| 122 | 127 | { TARGET_NR_epoll_wait_old, "epoll_wait_old" , NULL, NULL, NULL }, |
| 123 | 128 | #endif |
| 124 | 129 | #ifdef TARGET_NR_execv |
| 125 | -{ TARGET_NR_execv, "execv" , "%s(\"%s\",%ld,%ld,%ld,%ld,%ld)\n", NULL, NULL }, | |
| 130 | +{ TARGET_NR_execv, "execv" , NULL, print_execv, NULL }, | |
| 126 | 131 | #endif |
| 127 | 132 | #ifdef TARGET_NR_execve |
| 128 | 133 | { TARGET_NR_execve, "execve" , NULL, print_execve, NULL }, |
| ... | ... | @@ -140,7 +145,7 @@ |
| 140 | 145 | { TARGET_NR_exit_group, "exit_group" , "%s(%d)\n", NULL, NULL }, |
| 141 | 146 | #endif |
| 142 | 147 | #ifdef TARGET_NR_faccessat |
| 143 | -{ TARGET_NR_faccessat, "faccessat" , "%s(%d,\"%s\",%#o,%#x)", NULL, NULL }, | |
| 148 | +{ TARGET_NR_faccessat, "faccessat" , NULL, print_faccessat, NULL }, | |
| 144 | 149 | #endif |
| 145 | 150 | #ifdef TARGET_NR_fadvise64 |
| 146 | 151 | { TARGET_NR_fadvise64, "fadvise64" , NULL, NULL, NULL }, |
| ... | ... | @@ -155,22 +160,22 @@ |
| 155 | 160 | { TARGET_NR_fchmod, "fchmod" , "%s(%d,%#o)", NULL, NULL }, |
| 156 | 161 | #endif |
| 157 | 162 | #ifdef TARGET_NR_fchmodat |
| 158 | -{ TARGET_NR_fchmodat, "fchmodat" , "%s(%d,\"%s\",%#o,%#x)", NULL, NULL }, | |
| 163 | +{ TARGET_NR_fchmodat, "fchmodat" , NULL, print_fchmodat, NULL }, | |
| 159 | 164 | #endif |
| 160 | 165 | #ifdef TARGET_NR_fchown |
| 161 | -{ TARGET_NR_fchown, "fchown" , "%s(\"%s\",%d,%d)", NULL, NULL }, | |
| 166 | +{ TARGET_NR_fchown, "fchown" , "%s(%d,%d,%d)", NULL, NULL }, | |
| 162 | 167 | #endif |
| 163 | 168 | #ifdef TARGET_NR_fchown32 |
| 164 | 169 | { TARGET_NR_fchown32, "fchown32" , NULL, NULL, NULL }, |
| 165 | 170 | #endif |
| 166 | 171 | #ifdef TARGET_NR_fchownat |
| 167 | -{ TARGET_NR_fchownat, "fchownat" , "%s(%d,\"%s\",%d,%d,%#x)", NULL, NULL }, | |
| 172 | +{ TARGET_NR_fchownat, "fchownat" , NULL, print_fchownat, NULL }, | |
| 168 | 173 | #endif |
| 169 | 174 | #ifdef TARGET_NR_fcntl |
| 170 | -{ TARGET_NR_fcntl, "fcntl" , NULL, NULL, NULL }, | |
| 175 | +{ TARGET_NR_fcntl, "fcntl" , NULL, print_fcntl, NULL }, | |
| 171 | 176 | #endif |
| 172 | 177 | #ifdef TARGET_NR_fcntl64 |
| 173 | -{ TARGET_NR_fcntl64, "fcntl64" , NULL, NULL, NULL }, | |
| 178 | +{ TARGET_NR_fcntl64, "fcntl64" , NULL, print_fcntl64, NULL }, | |
| 174 | 179 | #endif |
| 175 | 180 | #ifdef TARGET_NR_fdatasync |
| 176 | 181 | { TARGET_NR_fdatasync, "fdatasync" , NULL, NULL, NULL }, |
| ... | ... | @@ -194,10 +199,10 @@ |
| 194 | 199 | { TARGET_NR_fsetxattr, "fsetxattr" , NULL, NULL, NULL }, |
| 195 | 200 | #endif |
| 196 | 201 | #ifdef TARGET_NR_fstat |
| 197 | -{ TARGET_NR_fstat, "fstat" , "%s(%d,%p)", NULL, NULL }, | |
| 202 | +{ TARGET_NR_fstat, "fstat" , NULL, print_fstat, NULL }, | |
| 198 | 203 | #endif |
| 199 | 204 | #ifdef TARGET_NR_fstat64 |
| 200 | -{ TARGET_NR_fstat64, "fstat64" , "%s(%d,%p)", NULL, NULL }, | |
| 205 | +{ TARGET_NR_fstat64, "fstat64" , NULL, print_fstat64, NULL }, | |
| 201 | 206 | #endif |
| 202 | 207 | #ifdef TARGET_NR_fstatfs |
| 203 | 208 | { TARGET_NR_fstatfs, "fstatfs" , "%s(%d,%p)", NULL, NULL }, |
| ... | ... | @@ -218,10 +223,10 @@ |
| 218 | 223 | { TARGET_NR_ftruncate64, "ftruncate64" , NULL, NULL, NULL }, |
| 219 | 224 | #endif |
| 220 | 225 | #ifdef TARGET_NR_futex |
| 221 | -{ TARGET_NR_futex, "futex" , NULL, NULL, NULL }, | |
| 226 | +{ TARGET_NR_futex, "futex" , NULL, print_futex, NULL }, | |
| 222 | 227 | #endif |
| 223 | 228 | #ifdef TARGET_NR_futimesat |
| 224 | -{ TARGET_NR_futimesat, "futimesat" , "%s(%d,\"%s\",%p)", NULL, NULL }, | |
| 229 | +{ TARGET_NR_futimesat, "futimesat" , NULL, print_futimesat, NULL }, | |
| 225 | 230 | #endif |
| 226 | 231 | #ifdef TARGET_NR_getcwd |
| 227 | 232 | { TARGET_NR_getcwd, "getcwd" , "%s(%p,%d)", NULL, NULL }, |
| ... | ... | @@ -425,10 +430,10 @@ |
| 425 | 430 | { TARGET_NR_lgetxattr, "lgetxattr" , NULL, NULL, NULL }, |
| 426 | 431 | #endif |
| 427 | 432 | #ifdef TARGET_NR_link |
| 428 | -{ TARGET_NR_link, "link" , "%s(\"%s\",\"%s\")", NULL, NULL }, | |
| 433 | +{ TARGET_NR_link, "link" , NULL, print_link, NULL }, | |
| 429 | 434 | #endif |
| 430 | 435 | #ifdef TARGET_NR_linkat |
| 431 | -{ TARGET_NR_linkat, "linkat" , "%s(%d,\"%s\",%d,\"%s\",%#x)", NULL, NULL }, | |
| 436 | +{ TARGET_NR_linkat, "linkat" , NULL, print_linkat, NULL }, | |
| 432 | 437 | #endif |
| 433 | 438 | #ifdef TARGET_NR_Linux |
| 434 | 439 | { TARGET_NR_Linux, "Linux" , NULL, NULL, NULL }, |
| ... | ... | @@ -461,10 +466,10 @@ |
| 461 | 466 | { TARGET_NR_lsetxattr, "lsetxattr" , NULL, NULL, NULL }, |
| 462 | 467 | #endif |
| 463 | 468 | #ifdef TARGET_NR_lstat |
| 464 | -{ TARGET_NR_lstat, "lstat" , "%s(\"%s\",%p)", NULL, NULL }, | |
| 469 | +{ TARGET_NR_lstat, "lstat" , NULL, print_lstat, NULL }, | |
| 465 | 470 | #endif |
| 466 | 471 | #ifdef TARGET_NR_lstat64 |
| 467 | -{ TARGET_NR_lstat64, "lstat64" , "%s(\"%s\",%p)", NULL, NULL }, | |
| 472 | +{ TARGET_NR_lstat64, "lstat64" , NULL, print_lstat64, NULL }, | |
| 468 | 473 | #endif |
| 469 | 474 | #ifdef TARGET_NR_madvise |
| 470 | 475 | { TARGET_NR_madvise, "madvise" , NULL, NULL, NULL }, |
| ... | ... | @@ -485,16 +490,16 @@ |
| 485 | 490 | { TARGET_NR_mincore, "mincore" , NULL, NULL, NULL }, |
| 486 | 491 | #endif |
| 487 | 492 | #ifdef TARGET_NR_mkdir |
| 488 | -{ TARGET_NR_mkdir, "mkdir" , "%s(\"%s\",%#o)", NULL, NULL }, | |
| 493 | +{ TARGET_NR_mkdir, "mkdir" , NULL, print_mkdir, NULL }, | |
| 489 | 494 | #endif |
| 490 | 495 | #ifdef TARGET_NR_mkdirat |
| 491 | -{ TARGET_NR_mkdirat, "mkdirat" , "%s(%d,\"%s\",%#o)", NULL, NULL }, | |
| 496 | +{ TARGET_NR_mkdirat, "mkdirat" , NULL, print_mkdirat, NULL }, | |
| 492 | 497 | #endif |
| 493 | 498 | #ifdef TARGET_NR_mknod |
| 494 | -{ TARGET_NR_mknod, "mknod" , "%s(\"%s\",%#o,%#x)", NULL, NULL }, | |
| 499 | +{ TARGET_NR_mknod, "mknod" , NULL, print_mknod, NULL }, | |
| 495 | 500 | #endif |
| 496 | 501 | #ifdef TARGET_NR_mknodat |
| 497 | -{ TARGET_NR_mknodat, "mknodat" , "%s(%d,\"%s\",%#o,%#x)", NULL, NULL }, | |
| 502 | +{ TARGET_NR_mknodat, "mknodat" , NULL, print_mknodat, NULL }, | |
| 498 | 503 | #endif |
| 499 | 504 | #ifdef TARGET_NR_mlock |
| 500 | 505 | { TARGET_NR_mlock, "mlock" , NULL, NULL, NULL }, |
| ... | ... | @@ -503,22 +508,22 @@ |
| 503 | 508 | { TARGET_NR_mlockall, "mlockall" , NULL, NULL, NULL }, |
| 504 | 509 | #endif |
| 505 | 510 | #ifdef TARGET_NR_mmap |
| 506 | -{ TARGET_NR_mmap, "mmap" , NULL, NULL, print_syscall_ret_addr }, | |
| 511 | +{ TARGET_NR_mmap, "mmap" , NULL, print_mmap, print_syscall_ret_addr }, | |
| 507 | 512 | #endif |
| 508 | 513 | #ifdef TARGET_NR_mmap2 |
| 509 | -{ TARGET_NR_mmap2, "mmap2" , NULL, NULL, print_syscall_ret_addr }, | |
| 514 | +{ TARGET_NR_mmap2, "mmap2" , NULL, print_mmap2, print_syscall_ret_addr }, | |
| 510 | 515 | #endif |
| 511 | 516 | #ifdef TARGET_NR_modify_ldt |
| 512 | 517 | { TARGET_NR_modify_ldt, "modify_ldt" , NULL, NULL, NULL }, |
| 513 | 518 | #endif |
| 514 | 519 | #ifdef TARGET_NR_mount |
| 515 | -{ TARGET_NR_mount, "mount" , NULL, NULL, NULL }, | |
| 520 | +{ TARGET_NR_mount, "mount" , NULL, print_mount, NULL }, | |
| 516 | 521 | #endif |
| 517 | 522 | #ifdef TARGET_NR_move_pages |
| 518 | 523 | { TARGET_NR_move_pages, "move_pages" , NULL, NULL, NULL }, |
| 519 | 524 | #endif |
| 520 | 525 | #ifdef TARGET_NR_mprotect |
| 521 | -{ TARGET_NR_mprotect, "mprotect" , NULL, NULL, NULL }, | |
| 526 | +{ TARGET_NR_mprotect, "mprotect" , NULL, print_mprotect, NULL }, | |
| 522 | 527 | #endif |
| 523 | 528 | #ifdef TARGET_NR_mpx |
| 524 | 529 | { TARGET_NR_mpx, "mpx" , NULL, NULL, NULL }, |
| ... | ... | @@ -530,7 +535,7 @@ |
| 530 | 535 | { TARGET_NR_mq_notify, "mq_notify" , "%s(%d,%p)", NULL, NULL }, |
| 531 | 536 | #endif |
| 532 | 537 | #ifdef TARGET_NR_mq_open |
| 533 | -{ TARGET_NR_mq_open, "mq_open" , "%s(\"/%s\",%#x,%#o,%p)", NULL, NULL }, | |
| 538 | +{ TARGET_NR_mq_open, "mq_open" , NULL, print_mq_open, NULL }, | |
| 534 | 539 | #endif |
| 535 | 540 | #ifdef TARGET_NR_mq_timedreceive |
| 536 | 541 | { TARGET_NR_mq_timedreceive, "mq_timedreceive" , "%s(%d,%p,%d,%u,%p)", NULL, NULL }, |
| ... | ... | @@ -539,7 +544,7 @@ |
| 539 | 544 | { TARGET_NR_mq_timedsend, "mq_timedsend" , "%s(%d,%p,%d,%u,%p)", NULL, NULL }, |
| 540 | 545 | #endif |
| 541 | 546 | #ifdef TARGET_NR_mq_unlink |
| 542 | -{ TARGET_NR_mq_unlink, "mq_unlink" , "%s(%s)", NULL, NULL }, | |
| 547 | +{ TARGET_NR_mq_unlink, "mq_unlink" , NULL, print_mq_unlink, NULL }, | |
| 543 | 548 | #endif |
| 544 | 549 | #ifdef TARGET_NR_mremap |
| 545 | 550 | { TARGET_NR_mremap, "mremap" , NULL, NULL, NULL }, |
| ... | ... | @@ -569,16 +574,16 @@ |
| 569 | 574 | { TARGET_NR_munlockall, "munlockall" , NULL, NULL, NULL }, |
| 570 | 575 | #endif |
| 571 | 576 | #ifdef TARGET_NR_munmap |
| 572 | -{ TARGET_NR_munmap, "munmap" , "%s(%p,%d)", NULL, NULL }, | |
| 577 | +{ TARGET_NR_munmap, "munmap" , NULL, print_munmap, NULL }, | |
| 573 | 578 | #endif |
| 574 | 579 | #ifdef TARGET_NR_nanosleep |
| 575 | 580 | { TARGET_NR_nanosleep, "nanosleep" , NULL, NULL, NULL }, |
| 576 | 581 | #endif |
| 577 | 582 | #ifdef TARGET_NR_fstatat64 |
| 578 | -{ TARGET_NR_fstatat64, "fstatat64" , "%s(%d,\"%s\",%p,%#x)", NULL, NULL }, | |
| 583 | +{ TARGET_NR_fstatat64, "fstatat64" , NULL, print_fstatat64, NULL }, | |
| 579 | 584 | #endif |
| 580 | 585 | #ifdef TARGET_NR_newfstatat |
| 581 | -{ TARGET_NR_newfstatat, "newfstatat" , "%s(%d,\"%s\",%p,%#x)", NULL, NULL }, | |
| 586 | +{ TARGET_NR_newfstatat, "newfstatat" , NULL, print_newfstatat, NULL }, | |
| 582 | 587 | #endif |
| 583 | 588 | #ifdef TARGET_NR__newselect |
| 584 | 589 | { TARGET_NR__newselect, "_newselect" , NULL, print_newselect, print_syscall_ret_newselect }, |
| ... | ... | @@ -611,10 +616,10 @@ |
| 611 | 616 | { TARGET_NR_olduname, "olduname" , NULL, NULL, NULL }, |
| 612 | 617 | #endif |
| 613 | 618 | #ifdef TARGET_NR_open |
| 614 | -{ TARGET_NR_open, "open" , "%s(\"%s\",%#x,%#o)", NULL, NULL }, | |
| 619 | +{ TARGET_NR_open, "open" , NULL, print_open, NULL }, | |
| 615 | 620 | #endif |
| 616 | 621 | #ifdef TARGET_NR_openat |
| 617 | -{ TARGET_NR_openat, "openat" , "%s(%d,\"%s\",%#x,%#o)", NULL, NULL }, | |
| 622 | +{ TARGET_NR_openat, "openat" , NULL, print_openat, NULL }, | |
| 618 | 623 | #endif |
| 619 | 624 | #ifdef TARGET_NR_osf_adjtime |
| 620 | 625 | { TARGET_NR_osf_adjtime, "osf_adjtime" , NULL, NULL, NULL }, |
| ... | ... | @@ -1007,10 +1012,10 @@ |
| 1007 | 1012 | { TARGET_NR_readdir, "readdir" , NULL, NULL, NULL }, |
| 1008 | 1013 | #endif |
| 1009 | 1014 | #ifdef TARGET_NR_readlink |
| 1010 | -{ TARGET_NR_readlink, "readlink" , "%s(\"%s\",%p,%d)", NULL, NULL }, | |
| 1015 | +{ TARGET_NR_readlink, "readlink" , NULL, print_readlink, NULL }, | |
| 1011 | 1016 | #endif |
| 1012 | 1017 | #ifdef TARGET_NR_readlinkat |
| 1013 | -{ TARGET_NR_readlinkat, "readlinkat" , "%s(%d,\"%s\",%p,%d)", NULL, NULL }, | |
| 1018 | +{ TARGET_NR_readlinkat, "readlinkat" , NULL, print_readlinkat, NULL }, | |
| 1014 | 1019 | #endif |
| 1015 | 1020 | #ifdef TARGET_NR_readv |
| 1016 | 1021 | { TARGET_NR_readv, "readv" , NULL, NULL, NULL }, |
| ... | ... | @@ -1034,10 +1039,10 @@ |
| 1034 | 1039 | { TARGET_NR_removexattr, "removexattr" , NULL, NULL, NULL }, |
| 1035 | 1040 | #endif |
| 1036 | 1041 | #ifdef TARGET_NR_rename |
| 1037 | -{ TARGET_NR_rename, "rename" , "%s(\"%s\",\"%s\")", NULL, NULL }, | |
| 1042 | +{ TARGET_NR_rename, "rename" , NULL, print_rename, NULL }, | |
| 1038 | 1043 | #endif |
| 1039 | 1044 | #ifdef TARGET_NR_renameat |
| 1040 | -{ TARGET_NR_renameat, "renameat" , "%s(%d,\"%s\",%d,\"%s\")", NULL, NULL }, | |
| 1045 | +{ TARGET_NR_renameat, "renameat" , NULL, print_renameat, NULL }, | |
| 1041 | 1046 | #endif |
| 1042 | 1047 | #ifdef TARGET_NR_request_key |
| 1043 | 1048 | { TARGET_NR_request_key, "request_key" , NULL, NULL, NULL }, |
| ... | ... | @@ -1301,16 +1306,16 @@ |
| 1301 | 1306 | { TARGET_NR_ssetmask, "ssetmask" , NULL, NULL, NULL }, |
| 1302 | 1307 | #endif |
| 1303 | 1308 | #ifdef TARGET_NR_stat |
| 1304 | -{ TARGET_NR_stat, "stat" , "%s(\"%s\",%p)", NULL, NULL }, | |
| 1309 | +{ TARGET_NR_stat, "stat" , NULL, print_stat, NULL }, | |
| 1305 | 1310 | #endif |
| 1306 | 1311 | #ifdef TARGET_NR_stat64 |
| 1307 | -{ TARGET_NR_stat64, "stat64" , "%s(\"%s\",%p)", NULL, NULL }, | |
| 1312 | +{ TARGET_NR_stat64, "stat64" , NULL, print_stat64, NULL }, | |
| 1308 | 1313 | #endif |
| 1309 | 1314 | #ifdef TARGET_NR_statfs |
| 1310 | -{ TARGET_NR_statfs, "statfs" , "%s(\"%s\",%p)", NULL, NULL }, | |
| 1315 | +{ TARGET_NR_statfs, "statfs" , NULL, print_statfs, NULL }, | |
| 1311 | 1316 | #endif |
| 1312 | 1317 | #ifdef TARGET_NR_statfs64 |
| 1313 | -{ TARGET_NR_statfs64, "statfs64" , "%s(\"%s\",%p)", NULL, NULL }, | |
| 1318 | +{ TARGET_NR_statfs64, "statfs64" , NULL, print_statfs64, NULL }, | |
| 1314 | 1319 | #endif |
| 1315 | 1320 | #ifdef TARGET_NR_stime |
| 1316 | 1321 | { TARGET_NR_stime, "stime" , NULL, NULL, NULL }, |
| ... | ... | @@ -1334,10 +1339,10 @@ |
| 1334 | 1339 | { TARGET_NR_swapon, "swapon" , NULL, NULL, NULL }, |
| 1335 | 1340 | #endif |
| 1336 | 1341 | #ifdef TARGET_NR_symlink |
| 1337 | -{ TARGET_NR_symlink, "symlink" , "%s(\"%s\",\"%s\")", NULL, NULL }, | |
| 1342 | +{ TARGET_NR_symlink, "symlink" , NULL, print_symlink, NULL }, | |
| 1338 | 1343 | #endif |
| 1339 | 1344 | #ifdef TARGET_NR_symlinkat |
| 1340 | -{ TARGET_NR_symlinkat, "symlinkat" , "%s(\"%s\",%d,\"%s\")", NULL, NULL }, | |
| 1345 | +{ TARGET_NR_symlinkat, "symlinkat", NULL, print_symlinkat, NULL }, | |
| 1341 | 1346 | #endif |
| 1342 | 1347 | #ifdef TARGET_NR_sync |
| 1343 | 1348 | { TARGET_NR_sync, "sync" , NULL, NULL, NULL }, |
| ... | ... | @@ -1427,19 +1432,19 @@ |
| 1427 | 1432 | { TARGET_NR_umask, "umask" , "%s(%#o)", NULL, NULL }, |
| 1428 | 1433 | #endif |
| 1429 | 1434 | #ifdef TARGET_NR_umount |
| 1430 | -{ TARGET_NR_umount, "umount" , "%s(\"%s\",\"%s\",\"%s\",%#x,%p)", NULL, NULL }, | |
| 1435 | +{ TARGET_NR_umount, "umount" , NULL, print_umount, NULL }, | |
| 1431 | 1436 | #endif |
| 1432 | 1437 | #ifdef TARGET_NR_umount2 |
| 1433 | -{ TARGET_NR_umount2, "umount2" , NULL, NULL, NULL }, | |
| 1438 | +{ TARGET_NR_umount2, "umount2" , NULL, print_umount2, NULL }, | |
| 1434 | 1439 | #endif |
| 1435 | 1440 | #ifdef TARGET_NR_uname |
| 1436 | 1441 | { TARGET_NR_uname, "uname" , "%s(%p)", NULL, NULL }, |
| 1437 | 1442 | #endif |
| 1438 | 1443 | #ifdef TARGET_NR_unlink |
| 1439 | -{ TARGET_NR_unlink, "unlink" , "%s(\"%s\")", NULL, NULL }, | |
| 1444 | +{ TARGET_NR_unlink, "unlink" , NULL, print_unlink, NULL }, | |
| 1440 | 1445 | #endif |
| 1441 | 1446 | #ifdef TARGET_NR_unlinkat |
| 1442 | -{ TARGET_NR_unlinkat, "unlinkat" , "%s(%d,\"%s\",%#x)", NULL, NULL }, | |
| 1447 | +{ TARGET_NR_unlinkat, "unlinkat" , NULL, print_unlinkat, NULL }, | |
| 1443 | 1448 | #endif |
| 1444 | 1449 | #ifdef TARGET_NR_unshare |
| 1445 | 1450 | { TARGET_NR_unshare, "unshare" , NULL, NULL, NULL }, |
| ... | ... | @@ -1469,10 +1474,10 @@ |
| 1469 | 1474 | { TARGET_NR_ustat, "ustat" , "%s(%#x,%p)", NULL, NULL }, |
| 1470 | 1475 | #endif |
| 1471 | 1476 | #ifdef TARGET_NR_utime |
| 1472 | -{ TARGET_NR_utime, "utime" , "%s(\"%s\",%p)", NULL, NULL }, | |
| 1477 | +{ TARGET_NR_utime, "utime" , NULL, print_utime, NULL }, | |
| 1473 | 1478 | #endif |
| 1474 | 1479 | #ifdef TARGET_NR_utimes |
| 1475 | -{ TARGET_NR_utimes, "utimes" , NULL, NULL, NULL }, | |
| 1480 | +{ TARGET_NR_utimes, "utimes" , NULL, print_utimes, NULL }, | |
| 1476 | 1481 | #endif |
| 1477 | 1482 | #ifdef TARGET_NR_utrap_install |
| 1478 | 1483 | { TARGET_NR_utrap_install, "utrap_install" , NULL, NULL, NULL }, |
| ... | ... | @@ -1511,5 +1516,5 @@ |
| 1511 | 1516 | { TARGET_NR_writev, "writev" , "%s(%d,%p,%#x)", NULL, NULL }, |
| 1512 | 1517 | #endif |
| 1513 | 1518 | #ifdef TARGET_NR_utimensat |
| 1514 | -{ TARGET_NR_utimensat, "utimensat", "%s(%d,\"%s\",%p,%#x)", NULL, NULL }, | |
| 1519 | +{ TARGET_NR_utimensat, "utimensat", NULL, print_utimensat, NULL }, | |
| 1515 | 1520 | #endif | ... | ... |
linux-user/syscall.c
| ... | ... | @@ -93,12 +93,6 @@ |
| 93 | 93 | |
| 94 | 94 | //#define DEBUG |
| 95 | 95 | |
| 96 | -#if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SPARC) \ | |
| 97 | - || defined(TARGET_M68K) || defined(TARGET_SH4) || defined(TARGET_CRIS) | |
| 98 | -/* 16 bit uid wrappers emulation */ | |
| 99 | -#define USE_UID16 | |
| 100 | -#endif | |
| 101 | - | |
| 102 | 96 | //#include <linux/msdos_fs.h> |
| 103 | 97 | #define VFAT_IOCTL_READDIR_BOTH _IOR('r', 1, struct linux_dirent [2]) |
| 104 | 98 | #define VFAT_IOCTL_READDIR_SHORT _IOR('r', 2, struct linux_dirent [2]) | ... | ... |
linux-user/syscall_defs.h
| ... | ... | @@ -48,6 +48,12 @@ |
| 48 | 48 | #define TARGET_IOC_NRBITS 8 |
| 49 | 49 | #define TARGET_IOC_TYPEBITS 8 |
| 50 | 50 | |
| 51 | +#if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SPARC) \ | |
| 52 | + || defined(TARGET_M68K) || defined(TARGET_SH4) || defined(TARGET_CRIS) | |
| 53 | + /* 16 bit uid wrappers emulation */ | |
| 54 | +#define USE_UID16 | |
| 55 | +#endif | |
| 56 | + | |
| 51 | 57 | #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SH4) \ |
| 52 | 58 | || defined(TARGET_M68K) || defined(TARGET_CRIS) |
| 53 | 59 | ... | ... |