mirror of
https://github.com/pygos/init.git
synced 2024-11-22 11:19:45 +01:00
Remove setup_tty function
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
This commit is contained in:
parent
ffb655126a
commit
43274e3910
4 changed files with 1 additions and 56 deletions
|
@ -1,4 +1,4 @@
|
||||||
init_SOURCES = initd/main.c initd/runlst.c initd/init.h initd/setup_tty.c
|
init_SOURCES = initd/main.c initd/runlst.c initd/init.h
|
||||||
init_SOURCES += initd/status.c initd/mksock.c initd/svclist.c
|
init_SOURCES += initd/status.c initd/mksock.c initd/svclist.c
|
||||||
init_CPPFLAGS = $(AM_CPPFLAGS)
|
init_CPPFLAGS = $(AM_CPPFLAGS)
|
||||||
init_CFLAGS = $(AM_CFLAGS)
|
init_CFLAGS = $(AM_CFLAGS)
|
||||||
|
|
12
initd/init.h
12
initd/init.h
|
@ -62,18 +62,6 @@ int runlst_wait(exec_t *list, const char *ctty);
|
||||||
*/
|
*/
|
||||||
pid_t runlst(exec_t *list, const char *ctty);
|
pid_t runlst(exec_t *list, const char *ctty);
|
||||||
|
|
||||||
/********** setup_tty.c **********/
|
|
||||||
|
|
||||||
/*
|
|
||||||
Initial tty setup for init. Makes /dev/console our controlling tty and
|
|
||||||
reroutes all output there. Closes stdin because we presumably won't
|
|
||||||
need it anymore.
|
|
||||||
|
|
||||||
Returns 0 on success, -1 on failure. The function takes care of
|
|
||||||
printing error messages on failure.
|
|
||||||
*/
|
|
||||||
int setup_tty(void);
|
|
||||||
|
|
||||||
/********** status.c **********/
|
/********** status.c **********/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -225,9 +225,6 @@ int main(void)
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (setup_tty())
|
|
||||||
return EXIT_FAILURE;
|
|
||||||
|
|
||||||
memset(pfd, 0, sizeof(pfd));
|
memset(pfd, 0, sizeof(pfd));
|
||||||
pfd[0].fd = sfd;
|
pfd[0].fd = sfd;
|
||||||
pfd[0].events = POLLIN;
|
pfd[0].events = POLLIN;
|
||||||
|
|
|
@ -1,40 +0,0 @@
|
||||||
/* SPDX-License-Identifier: GPL-3.0-or-later */
|
|
||||||
/*
|
|
||||||
* Copyright (C) 2018 - David Oberhollenzer
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "init.h"
|
|
||||||
|
|
||||||
int setup_tty(void)
|
|
||||||
{
|
|
||||||
int fd;
|
|
||||||
|
|
||||||
fd = open("/dev/console", O_WRONLY | O_NOCTTY);
|
|
||||||
if (fd < 0) {
|
|
||||||
perror("/dev/console");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
close(STDIN_FILENO);
|
|
||||||
dup2(fd, STDOUT_FILENO);
|
|
||||||
dup2(fd, STDERR_FILENO);
|
|
||||||
|
|
||||||
close(fd);
|
|
||||||
return 0;
|
|
||||||
}
|
|
Loading…
Reference in a new issue