summaryrefslogtreecommitdiff
path: root/init/init.c
diff options
context:
space:
mode:
authorMichael I. Bushnell <mib@gnu.org>1995-12-05 20:22:19 +0000
committerMichael I. Bushnell <mib@gnu.org>1995-12-05 20:22:19 +0000
commit8de4c044bb40ee209b8224239bea4fe46d080445 (patch)
tree0733682c38f5367030380ede5f3ca76db42d1b18 /init/init.c
parentbe50ce941b64a58069150e0513cd1f8fd87c3eaa (diff)
(launch_single_user): Change initialization of TERMINAL to match new
term driver arg syntax. Start terminal as ordinary passive translator instead of special weird kludge.
Diffstat (limited to 'init/init.c')
-rw-r--r--init/init.c68
1 files changed, 36 insertions, 32 deletions
diff --git a/init/init.c b/init/init.c
index 4f15e4ce..2dab576b 100644
--- a/init/init.c
+++ b/init/init.c
@@ -616,7 +616,7 @@ void
launch_single_user ()
{
char shell[1024];
- char terminal[] = "/hurd/term\0console\0/tmp/console";
+ char terminal[] = "/hurd/term\0/tmp/console\0device\0console";
mach_port_t term, shelltask;
char *termname;
task_t termtask;
@@ -647,43 +647,47 @@ launch_single_user ()
if (term == MACH_PORT_NULL || err || st.st_fstype != FSTYPE_TERM)
{
/* Start the terminal server ourselves. */
+ termname = terminal + strlen (terminal) + 1; /* first arg is name */
+ unlink (termname);
+ term = file_name_lookup (termname, O_CREAT|O_NOTRANS|O_EXCL, 0666);
+ if (term == MACH_PORT_NULL)
+ {
+ perror (termname);
+ goto fail;
+ }
+ errno = file_set_translator (term, FS_TRANS_SET, 0,
+ terminal, sizeof terminal,
+ MACH_PORT_NULL, MACH_MSG_TYPE_COPY_SEND);
+ if (errno)
+ {
+ perror (termname);
+ goto fail;
+ }
+ mach_port_deallocate (mach_task_self (), term);
- termtask = run_for_real (terminal, terminal,
- sizeof (terminal), MACH_PORT_NULL);
- printf (" term");
- fflush (stdout);
-
- /* Must match arg to terminal above. */
- termname = "/tmp/console";
-
- tryagain:
-
+ /* Now repeat the open. */
term = file_name_lookup (termname, O_READ, 0);
- if (term != MACH_PORT_NULL)
- io_stat (term, &st);
- if (term == MACH_PORT_NULL || st.st_fstype != FSTYPE_TERM)
+ if (term == MACH_PORT_NULL)
{
- /* It hasn't been set yet; sleep a bit and try again.
-
- However, if TERMTASK has died, then it has a bug. We'll
- just let our fd's pass through unchanged. This probably
- won't work, but it will enable some sort of debugging,
- maybe. */
- errno = task_info (termtask, TASK_BASIC_INFO, foobiebletch,
- &foobiebletchcount);
- if (errno != MACH_SEND_INVALID_DEST
- && errno != KERN_INVALID_ARGUMENT)
- {
- sleep (1);
- goto tryagain;
- }
- printf ("\nWarning: no normal console terminal.\n");
- fflush (stdout);
+ perror (termname);
+ goto fail;
+ }
+ errno = io_stat (term, &st);
+ if (errno)
+ {
+ perror (termname);
term = MACH_PORT_NULL;
+ goto fail;
+ }
+ if (st.st_fstype != FSTYPE_TERM)
+ {
+ fprintf (stderr, "Installed /tmp/console terminal failed\n");
+ term = MACH_PORT_NULL;
+ goto fail;
}
- mach_port_deallocate (mach_task_self (), termtask);
}
-
+ fail:
+
/* At this point either TERM is the console or it's null. If it's
null, then don't do anything, and our fd's will be copied.
Otherwise, open fd's 0, 1, and 2. */