diff --git a/doc/config.md b/doc/config.md index f5d6f063..05539ff4 100644 --- a/doc/config.md +++ b/doc/config.md @@ -197,16 +197,10 @@ Syntax service [12345] /bin/sh -l ``` -* `console ` - Use this, along with a matching `tty DEV` line, to mark this TTY as a - special "console" port with `prctl()`. Useful in use-cases when - all logins except the console must be stopped, e.g. when performing a - flash upgrade on an embedded system. - When running make install no default `/etc/finit.conf` will be installed since system requirements differ too much. Try out the Debian 6.0 example `/usr/share/doc/finit/finit.conf` configuration that -is capable of service monitoring SSH, sysklogd, gdm and a console getty! +is capable of service monitoring SSH, sysklogd, gdm and getty! Every `run`, `task`, `service`, or `inetd` can also list the privileges the `/path/to/cmd` should be executed with. Simply prefix the path with @@ -272,7 +266,6 @@ the above `finit.conf` settings described above, only the following: - `inetd` - `rlimit` - `tty` -- `console` **NOTE:*** The `/etc/finit.d` directory was previously the default Finit `runparts` directory. Finit no longer has a default `runparts`, make diff --git a/src/conf.c b/src/conf.c index 63bf64f2..17ef94ad 100644 --- a/src/conf.c +++ b/src/conf.c @@ -347,13 +347,6 @@ static void parse_dynamic(char *line, struct timeval *mtime) return; } - /* Special TTY console powers */ - if (MATCH_CMD(line, "console ", x)) { - if (console) free(console); - console = strdup(strip_line(x)); - return; - } - /* Regular or serial TTYs to run getty */ if (MATCH_CMD(line, "tty ", x)) { tty_register(strip_line(x), mtime); diff --git a/src/exec.c b/src/exec.c index 0202e2cf..bf2d8931 100644 --- a/src/exec.c +++ b/src/exec.c @@ -235,7 +235,7 @@ int exec_runtask(char *cmd, char *args[]) return execvp(_PATH_BSHELL, argv); } -static void prepare_tty(char *tty, char *procname, int console) +static void prepare_tty(char *tty, char *procname) { struct termios term; @@ -256,8 +256,6 @@ static void prepare_tty(char *tty, char *procname, int console) /* Set INIT_PROCESS UTMP entry */ utmp_set_init(tty, 0); - if (console) - procname = "console"; prctl(PR_SET_NAME, procname, 0, 0, 0); } @@ -291,13 +289,13 @@ static int activate_console(int noclear, int nowait) return 0; } -pid_t run_getty(char *tty, char *speed, char *term, int noclear, int nowait, int console) +pid_t run_getty(char *tty, char *speed, char *term, int noclear, int nowait) { pid_t pid; pid = fork(); if (!pid) { - prepare_tty(tty, "finit-getty", console); + prepare_tty(tty, "finit-getty"); if (activate_console(noclear, nowait)) _exit(getty(tty, speed, term, NULL)); } @@ -305,7 +303,7 @@ pid_t run_getty(char *tty, char *speed, char *term, int noclear, int nowait, int return pid; } -pid_t run_getty2(char *tty, char *cmd, char *args[], int noclear, int nowait, int console) +pid_t run_getty2(char *tty, char *cmd, char *args[], int noclear, int nowait) { pid_t pid; @@ -334,7 +332,7 @@ pid_t run_getty2(char *tty, char *cmd, char *args[], int noclear, int nowait, in dup2(fd, STDOUT_FILENO); dup2(fd, STDERR_FILENO); - prepare_tty(tty, "getty", console); + prepare_tty(tty, "getty"); if (ioctl(STDIN_FILENO, TIOCSCTTY, 1) < 0) _pe("Failed TIOCSCTTY"); diff --git a/src/finit.c b/src/finit.c index a6751713..75afe228 100644 --- a/src/finit.c +++ b/src/finit.c @@ -57,7 +57,6 @@ char *network = NULL; char *hostname = NULL; char *rcsd = FINIT_RCSD; char *runparts = NULL; -char *console = NULL; uev_ctx_t *ctx = NULL; /* Main loop context */ diff --git a/src/finit.h b/src/finit.h index fcd93c3d..14e848c9 100644 --- a/src/finit.h +++ b/src/finit.h @@ -98,7 +98,6 @@ extern char *sdown; extern char *network; extern char *hostname; extern char *runparts; -extern char *console; extern uev_ctx_t *ctx; #endif /* FINIT_H_ */ diff --git a/src/helpers.h b/src/helpers.h index 09c79e50..85fed4a9 100644 --- a/src/helpers.h +++ b/src/helpers.h @@ -65,8 +65,8 @@ int complete (char *cmd, int pid); int run (char *cmd); int run_interactive (char *cmd, char *fmt, ...); int exec_runtask (char *cmd, char *args[]); -pid_t run_getty (char *tty, char *speed, char *term, int noclear, int nowait, int console); -pid_t run_getty2 (char *tty, char *cmd, char *args[], int noclear, int nowait, int console); +pid_t run_getty (char *tty, char *speed, char *term, int noclear, int nowait); +pid_t run_getty2 (char *tty, char *cmd, char *args[], int noclear, int nowait); int run_parts (char *dir, char *cmd); static inline void create(char *path, mode_t mode, uid_t uid, gid_t gid) diff --git a/src/tty.c b/src/tty.c index ce36b632..327ac219 100644 --- a/src/tty.c +++ b/src/tty.c @@ -379,7 +379,6 @@ static int tty_exist(char *dev) void tty_start(finit_tty_t *tty) { - int is_console = 0; char *dev; if (tty->pid) { @@ -393,18 +392,15 @@ void tty_start(finit_tty_t *tty) return; } - if (console && !strcmp(dev, console)) - is_console = 1; - if (tty_exist(dev)) { _d("%s: Not a valid TTY: %s", dev, strerror(errno)); return; } if (!tty->cmd) - tty->pid = run_getty(dev, tty->baud, tty->term, tty->noclear, tty->nowait, is_console); + tty->pid = run_getty(dev, tty->baud, tty->term, tty->noclear, tty->nowait); else - tty->pid = run_getty2(dev, tty->cmd, tty->args, tty->noclear, tty->nowait, is_console); + tty->pid = run_getty2(dev, tty->cmd, tty->args, tty->noclear, tty->nowait); } void tty_stop(finit_tty_t *tty)