summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/truss/amd64-fbsd32.c2
-rw-r--r--usr.bin/truss/i386-fbsd.c2
-rw-r--r--usr.bin/truss/powerpc-fbsd.c3
-rw-r--r--usr.bin/truss/syscalls.c28
4 files changed, 23 insertions, 12 deletions
diff --git a/usr.bin/truss/amd64-fbsd32.c b/usr.bin/truss/amd64-fbsd32.c
index 6abd99f..4f0eabb 100644
--- a/usr.bin/truss/amd64-fbsd32.c
+++ b/usr.bin/truss/amd64-fbsd32.c
@@ -167,7 +167,7 @@ i386_syscall_entry(struct trussinfo *trussinfo, int nargs) {
iorequest.piod_op = PIOD_READ_D;
iorequest.piod_offs = (void *)parm_offset;
iorequest.piod_addr = fsc.args;
- iorequest.piod_len = nargs * sizeof(unsigned long);
+ iorequest.piod_len = (1+nargs) * sizeof(unsigned long);
ptrace(PT_IO, cpid, (caddr_t)&iorequest, 0);
if (iorequest.piod_len == 0)
return;
diff --git a/usr.bin/truss/i386-fbsd.c b/usr.bin/truss/i386-fbsd.c
index 6abd99f..4f0eabb 100644
--- a/usr.bin/truss/i386-fbsd.c
+++ b/usr.bin/truss/i386-fbsd.c
@@ -167,7 +167,7 @@ i386_syscall_entry(struct trussinfo *trussinfo, int nargs) {
iorequest.piod_op = PIOD_READ_D;
iorequest.piod_offs = (void *)parm_offset;
iorequest.piod_addr = fsc.args;
- iorequest.piod_len = nargs * sizeof(unsigned long);
+ iorequest.piod_len = (1+nargs) * sizeof(unsigned long);
ptrace(PT_IO, cpid, (caddr_t)&iorequest, 0);
if (iorequest.piod_len == 0)
return;
diff --git a/usr.bin/truss/powerpc-fbsd.c b/usr.bin/truss/powerpc-fbsd.c
index aad4b87..7b4cfb5 100644
--- a/usr.bin/truss/powerpc-fbsd.c
+++ b/usr.bin/truss/powerpc-fbsd.c
@@ -118,6 +118,9 @@ powerpc_syscall_entry(struct trussinfo *trussinfo, int nargs) {
unsigned int regargs;
struct syscall *sc;
+ /* Account for a 64-bit argument with corresponding alignment. */
+ nargs += 2;
+
cpid = trussinfo->curthread->tid;
clear_fsc();
diff --git a/usr.bin/truss/syscalls.c b/usr.bin/truss/syscalls.c
index 5eff8d6..0a8ac6b 100644
--- a/usr.bin/truss/syscalls.c
+++ b/usr.bin/truss/syscalls.c
@@ -72,6 +72,20 @@ static const char rcsid[] =
#include "extern.h"
#include "syscall.h"
+/* 64-bit alignment on 32-bit platforms. */
+#ifdef __powerpc__
+#define QUAD_ALIGN 1
+#else
+#define QUAD_ALIGN 0
+#endif
+
+/* Number of slots needed for a 64-bit argument. */
+#ifdef __LP64__
+#define QUAD_SLOTS 1
+#else
+#define QUAD_SLOTS 2
+#endif
+
/*
* This should probably be in its own file, sorted alphabetically.
*/
@@ -82,19 +96,13 @@ struct syscall syscalls[] = {
{ "readlink", 1, 3,
{ { Name, 0 } , { Readlinkres | OUT, 1 }, { Int, 2 }}},
{ "lseek", 2, 3,
-#ifdef __LP64__
- { { Int, 0 }, {Quad, 2 }, { Whence, 3 }}},
-#else
- { { Int, 0 }, {Quad, 2 }, { Whence, 4 }}},
-#endif
+ { {Int, 0}, {Quad, 1 + QUAD_ALIGN},
+ {Whence, 1 + QUAD_SLOTS + QUAD_ALIGN}}},
{ "linux_lseek", 2, 3,
{ { Int, 0 }, {Int, 1 }, { Whence, 2 }}},
{ "mmap", 2, 6,
-#ifdef __LP64__
- { { Ptr, 0 }, {Int, 1}, {Mprot, 2}, {Mmapflags, 3}, {Int, 4}, {Quad, 5}}},
-#else
- { { Ptr, 0 }, {Int, 1}, {Mprot, 2}, {Mmapflags, 3}, {Int, 4}, {Quad, 6}}},
-#endif
+ { {Ptr, 0}, {Int, 1}, {Mprot, 2}, {Mmapflags, 3}, {Int, 4},
+ {Quad, 5 + QUAD_ALIGN}}},
{ "mprotect", 1, 3,
{ { Ptr, 0 }, {Int, 1}, {Mprot, 2}}},
{ "open", 1, 3,
OpenPOWER on IntegriCloud