summaryrefslogtreecommitdiffstats
path: root/tapset/errno.stp
diff options
context:
space:
mode:
authorjistone <jistone>2007-02-07 02:54:30 +0000
committerjistone <jistone>2007-02-07 02:54:30 +0000
commitb8772cce090adb3d27cdd8b49d236662b526424e (patch)
treef216b71b2bea50d0bd95c9d22956a07e0b6fa49c /tapset/errno.stp
parent3b4136ca14c78881c50e8c36fa35fa574edaabb4 (diff)
downloadsystemtap-steved-b8772cce090adb3d27cdd8b49d236662b526424e.tar.gz
systemtap-steved-b8772cce090adb3d27cdd8b49d236662b526424e.tar.xz
systemtap-steved-b8772cce090adb3d27cdd8b49d236662b526424e.zip
2007-02-06 Josh Stone <joshua.i.stone@intel.com>
* aux_syscalls.stp, inet_sock.stp, ioblock.stp, ioscheduler.stp, nfs.stp, nfs_proc.stp, nfsd.stp, rpc.stp, scsi.stp, signal.stp, socket.stp, task.stp, tcp.stp, vfs.stp: Protect pointer dereferences with kread wherever possible. Some places still have hazards, as marked with FIXMEs. * errno.stp (returnstr): Don't use return in tapset C functions. * aux_syscalls.stp (__uget_timex_m): Ditto. * nfsd.stp (__get_fh): Ditto. * nfs.stp, vfs.stp (<many functions>): Ditto. * string.stp (substr): Ditto. Also make sure start index is valid. * syscalls.stp (syscall.execve): Change __string to kernel_string. LKET/ * nfs.stp, nfs_proc.stp, nfsd.stp, process.stp, tskdispatch.stp: Protect pointer dereferences with kread wherever possible. Some places still have hazards, as marked with FIXMEs. * aio.stp (log_io_getevents): Don't use return in tapset C functions. * timestamp.stp (set_timing_method): Ditto. * utils.stp (filter_by_pid): Ditto.
Diffstat (limited to 'tapset/errno.stp')
-rw-r--r--tapset/errno.stp40
1 files changed, 21 insertions, 19 deletions
diff --git a/tapset/errno.stp b/tapset/errno.stp
index 74634e28..061947b9 100644
--- a/tapset/errno.stp
+++ b/tapset/errno.stp
@@ -357,31 +357,33 @@ function returnstr:string (returnp:long) %{ /* pure */
/* XXX: unfortunate duplication with return.stp:retval() */
- if (CONTEXT->regs) {
+ if (CONTEXT->regs) {
#if defined (__i386__)
- ret = CONTEXT->regs->eax;
+ ret = CONTEXT->regs->eax;
#elif defined (__x86_64__)
- ret = CONTEXT->regs->rax;
+ ret = CONTEXT->regs->rax;
#elif defined (__powerpc64__)
- ret = CONTEXT->regs->gpr[3];
+ ret = CONTEXT->regs->gpr[3];
#elif defined (__ia64__)
- ret = CONTEXT->regs->r8;
+ ret = CONTEXT->regs->r8;
#elif defined (__sparc64__)
- ret = CONTEXT->regs->u_regs[UREG_RETPC];
+ ret = CONTEXT->regs->u_regs[UREG_RETPC];
#elif defined (__s390x__)
ret = CONTEXT->regs->gprs[2];
#else
- return;
-#endif
- } else
- return;
-
- if (ret < 0 && ret > -Maxerrno && errlist[-ret])
- snprintf (THIS->__retvalue, MAXSTRINGLEN, "%ld (%s)", ret, errlist[-ret]);
- else if (THIS->returnp == 2)
- snprintf (THIS->__retvalue, MAXSTRINGLEN, "0x%lx", ret);
- else if (THIS->returnp == 3)
- snprintf (THIS->__retvalue, MAXSTRINGLEN, "%#lo", ret);
- else
- snprintf (THIS->__retvalue, MAXSTRINGLEN, "%ld", ret);
+ goto no_ret;
+#endif
+
+ if (ret < 0 && ret > -Maxerrno && errlist[-ret])
+ snprintf (THIS->__retvalue, MAXSTRINGLEN, "%ld (%s)", ret, errlist[-ret]);
+ else if (THIS->returnp == 2)
+ snprintf (THIS->__retvalue, MAXSTRINGLEN, "0x%lx", ret);
+ else if (THIS->returnp == 3)
+ snprintf (THIS->__retvalue, MAXSTRINGLEN, "%#lo", ret);
+ else
+ snprintf (THIS->__retvalue, MAXSTRINGLEN, "%ld", ret);
+ } else {
+no_ret:
+ strlcpy(THIS->__retvalue, "N/A", MAXSTRINGLEN);
+ }
%}