mirror of
https://github.com/troglobit/finit.git
synced 2026-10-15 10:29:35 +00:00
Remove long since deprecated finit.conf: console <DEV> support
All this code did was trigger prctl() to set process name to "console", which you could use as a simple means of figuring out if a process was started from the system console. There are other ways to do this, which Finit should not be involved in. Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
51c5f3cbfa
commit
c76a58ef7a
7 files changed
+10
-32
No files matched your search
@@ -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);
|
||||
|
||||
+5
-7
@@ -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");
|
||||
|
||||
@@ -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 */
|
||||
|
||||
|
||||
@@ -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_ */
|
||||
|
||||
+2
-2
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user