summaryrefslogtreecommitdiff
path: root/debian/patches/make_send_right.patch
blob: b4d950dfb613d7912320ad6774d78430b29f62e3 (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
diff --git a/kern/bootstrap.c b/kern/bootstrap.c
index d919e90..6ea5b67 100644
--- a/kern/bootstrap.c
+++ b/kern/bootstrap.c
@@ -90,15 +90,18 @@ static void get_compat_strings(char *flags_str, char *root_str); /* forward */
 static mach_port_t
 task_insert_send_right(
 	task_t task,
-	ipc_port_t port)
+	ipc_port_t port,
+	boolean_t make_send)
 {
 	mach_port_t name;
 
 	for (name = 1;; name++) {
 		kern_return_t kr;
+		ipc_port_t sright;
 
+		sright = make_send? ipc_port_make_send(port): port;
 		kr = mach_port_insert_right(task->itk_space, name,
-			    port, MACH_MSG_TYPE_PORT_SEND);
+			    sright, MACH_MSG_TYPE_PORT_SEND);
 		if (kr == KERN_SUCCESS)
 			break;
 		assert(kr == KERN_NAME_EXISTS);
@@ -155,13 +158,13 @@ void bootstrap_create(void)
       /* Initialize boot script variables.  We leak these send rights.  */
       losers = boot_script_set_variable
 	("host-port", VAL_PORT,
-	 (long)ipc_port_make_send(realhost.host_priv_self));
+	 (long) realhost.host_priv_self);
       if (losers)
 	panic ("cannot set boot-script variable host-port: %s",
 	       boot_script_error_string (losers));
       losers = boot_script_set_variable
 	("device-port", VAL_PORT,
-	 (long) ipc_port_make_send(master_device_port));
+	 (long) master_device_port);
       if (losers)
 	panic ("cannot set boot-script variable device-port: %s",
 	       boot_script_error_string (losers));
@@ -287,11 +290,11 @@ bootstrap_exec_compat(void *e)
 
 	boot_host_port =
 		task_insert_send_right(bootstrap_task,
-			ipc_port_make_send(realhost.host_priv_self));
+				       realhost.host_priv_self, TRUE);
 
 	boot_device_port =
 		task_insert_send_right(bootstrap_task,
-			ipc_port_make_send(master_device_port));
+				       master_device_port, TRUE);
 
 	/*
 	 * Start the bootstrap thread.
@@ -838,13 +841,13 @@ boot_script_free_task (task_t task, int aborting)
 int
 boot_script_insert_right (struct cmd *cmd, mach_port_t port, mach_port_t *name)
 {
-  *name = task_insert_send_right (cmd->task, (ipc_port_t)port);
+  *name = task_insert_send_right (cmd->task, (ipc_port_t)port, TRUE);
   return 0;
 }
 
 int
 boot_script_insert_task_port (struct cmd *cmd, task_t task, mach_port_t *name)
 {
-  *name = task_insert_send_right (cmd->task, task->itk_sself);
+  *name = task_insert_send_right (cmd->task, task->itk_sself, FALSE);
   return 0;
 }