summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2020-07-04 10:19:10 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2020-07-04 10:19:10 +0000
commit47f79147fcbfff26ed61159900deb34de7a84d64 (patch)
treeb220b808a9590470d1f089599e07d96f89acbb57
parent1f9e6f44efc4732a93b04e4d8ba8b9598f35e1d9 (diff)
Do the same as libc, store "-1" in the return value when a syscall failed.
Simplify the logic by always exporting the return value and errno in the syscall profiler.
-rw-r--r--sys/dev/dt/dt_prov_syscall.c12
-rw-r--r--sys/dev/dt/dtvar.h3
2 files changed, 9 insertions, 6 deletions
diff --git a/sys/dev/dt/dt_prov_syscall.c b/sys/dev/dt/dt_prov_syscall.c
index 3f765193efa..b2e82551929 100644
--- a/sys/dev/dt/dt_prov_syscall.c
+++ b/sys/dev/dt/dt_prov_syscall.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dt_prov_syscall.c,v 1.3 2020/03/28 15:42:25 mpi Exp $ */
+/* $OpenBSD: dt_prov_syscall.c,v 1.4 2020/07/04 10:19:09 mpi Exp $ */
/*
* Copyright (c) 2019 Martin Pieuchot <mpi@openbsd.org>
@@ -33,7 +33,7 @@ struct dt_probe **dtps_return;
unsigned int dtps_nsysent = SYS_MAXSYSCALL;
/* Flags that make sense for this provider */
-#define DTEVT_PROV_SYSCALL (DTEVT_COMMON|DTEVT_FUNCARGS|DTEVT_RETVAL)
+#define DTEVT_PROV_SYSCALL (DTEVT_COMMON|DTEVT_FUNCARGS)
int dt_prov_syscall_alloc(struct dt_probe *, struct dt_softc *,
struct dt_pcb_list *, struct dtioc_req *);
@@ -195,10 +195,14 @@ dt_prov_syscall_return(struct dt_provider *dtpv, ...)
if (dtev == NULL)
continue;
- if (ISSET(dp->dp_evtflags, DTEVT_RETVAL)) {
+ if (error) {
+ dtev->dtev_sysretval[0] = -1;
+ dtev->dtev_sysretval[1] = 0;
+ dtev->dtev_syserror = error;
+ } else {
dtev->dtev_sysretval[0] = retval[0];
dtev->dtev_sysretval[1] = retval[1];
- dtev->dtev_syserror = error;
+ dtev->dtev_syserror = 0;
}
dt_pcb_ring_consume(dp, dtev);
diff --git a/sys/dev/dt/dtvar.h b/sys/dev/dt/dtvar.h
index 65a89122a14..3e7985692eb 100644
--- a/sys/dev/dt/dtvar.h
+++ b/sys/dev/dt/dtvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: dtvar.h,v 1.4 2020/07/04 08:06:07 anton Exp $ */
+/* $OpenBSD: dtvar.h,v 1.5 2020/07/04 10:19:09 mpi Exp $ */
/*
* Copyright (c) 2019 Martin Pieuchot <mpi@openbsd.org>
@@ -73,7 +73,6 @@ struct dt_evt {
#define DTEVT_USTACK (1 << 1) /* userland stack */
#define DTEVT_KSTACK (1 << 2) /* kernel stack */
#define DTEVT_FUNCARGS (1 << 3) /* function arguments */
-#define DTEVT_RETVAL (1 << 4) /* function retval & error */
#define DTEVT_FLAG_BITS \
"\020" \