aboutsummaryrefslogtreecommitdiff
path: root/sys/compat/linuxkpi/common/include/linux/sched.h
diff options
context:
space:
mode:
authorHans Petter Selasky <hselasky@FreeBSD.org>2018-02-22 15:29:19 +0000
committerHans Petter Selasky <hselasky@FreeBSD.org>2018-02-22 15:29:19 +0000
commit949440623b74e9c0f3b47987cff1d2890a8abe88 (patch)
tree391f92173f21623ff0115ba16bd26b7d024c407c /sys/compat/linuxkpi/common/include/linux/sched.h
parent0d787e9b35c2fc01e724f06b4eda2807774e7f4e (diff)
downloadsrc-949440623b74e9c0f3b47987cff1d2890a8abe88.tar.gz
src-949440623b74e9c0f3b47987cff1d2890a8abe88.zip
Return correct error code to user-space when a system call receives a
signal in the LinuxKPI. The read(), write() and mmap() system calls can return either EINTR or ERESTART upon receiving a signal. Add code to figure out the correct return value by temporarily storing the return code from the relevant FreeBSD kernel APIs in the Linux task structure. MFC after: 3 days Sponsored by: Mellanox Technologies
Notes
Notes: svn path=/head/; revision=329825
Diffstat (limited to 'sys/compat/linuxkpi/common/include/linux/sched.h')
-rw-r--r--sys/compat/linuxkpi/common/include/linux/sched.h19
1 files changed, 17 insertions, 2 deletions
diff --git a/sys/compat/linuxkpi/common/include/linux/sched.h b/sys/compat/linuxkpi/common/include/linux/sched.h
index 817e16cb22c7..b24de2c2479b 100644
--- a/sys/compat/linuxkpi/common/include/linux/sched.h
+++ b/sys/compat/linuxkpi/common/include/linux/sched.h
@@ -2,7 +2,7 @@
* Copyright (c) 2010 Isilon Systems, Inc.
* Copyright (c) 2010 iX Systems, Inc.
* Copyright (c) 2010 Panasas, Inc.
- * Copyright (c) 2013-2017 Mellanox Technologies, Ltd.
+ * Copyright (c) 2013-2018 Mellanox Technologies, Ltd.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -77,6 +77,7 @@ struct task_struct {
struct completion exited;
TAILQ_ENTRY(task_struct) rcu_entry;
int rcu_recurse;
+ int bsd_interrupt_value;
};
#define current ({ \
@@ -127,12 +128,26 @@ void linux_send_sig(int signo, struct task_struct *task);
#define signal_pending_state(state, task) \
linux_signal_pending_state(state, task)
#define send_sig(signo, task, priv) do { \
- CTASSERT(priv == 0); \
+ CTASSERT((priv) == 0); \
linux_send_sig(signo, task); \
} while (0)
int linux_schedule_timeout(int timeout);
+static inline void
+linux_schedule_save_interrupt_value(struct task_struct *task, int value)
+{
+ task->bsd_interrupt_value = value;
+}
+
+static inline int
+linux_schedule_get_interrupt_value(struct task_struct *task)
+{
+ int value = task->bsd_interrupt_value;
+ task->bsd_interrupt_value = 0;
+ return (value);
+}
+
#define schedule() \
(void)linux_schedule_timeout(MAX_SCHEDULE_TIMEOUT)
#define schedule_timeout(timeout) \