summaryrefslogtreecommitdiff
path: root/debian/patches/upstreamme0010-kern-use-a-general-lock-for-the-IPC-structures.patch
blob: c0d213ae30f80a8237df79fedc95009402f8c909 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
From 8b089caa29240ffce138bdcbdcbe6ccab3c4a3ab Mon Sep 17 00:00:00 2001
From: Justus Winter <4winter@informatik.uni-hamburg.de>
Date: Sat, 25 Jul 2015 02:29:58 +0200
Subject: [PATCH gnumach 10/10] kern: use a general lock for the IPC structures

* ipc/ipc_thread.h (ith_{lock_init,lock,unlock}): Use a general lock.
* kern/task.h (struct task): Use a general lock for `itk_lock_data'.
(itk_{lock_init,lock,unlock}): Use a general lock.
* kern/thread.h (struct thread): Use a general lock for `ith_lock_data'.
---
 ipc/ipc_thread.h | 6 +++---
 kern/task.h      | 8 ++++----
 kern/thread.h    | 2 +-
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/ipc/ipc_thread.h b/ipc/ipc_thread.h
index 008ab4a..9e2c079 100644
--- a/ipc/ipc_thread.h
+++ b/ipc/ipc_thread.h
@@ -42,9 +42,9 @@ typedef thread_t ipc_thread_t;
 
 #define	ITH_NULL		THREAD_NULL
 
-#define	ith_lock_init(thread)	simple_lock_init(&(thread)->ith_lock_data)
-#define	ith_lock(thread)	simple_lock(&(thread)->ith_lock_data)
-#define	ith_unlock(thread)	simple_unlock(&(thread)->ith_lock_data)
+#define	ith_lock_init(thread)	lock_init(&(thread)->ith_lock_data, FALSE)
+#define	ith_lock(thread)	lock_write(&(thread)->ith_lock_data)
+#define	ith_unlock(thread)	lock_write_done(&(thread)->ith_lock_data)
 
 /*
  *	Note that this isn't a queue, but rather a stack. This causes
diff --git a/kern/task.h b/kern/task.h
index 2a4c28f..93087ff 100644
--- a/kern/task.h
+++ b/kern/task.h
@@ -89,7 +89,7 @@ struct task {
 	time_value_t	creation_time; /* time stamp at creation */
 
 	/* IPC structures */
-	decl_simple_lock_data(, itk_lock_data)
+	struct lock itk_lock_data;
 	struct ipc_port *itk_self;	/* not a right, doesn't hold ref */
 	struct ipc_port *itk_sself;	/* a send right */
 	struct ipc_port *itk_exception;	/* a send right */
@@ -128,9 +128,9 @@ struct task {
 #define task_lock(task)		simple_lock(&(task)->lock)
 #define task_unlock(task)	simple_unlock(&(task)->lock)
 
-#define	itk_lock_init(task)	simple_lock_init(&(task)->itk_lock_data)
-#define	itk_lock(task)		simple_lock(&(task)->itk_lock_data)
-#define	itk_unlock(task)	simple_unlock(&(task)->itk_lock_data)
+#define	itk_lock_init(task)	lock_init(&(task)->itk_lock_data, FALSE)
+#define	itk_lock(task)		lock_write(&(task)->itk_lock_data)
+#define	itk_unlock(task)	lock_write_done(&(task)->itk_lock_data)
 
 /*
  *	Exported routines/macros
diff --git a/kern/thread.h b/kern/thread.h
index 0e85d8c..adf8b86 100644
--- a/kern/thread.h
+++ b/kern/thread.h
@@ -168,7 +168,7 @@ struct thread {
 	   See ipc_kmsg_destroy() for more details.  */
 	struct ipc_kmsg_queue ith_messages; 
 
-	decl_simple_lock_data(, ith_lock_data)
+	struct lock ith_lock_data;
 	struct ipc_port *ith_self;	/* not a right, doesn't hold ref */
 	struct ipc_port *ith_sself;	/* a send right */
 	struct ipc_port *ith_exception;	/* a send right */
-- 
2.1.4