bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 01/12] init: remove unused function run_for_real


From: Justus Winter
Subject: [PATCH 01/12] init: remove unused function run_for_real
Date: Wed, 20 Nov 2013 14:37:54 +0100

* init/init.c (run_for_real): Remove function.
---
 init/init.c |   89 -----------------------------------------------------------
 1 file changed, 89 deletions(-)

diff --git a/init/init.c b/init/init.c
index de5dd6b..0adde79 100644
--- a/init/init.c
+++ b/init/init.c
@@ -405,95 +405,6 @@ run (const char *server, mach_port_t *ports, task_t *task)
      so we can crash if we don't make it to a fully bootstrapped Hurd.  */
   request_dead_name (*task);
 }
-
-/* Run FILENAME as root with ARGS as its argv (length ARGLEN).  Return
-   the task that we started.  If CTTY is set, then make that the
-   controlling terminal of the new process and put it in its own login
-   collection.  If SETSID is set, put it in a new session.  Return
-   0 if the task was not created successfully. */
-pid_t
-run_for_real (char *filename, char *args, int arglen, mach_port_t ctty,
-             int setsid)
-{
-  file_t file;
-  error_t err;
-  task_t task;
-  char *progname;
-  int pid;
-
-#if 0
-  char buf[512];
-  do
-    {
-      printf ("File name [%s]: ", filename);
-      if (getstring (buf, sizeof (buf)) && *buf)
-       filename = buf;
-      file = file_name_lookup (filename, O_EXEC, 0);
-      if (file == MACH_PORT_NULL)
-       error (0, errno, "%s", filename);
-    }
-  while (file == MACH_PORT_NULL);
-#else
-  file = file_name_lookup (filename, O_EXEC, 0);
-  if (file == MACH_PORT_NULL)
-    {
-      error (0, errno, "%s", filename);
-      return 0;
-    }
-#endif
-
-  task_create (mach_task_self (),
-#ifdef KERN_INVALID_LEDGER
-              NULL, 0, /* OSF Mach */
-#endif
-              0, &task);
-  proc_child (procserver, task);
-  proc_task2pid (procserver, task, &pid);
-  proc_task2proc (procserver, task, &default_ports[INIT_PORT_PROC]);
-  proc_mark_exec (default_ports[INIT_PORT_PROC]);
-  if (setsid)
-    proc_setsid (default_ports[INIT_PORT_PROC]);
-  if (ctty != MACH_PORT_NULL)
-    {
-      term_getctty (ctty, &default_ports[INIT_PORT_CTTYID]);
-      io_mod_owner (ctty, -pid);
-      proc_make_login_coll (default_ports[INIT_PORT_PROC]);
-    }
-  if (bootstrap_args & RB_KDB)
-    {
-      printf ("Pausing for %s\n", filename);
-      getchar ();
-    }
-  progname = strrchr (filename, '/');
-  if (progname)
-    ++progname;
-  else
-    progname = filename;
-  err = file_exec (file, task, 0,
-                  args, arglen,
-                  startup_envz, startup_envz_len,
-                  default_dtable, MACH_MSG_TYPE_COPY_SEND, 3,
-                  default_ports, MACH_MSG_TYPE_COPY_SEND,
-                  INIT_PORT_MAX,
-                  default_ints, INIT_INT_MAX,
-                  NULL, 0, NULL, 0);
-  mach_port_deallocate (mach_task_self (), default_ports[INIT_PORT_PROC]);
-  mach_port_deallocate (mach_task_self (), task);
-  if (ctty != MACH_PORT_NULL)
-    {
-      mach_port_deallocate (mach_task_self (),
-                           default_ports[INIT_PORT_CTTYID]);
-      default_ports[INIT_PORT_CTTYID] = MACH_PORT_NULL;
-    }
-  mach_port_deallocate (mach_task_self (), file);
-  if (err)
-    {
-      error (0, err, "Cannot execute %s", filename);
-      return 0;
-    }
-  return pid;
-}
-
 
 /** Main program and setup **/
 
-- 
1.7.10.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]