summaryrefslogtreecommitdiff
path: root/debian/patches/0004-proc-call-startup_essential_task-earlier.patch
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches/0004-proc-call-startup_essential_task-earlier.patch')
-rw-r--r--debian/patches/0004-proc-call-startup_essential_task-earlier.patch95
1 files changed, 95 insertions, 0 deletions
diff --git a/debian/patches/0004-proc-call-startup_essential_task-earlier.patch b/debian/patches/0004-proc-call-startup_essential_task-earlier.patch
new file mode 100644
index 00000000..667922db
--- /dev/null
+++ b/debian/patches/0004-proc-call-startup_essential_task-earlier.patch
@@ -0,0 +1,95 @@
+From ff81cb4c7044a803b3338135dad97b14233eed7d Mon Sep 17 00:00:00 2001
+From: Justus Winter <4winter@informatik.uni-hamburg.de>
+Date: Wed, 7 Jan 2015 16:05:48 +0100
+Subject: [PATCH hurd 4/4] proc: call `startup_essential_task' earlier
+
+* proc/main.c (main): Try to lookup `/servers/startup' and send the
+message here, or...
+* proc/msg.c (S_proc_setmsgport): ... fall back to the old way here.
+* proc/proc.h (startup_fallback): New variable.
+---
+ proc/main.c | 19 +++++++++++++++++++
+ proc/msg.c | 2 +-
+ proc/proc.h | 2 ++
+ 3 files changed, 22 insertions(+), 1 deletion(-)
+
+diff --git a/proc/main.c b/proc/main.c
+index b4288fb..2a3d279 100644
+--- a/proc/main.c
++++ b/proc/main.c
+@@ -22,6 +22,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+ #include <mach.h>
+ #include <hurd/hurd_types.h>
+ #include <hurd.h>
++#include <hurd/paths.h>
+ #include <hurd/startup.h>
+ #include <device/device.h>
+ #include <assert.h>
+@@ -62,6 +63,7 @@ message_demuxer (mach_msg_header_t *inp,
+ }
+
+ pthread_mutex_t global_lock = PTHREAD_MUTEX_INITIALIZER;
++int startup_fallback;
+
+ error_t
+ increase_priority (void)
+@@ -99,6 +101,7 @@ main (int argc, char **argv, char **envp)
+ error_t err;
+ void *genport;
+ process_t startup_port;
++ mach_port_t startup;
+ struct argp argp = { 0, 0, 0, "Hurd process server" };
+
+ argp_parse (&argp, argc, argv, 0, 0, 0);
+@@ -173,6 +176,22 @@ main (int argc, char **argv, char **envp)
+ mach_port_deallocate (mach_task_self (), cons);
+ }
+
++ startup = file_name_lookup (_SERVERS_STARTUP, 0, 0);
++ if (MACH_PORT_VALID (startup))
++ {
++ err = startup_essential_task (startup, mach_task_self (),
++ MACH_PORT_NULL, "proc", _hurd_host_priv);
++ assert_perror (err);
++ err = mach_port_deallocate (mach_task_self (), startup);
++ assert_perror (err);
++ }
++ else
++ {
++ error (0, errno, "%s", _SERVERS_STARTUP);
++ /* Fall back to abusing the message port lookup. */
++ startup_fallback = 1;
++ }
++
+ while (1)
+ ports_manage_port_operations_multithread (proc_bucket,
+ message_demuxer,
+diff --git a/proc/msg.c b/proc/msg.c
+index 796cae3..c7bab99 100644
+--- a/proc/msg.c
++++ b/proc/msg.c
+@@ -63,7 +63,7 @@ S_proc_setmsgport (struct proc *p,
+ prociterate (check_message_return, p);
+ p->p_checkmsghangs = 0;
+
+- if (p == startup_proc)
++ if (p == startup_proc && startup_fallback)
+ {
+ /* Init is single threaded, so we can't delay our reply for
+ the essential task RPC; spawn a thread to do it. */
+diff --git a/proc/proc.h b/proc/proc.h
+index a056d18..4be1de4 100644
+--- a/proc/proc.h
++++ b/proc/proc.h
+@@ -151,6 +151,8 @@ mach_port_t generic_port; /* messages not related to a specific proc */
+
+ pthread_mutex_t global_lock;
+
++extern int startup_fallback; /* (ab)use /hurd/startup's message port */
++
+ /* Forward declarations */
+ void complete_wait (struct proc *, int);
+ int check_uid (struct proc *, uid_t);
+--
+2.1.4
+