getty-generator.c revision 6705c2df468a6afb4f8f834822780add123065e2
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright 2010 Lennart Poettering
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
systemd 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 systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include "log.h"
#include "util.h"
#include "unit-name.h"
const char *arg_dest = "/tmp";
int r;
log_error("Out of memory");
r = -ENOMEM;
goto finish;
}
r = -errno;
}
return r;
}
int r = EXIT_SUCCESS;
char *active;
if (argc > 2) {
log_error("This program takes one or no arguments.");
return EXIT_FAILURE;
}
if (argc > 1)
log_open();
umask(0022);
if (detect_container(NULL) > 0) {
log_debug("Automatically adding console shell.");
r = EXIT_FAILURE;
/* Don't add any further magic if we are in a container */
goto finish;
}
const char *tty;
tty ++;
else
/* Automatically add in a serial getty on the kernel
* console */
char *n;
/* We assume that gettys on virtual terminals are
* started via manual configuration and do this magic
* only for non-VC terminals. */
add_symlink("serial-getty@.service", n) < 0)
r = EXIT_FAILURE;
free(n);
}
}
/* Automatically add in a serial getty on the first
* virtualizer console */
log_debug("Automatically adding serial getty for hvc0.");
r = EXIT_FAILURE;
}
log_debug("Automatically adding serial getty for xvc0.");
r = EXIT_FAILURE;
}
return r;
}