mirror of
https://github.com/troglobit/finit.git
synced 2026-10-01 13:33:09 +07:00
tty: Refactor, remove useless runlevel argument
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
+1
-1
@@ -72,7 +72,7 @@ static void watcher(void *arg, int fd, int events)
|
||||
|
||||
snprintf(name, sizeof(name), "/dev/%s", notified->name);
|
||||
entry = tty_find(name);
|
||||
if (entry && tty_enabled(&entry->data, runlevel)) {
|
||||
if (entry && tty_enabled(&entry->data)) {
|
||||
if (notified->mask & IN_CREATE)
|
||||
tty_start(&entry->data);
|
||||
else if (entry->data.pid)
|
||||
|
||||
+2
-2
@@ -434,8 +434,8 @@ int main(int argc, char* argv[])
|
||||
/* Enable silent mode before starting TTYs */
|
||||
log_silent();
|
||||
|
||||
/* Start TTYs */
|
||||
tty_runlevel(runlevel);
|
||||
/* Delayed start of TTYs at bootstrap */
|
||||
tty_runlevel();
|
||||
|
||||
/* Start new initctl API responder */
|
||||
api_init(&loop);
|
||||
|
||||
@@ -181,7 +181,7 @@ restart:
|
||||
|
||||
/* No TTYs run at bootstrap, they have a delayed start. */
|
||||
if (prevlevel > 0)
|
||||
tty_runlevel(runlevel);
|
||||
tty_runlevel();
|
||||
|
||||
sm->state = SM_RUNNING_STATE;
|
||||
break;
|
||||
|
||||
@@ -235,7 +235,7 @@ void tty_stop(finit_tty_t *tty)
|
||||
tty->pid = 0;
|
||||
}
|
||||
|
||||
int tty_enabled(finit_tty_t *tty, int runlevel)
|
||||
int tty_enabled(finit_tty_t *tty)
|
||||
{
|
||||
if (!tty)
|
||||
return 0;
|
||||
@@ -301,7 +301,7 @@ int tty_respawn(pid_t pid)
|
||||
/* Clear PID to be able to respawn it. */
|
||||
entry->data.pid = 0;
|
||||
|
||||
if (!tty_enabled(&entry->data, runlevel))
|
||||
if (!tty_enabled(&entry->data))
|
||||
tty_stop(&entry->data);
|
||||
else
|
||||
tty_start(&entry->data);
|
||||
@@ -310,12 +310,12 @@ int tty_respawn(pid_t pid)
|
||||
}
|
||||
|
||||
/* Start all TTYs that exist in the system and are allowed at this runlevel */
|
||||
void tty_runlevel(int runlevel)
|
||||
void tty_runlevel(void)
|
||||
{
|
||||
tty_node_t *entry;
|
||||
|
||||
LIST_FOREACH(entry, &tty_list, link) {
|
||||
if (!tty_enabled(&entry->data, runlevel))
|
||||
if (!tty_enabled(&entry->data))
|
||||
tty_stop(&entry->data);
|
||||
else
|
||||
tty_start(&entry->data);
|
||||
|
||||
@@ -54,9 +54,9 @@ size_t tty_num_active (void);
|
||||
tty_node_t *tty_find_by_pid (pid_t pid);
|
||||
void tty_start (finit_tty_t *tty);
|
||||
void tty_stop (finit_tty_t *tty);
|
||||
int tty_enabled (finit_tty_t *tty, int runlevel);
|
||||
int tty_enabled (finit_tty_t *tty);
|
||||
int tty_respawn (pid_t pid);
|
||||
void tty_runlevel (int runlevel);
|
||||
void tty_runlevel (void);
|
||||
|
||||
#endif /* FINIT_TTY_H_ */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user