From 1af9474b2608696269c52a7dd77c54c9fae615d9 Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Mon, 15 Jul 2019 21:16:01 +0000 Subject: Always set td_errno to the error value of a system call. Early errors prior to a system call did not set td_errno. This commit sets td_errno for all errors during syscallenter(). As a result, syscallret() can now always use td_errno without checking TDP_NERRNO. Reviewed by: kib MFC after: 1 month Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D20898 --- sys/sys/proc.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'sys/sys/proc.h') diff --git a/sys/sys/proc.h b/sys/sys/proc.h index 857bb5234d12..54728697b945 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -303,6 +303,7 @@ struct thread { void *td_su; /* (k) FFS SU private */ sbintime_t td_sleeptimo; /* (t) Sleep timeout. */ int td_rtcgen; /* (s) rtc_generation of abs. sleep */ + int td_errno; /* (k) Error from last syscall. */ size_t td_vslock_sz; /* (k) amount of vslock-ed space */ struct kcov_info *td_kcov_info; /* (*) Kernel code coverage data */ #define td_endzero td_sigmask @@ -353,8 +354,6 @@ struct thread { struct kaudit_record *td_ar; /* (k) Active audit record, if any. */ struct lpohead td_lprof[2]; /* (a) lock profiling objects. */ struct kdtrace_thread *td_dtrace; /* (*) DTrace-specific data. */ - int td_errno; /* Error returned by last syscall. */ - /* LP64 hole */ struct vnet *td_vnet; /* (k) Effective vnet. */ const char *td_vnet_lpush; /* (k) Debugging vnet push / pop. */ struct trapframe *td_intr_frame;/* (k) Frame of the current irq */ -- cgit v1.2.3